33 lines
777 B
JavaScript
33 lines
777 B
JavaScript
/**
|
|
* Copyright (c) HashiCorp, Inc.
|
|
* SPDX-License-Identifier: MPL-2.0
|
|
*/
|
|
|
|
import Component from '@glimmer/component';
|
|
import { action } from '@ember/object';
|
|
import { storageFor } from '../../../../services/local-storage';
|
|
|
|
export default class AgentlessNotice extends Component {
|
|
storageKey = 'nodes-agentless-dismissed';
|
|
@storageFor('notices') notices;
|
|
|
|
constructor() {
|
|
super(...arguments);
|
|
|
|
if (this.args.postfix) {
|
|
this.storageKey = `nodes-agentless-dismissed-${this.args.postfix}`;
|
|
}
|
|
}
|
|
|
|
get isVisible() {
|
|
const { items, filteredItems } = this.args;
|
|
|
|
return !this.notices.state.includes(this.storageKey) && items.length > filteredItems.length;
|
|
}
|
|
|
|
@action
|
|
dismissAgentlessNotice() {
|
|
this.notices.add(this.storageKey);
|
|
}
|
|
}
|