diff --git a/ui/packages/consul-ui/app/components/consul/service/notifications/index.hbs b/ui/packages/consul-ui/app/components/consul/service/notifications/index.hbs deleted file mode 100644 index 85679bb99..000000000 --- a/ui/packages/consul-ui/app/components/consul/service/notifications/index.hbs +++ /dev/null @@ -1,6 +0,0 @@ -{{#if (eq @type 'update')}} - {{#if (eq @status 'warning') }} - This service has been deregistered and no longer exists in the catalog. - {{else}} - {{/if}} -{{/if}} diff --git a/ui/packages/consul-ui/app/controllers/dc/services/instance.js b/ui/packages/consul-ui/app/controllers/dc/services/instance.js deleted file mode 100644 index 8030ab37e..000000000 --- a/ui/packages/consul-ui/app/controllers/dc/services/instance.js +++ /dev/null @@ -1,28 +0,0 @@ -import { inject as service } from '@ember/service'; -import Controller from '@ember/controller'; -import { get, action } from '@ember/object'; - -export default class InstanceController extends Controller { - @service('flashMessages') - notify; - - @action - error(e) { - if (e.target.readyState === 1) { - // OPEN - if (get(e, 'error.errors.firstObject.status') === '404') { - this.notify.add({ - destroyOnClick: false, - sticky: true, - type: 'warning', - action: 'update', - }); - [e.target, this.proxy].forEach(function(item) { - if (item && typeof item.close === 'function') { - item.close(); - } - }); - } - } - } -} diff --git a/ui/packages/consul-ui/app/controllers/dc/services/show.js b/ui/packages/consul-ui/app/controllers/dc/services/show.js deleted file mode 100644 index 650f078d3..000000000 --- a/ui/packages/consul-ui/app/controllers/dc/services/show.js +++ /dev/null @@ -1,27 +0,0 @@ -import { inject as service } from '@ember/service'; -import Controller from '@ember/controller'; -import { get, action } from '@ember/object'; - -export default class ShowController extends Controller { - @service('flashMessages') notify; - - @action - error(e) { - if (e.target.readyState === 1) { - // OPEN - if (get(e, 'error.errors.firstObject.status') === '404') { - this.notify.add({ - destroyOnClick: false, - sticky: true, - type: 'warning', - action: 'update', - }); - } - [e.target, this.proxies].forEach(function(item) { - if (item && typeof item.close === 'function') { - item.close(); - } - }); - } - } -} diff --git a/ui/packages/consul-ui/app/routes/dc/services/instance.js b/ui/packages/consul-ui/app/routes/dc/services/instance.js index feea1d16b..9912b5780 100644 --- a/ui/packages/consul-ui/app/routes/dc/services/instance.js +++ b/ui/packages/consul-ui/app/routes/dc/services/instance.js @@ -7,7 +7,7 @@ export default class InstanceRoute extends Route { async model(params, transition) { const dc = this.modelFor('dc').dc.Name; - const nspace = this.modelFor('nspace').nspace.substr(1) || 'default'; + const nspace = this.modelFor('nspace').nspace.substr(1); const item = await this.data.source( uri => uri`/${nspace}/${dc}/service-instance/${params.id}/${params.node}/${params.name}` diff --git a/ui/packages/consul-ui/app/routes/dc/services/show.js b/ui/packages/consul-ui/app/routes/dc/services/show.js index 63339ca97..7d87b0130 100644 --- a/ui/packages/consul-ui/app/routes/dc/services/show.js +++ b/ui/packages/consul-ui/app/routes/dc/services/show.js @@ -11,9 +11,10 @@ export default class ShowRoute extends Route { const nspace = this.modelFor('nspace').nspace.substr(1); const slug = params.name; + let chain; let proxies = []; - const urls = this.config.get().dashboard_url_templates; + const urls = await this.config.findByPath('dashboard_url_templates'); const items = await this.data.source( uri => uri`/${nspace}/${dc.Name}/service-instances/for-service/${params.name}` ); @@ -30,9 +31,7 @@ export default class ShowRoute extends Route { // use that endpoint here. Eventually if we have an endpoint specific to // a dc that gives us more DC specific info we can use that instead // higher up the routing hierarchy instead. - let chain = this.data.source( - uri => uri`/${nspace}/${dc.Name}/discovery-chain/${params.name}` - ); + chain = this.data.source(uri => uri`/${nspace}/${dc.Name}/discovery-chain/${params.name}`); [chain, proxies] = await Promise.all([chain, proxies]); // we close the chain for now, if you enter the routing tab before the // EventSource comes around to request again, this one will just be @@ -45,6 +44,7 @@ export default class ShowRoute extends Route { slug, items, urls, + chain, proxies, }; } diff --git a/ui/packages/consul-ui/app/routes/dc/services/show/topology.js b/ui/packages/consul-ui/app/routes/dc/services/show/topology.js index 4d5216719..b278b4ff2 100644 --- a/ui/packages/consul-ui/app/routes/dc/services/show/topology.js +++ b/ui/packages/consul-ui/app/routes/dc/services/show/topology.js @@ -4,7 +4,6 @@ import { get, action } from '@ember/object'; export default class TopologyRoute extends Route { @service('ui-config') config; - @service('env') env; @service('data-source/service') data; @service('repository/intention') repo; @@ -32,19 +31,20 @@ export default class TopologyRoute extends Route { const nspace = get(model, 'nspace'); const item = get(model, 'items.firstObject'); - if (get(item, 'IsMeshOrigin')) { - let kind = get(item, 'Service.Kind'); - if (typeof kind === 'undefined') { - kind = ''; - } - model.topology = await this.data.source( - uri => uri`/${nspace}/${dc.Name}/topology/${model.slug}/${kind}` - ); + let kind = get(item, 'Service.Kind'); + if (typeof kind === 'undefined') { + kind = ''; } + const topology = await this.data.source( + uri => uri`/${nspace}/${dc.Name}/topology/${model.slug}/${kind}` + ); + let hasMetricsProvider = await this.config.findByPath('metrics_provider'); + hasMetricsProvider = !!hasMetricsProvider; + return { ...model, - hasMetricsProvider: !!this.config.get().metrics_provider, - isRemoteDC: this.env.var('CONSUL_DATACENTER_LOCAL') !== this.modelFor('dc').dc.Name, + topology, + hasMetricsProvider, }; } diff --git a/ui/packages/consul-ui/app/services/repository/metrics.js b/ui/packages/consul-ui/app/services/repository/metrics.js index e0138241d..ab97ec488 100644 --- a/ui/packages/consul-ui/app/services/repository/metrics.js +++ b/ui/packages/consul-ui/app/services/repository/metrics.js @@ -5,7 +5,7 @@ import RepositoryService from 'consul-ui/services/repository'; // metrics provider export default class MetricsService extends RepositoryService { - @service('ui-config') cfg; + @service('ui-config') config; @service('env') env; @service('client/http') client; @@ -13,16 +13,16 @@ export default class MetricsService extends RepositoryService { init() { super.init(...arguments); - const uiCfg = this.cfg.get(); + const config = this.config.get(); // Inject whether or not the proxy is enabled as an option into the opaque // JSON options the user provided. - const opts = uiCfg.metrics_provider_options || {}; - opts.metrics_proxy_enabled = uiCfg.metrics_proxy_enabled; + const opts = config.metrics_provider_options || {}; + opts.metrics_proxy_enabled = config.metrics_proxy_enabled; // Inject a convenience function for dialing through the metrics proxy. opts.fetch = (path, params) => this.client.fetchWithToken(`/v1/internal/ui/metrics-proxy${path}`, params); // Inject the base app URL - const provider = uiCfg.metrics_provider || 'prometheus'; + const provider = config.metrics_provider || 'prometheus'; try { this.provider = window.consul.getMetricsProvider(provider, opts); diff --git a/ui/packages/consul-ui/app/templates/dc/nodes/show.hbs b/ui/packages/consul-ui/app/templates/dc/nodes/show.hbs index 80f48562c..341776c1c 100644 --- a/ui/packages/consul-ui/app/templates/dc/nodes/show.hbs +++ b/ui/packages/consul-ui/app/templates/dc/nodes/show.hbs @@ -1,17 +1,17 @@ {{page-title item.Node}} - + + - - + - {{#if (eq api.error.status "404")}} + {{#if (eq loader.error.status "404")}}

Services {{format-number items.length}} total diff --git a/ui/packages/consul-ui/app/templates/dc/services/instance.hbs b/ui/packages/consul-ui/app/templates/dc/services/instance.hbs index bddb96272..ebaf39e23 100644 --- a/ui/packages/consul-ui/app/templates/dc/services/instance.hbs +++ b/ui/packages/consul-ui/app/templates/dc/services/instance.hbs @@ -1,64 +1,90 @@ {{page-title item.Service.ID}} - - - - - - + + + + + {{#if (not loader.error)}} + + + {{/if}} - -
    -
  1. All Services
  2. -
  3. Service ({{item.Service.Service}})
  4. -
+ + + - -

- {{ item.Service.ID }} -

- - + + + {{#if (eq loader.error.status "404")}} + + + + {{else}} + + + + {{/if}} - -
-
Service Name
-
{{item.Service.Service}}
-
-
-
Node Name
-
{{item.Node.Node}}
-
+ + + + +
    +
  1. All Services
  2. +
  3. Service ({{item.Service.Service}})
  4. +
+
+ +

+ {{ item.Service.ID }} +

+ + +
+ +
+
Service Name
+
{{item.Service.Service}}
+
+
+
Node Name
+
{{item.Node.Node}}
+
+
+ + {{#let (or item.Service.Address item.Node.Address) as |address|}} + {{address}} + {{/let}} + + + + + {{outlet}} + + +
- - {{#let (or item.Service.Address item.Node.Address) as |address|}} - {{address}} - {{/let}} - - - - - {{outlet}} - - -
\ No newline at end of file + \ No newline at end of file diff --git a/ui/packages/consul-ui/app/templates/dc/services/show.hbs b/ui/packages/consul-ui/app/templates/dc/services/show.hbs index e10f68be7..e04eb9bdf 100644 --- a/ui/packages/consul-ui/app/templates/dc/services/show.hbs +++ b/ui/packages/consul-ui/app/templates/dc/services/show.hbs @@ -1,73 +1,100 @@ - - {{#let items.firstObject as |item|}} - {{page-title item.Service.Service}} - - - - - -
    -
  1. All Services
  2. -
-
- -

- {{item.Service.Service}} -

- - -
- - {{#if (not-eq item.Service.Kind 'mesh-gateway')}} - - {{/if}} - - - {{#if urls.service}} - - Open Dashboard - +{{page-title item.Service.Service}} + + + + + {{#if (not loader.error)}} + + {{/if}} - - - {{outlet}} - + + + -
+ + + {{#if (eq loader.error.status "404")}} + + + + {{else}} + + + + {{/if}} + + + + + +
    +
  1. All Services
  2. +
+
+ +

+ {{item.Service.Service}} +

+ + +
+ + {{#if (not-eq item.Service.Kind 'mesh-gateway')}} + + {{/if}} + + + {{#if urls.service}} + + Open Dashboard + + {{/if}} + + + + {{outlet}} + + +
+
+ {{/let}} \ No newline at end of file diff --git a/ui/packages/consul-ui/app/templates/dc/services/show/topology.hbs b/ui/packages/consul-ui/app/templates/dc/services/show/topology.hbs index 5998ffade..d53af4e16 100644 --- a/ui/packages/consul-ui/app/templates/dc/services/show/topology.hbs +++ b/ui/packages/consul-ui/app/templates/dc/services/show/topology.hbs @@ -32,7 +32,7 @@ Datacenter=dc.Name Service=items.firstObject )}} - @isRemoteDC={{isRemoteDC}} + @isRemoteDC={{not dc.Local}} @hasMetricsProvider={{hasMetricsProvider}} @oncreate={{route-action 'createIntention'}} /> diff --git a/ui/packages/consul-ui/app/utils/get-environment.js b/ui/packages/consul-ui/app/utils/get-environment.js index aa4f80f7f..c0ff2326c 100644 --- a/ui/packages/consul-ui/app/utils/get-environment.js +++ b/ui/packages/consul-ui/app/utils/get-environment.js @@ -23,7 +23,10 @@ export default function(config = {}, win = window, doc = document) { return str .split(';') .filter(item => item !== '') - .map(item => item.trim().split('=')); + .map(item => { + const [key, ...rest] = item.trim().split('='); + return [key, rest.join('=')]; + }); }; const user = function(str) { const item = win.localStorage.getItem(str); diff --git a/ui/packages/consul-ui/tests/unit/controllers/dc/services/instance-test.js b/ui/packages/consul-ui/tests/unit/controllers/dc/services/instance-test.js deleted file mode 100644 index de807d323..000000000 --- a/ui/packages/consul-ui/tests/unit/controllers/dc/services/instance-test.js +++ /dev/null @@ -1,12 +0,0 @@ -import { module, test } from 'qunit'; -import { setupTest } from 'ember-qunit'; - -module('Unit | Controller | dc/services/instance', function(hooks) { - setupTest(hooks); - - // Replace this with your real tests. - test('it exists', function(assert) { - let controller = this.owner.lookup('controller:dc/services/instance'); - assert.ok(controller); - }); -}); diff --git a/ui/packages/consul-ui/tests/unit/controllers/dc/services/show-test.js b/ui/packages/consul-ui/tests/unit/controllers/dc/services/show-test.js deleted file mode 100644 index 18d7eb3d1..000000000 --- a/ui/packages/consul-ui/tests/unit/controllers/dc/services/show-test.js +++ /dev/null @@ -1,12 +0,0 @@ -import { module, test } from 'qunit'; -import { setupTest } from 'ember-qunit'; - -module('Unit | Controller | dc/services/show', function(hooks) { - setupTest(hooks); - - // Replace this with your real tests. - test('it exists', function(assert) { - let controller = this.owner.lookup('controller:dc/services/show'); - assert.ok(controller); - }); -});