Skip to content

Commit

Permalink
Enable config dismissal as well
Browse files Browse the repository at this point in the history
  • Loading branch information
chris-hut committed Jan 22, 2024
1 parent ce3a3e6 commit e6784c4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
9 changes: 8 additions & 1 deletion ui/packages/consul-ui/app/services/hcp-link-status.js
Original file line number Diff line number Diff line change
@@ -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);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit e6784c4

Please sign in to comment.