Set postfix for agentless-notice storage key based on partition and dc

pull/14971/head
wenincode 2022-10-14 14:08:40 -06:00
parent 6c2ca0ba3f
commit 63c4d670d9
3 changed files with 8 additions and 6 deletions

View File

@ -11,8 +11,8 @@ export default class AgentlessNotice extends Component {
constructor(owner, args) { constructor(owner, args) {
super(owner, args); super(owner, args);
if (this.args.dc) { if (this.args.postfix) {
this.storageKey = `consul-nodes-agentless-notice-dismissed-${this.args.dc}`; this.storageKey = `consul-nodes-agentless-notice-dismissed-${this.args.postfix}`;
} }
if (window.localStorage.getItem(this.storageKey) === DISMISSED_VALUE) { if (window.localStorage.getItem(this.storageKey) === DISMISSED_VALUE) {

View File

@ -60,7 +60,7 @@
{{/if}} {{/if}}
</BlockSlot> </BlockSlot>
<BlockSlot @name='content'> <BlockSlot @name='content'>
<Consul::Node::AgentlessNotice @items={{items}} @filteredItems={{filtered}} @dc={{route.params.dc}} /> <Consul::Node::AgentlessNotice @items={{items}} @filteredItems={{filtered}} @postfix={{concat route.params.partition route.params.dc}} />
<DataCollection <DataCollection
@type='node' @type='node'
@sort={{sort.value}} @sort={{sort.value}}

View File

@ -89,14 +89,16 @@ module('Integration | Component | consul node agentless-notice', function (hooks
}, },
]); ]);
window.localStorage.setItem('consul-nodes-agentless-notice-dismissed-dc2', 'true'); window.localStorage.setItem('consul-nodes-agentless-notice-dismissed-partition', 'true');
await render( await render(
hbs`<Consul::Node::AgentlessNotice @items={{this.nodes}} @filteredItems={{this.filteredNodes}} @dc="dc2" />` hbs`<Consul::Node::AgentlessNotice @items={{this.nodes}} @filteredItems={{this.filteredNodes}} @postfix="partition" />`
); );
assert.true( assert.true(
window.localStorage.getItem.calledOnceWith('consul-nodes-agentless-notice-dismissed-dc2') window.localStorage.getItem.calledOnceWith(
'consul-nodes-agentless-notice-dismissed-partition'
)
); );
assert assert