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

This commit is contained in:
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) {
super(owner, args);
if (this.args.dc) {
this.storageKey = `consul-nodes-agentless-notice-dismissed-${this.args.dc}`;
if (this.args.postfix) {
this.storageKey = `consul-nodes-agentless-notice-dismissed-${this.args.postfix}`;
}
if (window.localStorage.getItem(this.storageKey) === DISMISSED_VALUE) {

View File

@ -60,7 +60,7 @@
{{/if}}
</BlockSlot>
<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
@type='node'
@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(
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(
window.localStorage.getItem.calledOnceWith('consul-nodes-agentless-notice-dismissed-dc2')
window.localStorage.getItem.calledOnceWith(
'consul-nodes-agentless-notice-dismissed-partition'
)
);
assert