mirror of https://github.com/hashicorp/consul
Enable config dismissal as well
parent
ce3a3e6692
commit
e6784c4335
|
@ -1,20 +1,27 @@
|
|||
import Service from '@ember/service';
|
||||
import { tracked } from '@glimmer/tracking';
|
||||
import { inject as service } from '@ember/service';
|
||||
|
||||
const LOCAL_STORAGE_KEY = 'consul:hideHcpLinkBanner';
|
||||
|
||||
export default class HcpLinkStatus extends Service {
|
||||
@service('ui-config') config;
|
||||
|
||||
@tracked
|
||||
alreadyLinked = false;
|
||||
@tracked
|
||||
userDismissedBanner = false;
|
||||
@tracked
|
||||
cloudConfigDisabled = false;
|
||||
|
||||
get shouldDisplayBanner() {
|
||||
return !this.alreadyLinked && !this.userDismissedBanner;
|
||||
return !this.alreadyLinked && !this.userDismissedBanner && !this.cloudConfigDisabled;
|
||||
}
|
||||
|
||||
constructor() {
|
||||
super(...arguments);
|
||||
const config = this.config.getSync();
|
||||
this.cloudConfigDisabled = config?.cloud?.enabled === false;
|
||||
this.userDismissedBanner = !!localStorage.getItem(LOCAL_STORAGE_KEY);
|
||||
}
|
||||
|
||||
|
|
|
@ -9,9 +9,6 @@ module('Acceptance | link to hcp banner', function (hooks) {
|
|||
hooks.beforeEach(function () {
|
||||
// clear local storage so we don't have any settings
|
||||
window.localStorage.clear();
|
||||
// setupTestEnv(this.owner, {
|
||||
// CONSUL_ACLS_ENABLED: true,
|
||||
// });
|
||||
});
|
||||
|
||||
test('the banner is initially displayed on services page', async function (assert) {
|
||||
|
|
Loading…
Reference in New Issue