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 f658ee9996
commit 71a7b03b94
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({ (routes => routes({
dc: { dc: {
show: { show: null
license: null,
},
}, },
}))( }))(
(json, data = (typeof document !== 'undefined' ? document.currentScript.dataset : module.exports)) => { (json, data = (typeof document !== 'undefined' ? document.currentScript.dataset : module.exports)) => {

View File

@ -1,9 +1,12 @@
import BaseAbility from './base'; import BaseAbility from './base';
import { inject as service } from '@ember/service';
export default class OverviewAbility extends BaseAbility { export default class OverviewAbility extends BaseAbility {
@service('env') env;
resource = 'operator'; resource = 'operator';
segmented = false; segmented = false;
get canAccess() { 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' return typeof operatorConfig.PeeringEnabled === 'undefined'
? false ? false
: operatorConfig.PeeringEnabled; : operatorConfig.PeeringEnabled;
case 'CONSUL_HCP_ENABLED':
return typeof operatorConfig.HCPEnabled === 'undefined'
? false
: operatorConfig.HCPEnabled;
case 'CONSUL_DATACENTER_LOCAL': case 'CONSUL_DATACENTER_LOCAL':
return operatorConfig.LocalDatacenter; return operatorConfig.LocalDatacenter;
case 'CONSUL_DATACENTER_PRIMARY': case 'CONSUL_DATACENTER_PRIMARY':
@ -226,6 +230,9 @@ export default function(config = {}, win = window, doc = document) {
case 'CONSUL_PEERINGS_ENABLE': case 'CONSUL_PEERINGS_ENABLE':
prev['CONSUL_PEERINGS_ENABLED'] = !!JSON.parse(String(value).toLowerCase()); prev['CONSUL_PEERINGS_ENABLED'] = !!JSON.parse(String(value).toLowerCase());
break; break;
case 'CONSUL_HCP_ENABLE':
prev['CONSUL_HCP_ENABLED'] = !!JSON.parse(String(value).toLowerCase());
break;
case 'CONSUL_UI_CONFIG': case 'CONSUL_UI_CONFIG':
prev['CONSUL_UI_CONFIG'] = JSON.parse(value); prev['CONSUL_UI_CONFIG'] = JSON.parse(value);
break; break;
@ -275,6 +282,7 @@ export default function(config = {}, win = window, doc = document) {
case 'CONSUL_ACLS_ENABLED': case 'CONSUL_ACLS_ENABLED':
case 'CONSUL_NSPACES_ENABLED': case 'CONSUL_NSPACES_ENABLED':
case 'CONSUL_PEERINGS_ENABLED': case 'CONSUL_PEERINGS_ENABLED':
case 'CONSUL_HCP_ENABLED':
case 'CONSUL_SSO_ENABLED': case 'CONSUL_SSO_ENABLED':
case 'CONSUL_PARTITIONS_ENABLED': case 'CONSUL_PARTITIONS_ENABLED':
case 'CONSUL_METRICS_PROVIDER': case 'CONSUL_METRICS_PROVIDER':