Enable config dismissal as well

pull/20275/head
Chris Hut 2024-01-22 14:41:02 -08:00
parent ce3a3e6692
commit e6784c4335
2 changed files with 8 additions and 4 deletions

View File

@ -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);
}

View File

@ -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) {