2022-10-13 14:28:46 +00:00
|
|
|
import Component from '@glimmer/component';
|
|
|
|
import { action } from '@ember/object';
|
2022-10-18 15:40:47 +00:00
|
|
|
import { storageFor } from '../../../../services/local-storage';
|
2022-10-13 14:28:46 +00:00
|
|
|
|
|
|
|
export default class AgentlessNotice extends Component {
|
2022-10-18 15:40:47 +00:00
|
|
|
storageKey = 'nodes-agentless-dismissed';
|
|
|
|
@storageFor('notices') notices;
|
2022-10-14 18:21:25 +00:00
|
|
|
|
2022-10-18 17:53:24 +00:00
|
|
|
constructor() {
|
|
|
|
super(...arguments);
|
2022-10-14 18:21:25 +00:00
|
|
|
|
2022-10-14 20:08:40 +00:00
|
|
|
if (this.args.postfix) {
|
2022-10-18 15:40:47 +00:00
|
|
|
this.storageKey = `nodes-agentless-dismissed-${this.args.postfix}`;
|
2022-10-14 18:21:25 +00:00
|
|
|
}
|
|
|
|
}
|
2022-10-13 14:28:46 +00:00
|
|
|
|
|
|
|
get isVisible() {
|
|
|
|
const { items, filteredItems } = this.args;
|
|
|
|
|
2022-10-18 15:40:47 +00:00
|
|
|
return !this.notices.state.includes(this.storageKey) && items.length > filteredItems.length;
|
2022-10-13 14:28:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
@action
|
|
|
|
dismissAgentlessNotice() {
|
2022-10-18 15:40:47 +00:00
|
|
|
this.notices.add(this.storageKey);
|
2022-10-13 14:28:46 +00:00
|
|
|
}
|
|
|
|
}
|