mirror of https://github.com/hashicorp/consul
chor: remove temporary CONSUL_HCP_LINK_ENABLED env flag (#20552)
parent
24e15cc24e
commit
6708e88ec9
|
@ -9,14 +9,12 @@ import { tracked } from '@glimmer/tracking';
|
||||||
const LOCAL_STORAGE_KEY = 'consul:hideHcpLinkBanner';
|
const LOCAL_STORAGE_KEY = 'consul:hideHcpLinkBanner';
|
||||||
|
|
||||||
export default class HcpLinkStatus extends Service {
|
export default class HcpLinkStatus extends Service {
|
||||||
@service('env') env;
|
|
||||||
@service abilities;
|
@service abilities;
|
||||||
@tracked
|
@tracked
|
||||||
userDismissedBanner = false;
|
userDismissedBanner = false;
|
||||||
|
|
||||||
get shouldDisplayBanner() {
|
get shouldDisplayBanner() {
|
||||||
const hcpLinkEnabled = this.env.var('CONSUL_HCP_LINK_ENABLED');
|
return !this.userDismissedBanner && this.hasPermissionToLink;
|
||||||
return !this.userDismissedBanner && this.hasPermissionToLink && hcpLinkEnabled;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
get hasPermissionToLink() {
|
get hasPermissionToLink() {
|
||||||
|
|
|
@ -6,7 +6,6 @@
|
||||||
import { module, test } from 'qunit';
|
import { module, test } from 'qunit';
|
||||||
import { click, visit } from '@ember/test-helpers';
|
import { click, visit } from '@ember/test-helpers';
|
||||||
import { setupApplicationTest } from 'ember-qunit';
|
import { setupApplicationTest } from 'ember-qunit';
|
||||||
import { EnvStub } from 'consul-ui/services/env';
|
|
||||||
|
|
||||||
const bannerSelector = '[data-test-link-to-hcp-banner]';
|
const bannerSelector = '[data-test-link-to-hcp-banner]';
|
||||||
const linkToHcpSelector = '[data-test-link-to-hcp]';
|
const linkToHcpSelector = '[data-test-link-to-hcp]';
|
||||||
|
@ -16,14 +15,6 @@ module('Acceptance | link to hcp', function (hooks) {
|
||||||
hooks.beforeEach(function () {
|
hooks.beforeEach(function () {
|
||||||
// clear local storage so we don't have any settings
|
// clear local storage so we don't have any settings
|
||||||
window.localStorage.clear();
|
window.localStorage.clear();
|
||||||
this.owner.register(
|
|
||||||
'service:env',
|
|
||||||
class Stub extends EnvStub {
|
|
||||||
stubEnv = {
|
|
||||||
CONSUL_HCP_LINK_ENABLED: true,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
test('the banner and nav item are initially displayed on services page', async function (assert) {
|
test('the banner and nav item are initially displayed on services page', async function (assert) {
|
||||||
|
@ -44,17 +35,4 @@ module('Acceptance | link to hcp', function (hooks) {
|
||||||
// link to HCP nav item still there
|
// link to HCP nav item still there
|
||||||
assert.dom(linkToHcpSelector).isVisible('Link to HCP nav item is visible by default');
|
assert.dom(linkToHcpSelector).isVisible('Link to HCP nav item is visible by default');
|
||||||
});
|
});
|
||||||
|
|
||||||
test('the banner is not displayed if the env var is not set', async function (assert) {
|
|
||||||
this.owner.register(
|
|
||||||
'service:env',
|
|
||||||
class Stub extends EnvStub {
|
|
||||||
stubEnv = {};
|
|
||||||
}
|
|
||||||
);
|
|
||||||
// default route is services page so we're good here
|
|
||||||
await visit('/');
|
|
||||||
// Expect the banner to be visible by default
|
|
||||||
assert.dom(bannerSelector).doesNotExist('Banner is not here');
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
|
@ -27,14 +27,6 @@ module('Integration | Component | link-to-hcp-banner', function (hooks) {
|
||||||
|
|
||||||
hooks.beforeEach(function () {
|
hooks.beforeEach(function () {
|
||||||
this.owner.register('service:hcp-link-status', HcpLinkStatusStub);
|
this.owner.register('service:hcp-link-status', HcpLinkStatusStub);
|
||||||
this.owner.register(
|
|
||||||
'service:env',
|
|
||||||
class Stub extends EnvStub {
|
|
||||||
stubEnv = {
|
|
||||||
CONSUL_HCP_LINK_ENABLED: true,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
test('it renders banner when hcp-link-status says it should', async function (assert) {
|
test('it renders banner when hcp-link-status says it should', async function (assert) {
|
||||||
|
|
Loading…
Reference in New Issue