ui: Use HCPURL / .HCPURL (#14489)
This commit is contained in:
parent
9b5c5c5062
commit
39439d07bd
|
@ -2,7 +2,7 @@
|
||||||
class="consul-hcp-home"
|
class="consul-hcp-home"
|
||||||
...attributes
|
...attributes
|
||||||
>
|
>
|
||||||
<a href={{env 'CONSUL_HCP_URL'}}>
|
<a href={{env 'CONSUL_HCP_URL'}} data-native-href="true">
|
||||||
Back to HCP
|
Back to HCP
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -0,0 +1,38 @@
|
||||||
|
import { module, test } from 'qunit';
|
||||||
|
import { setupRenderingTest } from 'ember-qunit';
|
||||||
|
import { render } from '@ember/test-helpers';
|
||||||
|
import hbs from 'htmlbars-inline-precompile';
|
||||||
|
|
||||||
|
import ConsulHcpHome from 'consul-ui/components/consul/hcp/home';
|
||||||
|
|
||||||
|
module('Integration | Component | consul hcp home', function(hooks) {
|
||||||
|
setupRenderingTest(hooks);
|
||||||
|
|
||||||
|
test('it prints the value of CONSUL_HCP_URL', async function(assert) {
|
||||||
|
// temporary registration until we are running as separate applications
|
||||||
|
this.owner.register(
|
||||||
|
'component:consul/hcp/home',
|
||||||
|
ConsulHcpHome
|
||||||
|
);
|
||||||
|
//
|
||||||
|
|
||||||
|
const Helper = this.owner.resolveRegistration('helper:env');
|
||||||
|
this.owner.register(
|
||||||
|
'helper:env',
|
||||||
|
class extends Helper {
|
||||||
|
compute([name, def]) {
|
||||||
|
switch(name) {
|
||||||
|
case 'CONSUL_HCP_URL':
|
||||||
|
return 'http://hcp';
|
||||||
|
}
|
||||||
|
return super.compute(...arguments);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
await render(hbs`<Consul::Hcp::Home />`);
|
||||||
|
|
||||||
|
assert.dom('a').hasAttribute('href', 'http://hcp');
|
||||||
|
|
||||||
|
});
|
||||||
|
});
|
|
@ -138,6 +138,8 @@ export default function(config = {}, win = window, doc = document) {
|
||||||
// make and API request so this specific variable should never be be
|
// make and API request so this specific variable should never be be
|
||||||
// retrived via an API request
|
// retrived via an API request
|
||||||
return operatorConfig.APIPrefix;
|
return operatorConfig.APIPrefix;
|
||||||
|
case 'CONSUL_HCP_URL':
|
||||||
|
return operatorConfig.HCPURL;
|
||||||
case 'CONSUL_UI_CONFIG':
|
case 'CONSUL_UI_CONFIG':
|
||||||
dashboards = {
|
dashboards = {
|
||||||
service: undefined,
|
service: undefined,
|
||||||
|
@ -253,6 +255,7 @@ export default function(config = {}, win = window, doc = document) {
|
||||||
case 'CONSUL_DATACENTER_LOCAL':
|
case 'CONSUL_DATACENTER_LOCAL':
|
||||||
case 'CONSUL_DATACENTER_PRIMARY':
|
case 'CONSUL_DATACENTER_PRIMARY':
|
||||||
case 'CONSUL_API_PREFIX':
|
case 'CONSUL_API_PREFIX':
|
||||||
|
case 'CONSUL_HCP_URL':
|
||||||
case 'CONSUL_ACLS_ENABLED':
|
case 'CONSUL_ACLS_ENABLED':
|
||||||
case 'CONSUL_NSPACES_ENABLED':
|
case 'CONSUL_NSPACES_ENABLED':
|
||||||
case 'CONSUL_PEERINGS_ENABLED':
|
case 'CONSUL_PEERINGS_ENABLED':
|
||||||
|
|
|
@ -0,0 +1,2 @@
|
||||||
|
// temporary import until we are running as separate applications
|
||||||
|
import 'consul-ui/components/consul/hcp/home/index.test';
|
Loading…
Reference in New Issue