ui: Completely remove the Overview routes when running the UI in HCP (#14606)

This commit is contained in:
John Cowen 2022-09-14 19:39:50 +01:00 committed by GitHub
parent acd9d42914
commit ea06d6c5aa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 16 additions and 4 deletions

3
.changelog/14606.txt Normal file
View File

@ -0,0 +1,3 @@
```release-note:bug
ui: Removed Overview page from HCP instalations
```

View File

@ -1,8 +1,6 @@
(routes => routes({
dc: {
show: {
license: null,
},
show: null
},
}))(
(json, data = (typeof document !== 'undefined' ? document.currentScript.dataset : module.exports)) => {

View File

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

View File

@ -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':
@ -226,6 +230,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;
@ -275,6 +282,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':