Skip to content

Commit

Permalink
Backport of ui: Completely remove the Overview routes when running th…
Browse files Browse the repository at this point in the history
…e UI in HCP into release/1.13.x (#14682)

This pull request was automerged via backport-assistant
  • Loading branch information
hc-github-team-consul-core authored Sep 20, 2022
1 parent 3c321b6 commit 6fbe899
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 4 deletions.
3 changes: 3 additions & 0 deletions .changelog/14606.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:bug
ui: Removed Overview page from HCP instalations
```
4 changes: 1 addition & 3 deletions ui/packages/consul-hcp/vendor/consul-hcp/routes.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
(routes => routes({
dc: {
show: {
license: null,
},
show: null
},
}))(
(json, data = (typeof document !== 'undefined' ? document.currentScript.dataset : module.exports)) => {
Expand Down
5 changes: 4 additions & 1 deletion ui/packages/consul-ui/app/abilities/overview.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
import BaseAbility from './base';
import { inject as service } from '@ember/service';

export default class OverviewAbility extends BaseAbility {
@service('env') env;

resource = 'operator';
segmented = false;
get canAccess() {
return this.canRead;
return !this.env.var('CONSUL_HCP_ENABLED') && this.canRead;
}
}
8 changes: 8 additions & 0 deletions ui/packages/consul-ui/app/utils/get-environment.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,10 @@ export default function(config = {}, win = window, doc = document) {
return typeof operatorConfig.PeeringEnabled === 'undefined'
? false
: operatorConfig.PeeringEnabled;
case 'CONSUL_HCP_ENABLED':
return typeof operatorConfig.HCPEnabled === 'undefined'
? false
: operatorConfig.HCPEnabled;
case 'CONSUL_DATACENTER_LOCAL':
return operatorConfig.LocalDatacenter;
case 'CONSUL_DATACENTER_PRIMARY':
Expand Down Expand Up @@ -216,6 +220,9 @@ export default function(config = {}, win = window, doc = document) {
case 'CONSUL_PEERINGS_ENABLE':
prev['CONSUL_PEERINGS_ENABLED'] = !!JSON.parse(String(value).toLowerCase());
break;
case 'CONSUL_HCP_ENABLE':
prev['CONSUL_HCP_ENABLED'] = !!JSON.parse(String(value).toLowerCase());
break;
case 'CONSUL_UI_CONFIG':
prev['CONSUL_UI_CONFIG'] = JSON.parse(value);
break;
Expand Down Expand Up @@ -249,6 +256,7 @@ export default function(config = {}, win = window, doc = document) {
case 'CONSUL_ACLS_ENABLED':
case 'CONSUL_NSPACES_ENABLED':
case 'CONSUL_PEERINGS_ENABLED':
case 'CONSUL_HCP_ENABLED':
case 'CONSUL_SSO_ENABLED':
case 'CONSUL_PARTITIONS_ENABLED':
case 'CONSUL_METRICS_PROVIDER':
Expand Down

0 comments on commit 6fbe899

Please sign in to comment.