diff --git a/ui-v2/app/routes/dc/services/show.js b/ui-v2/app/routes/dc/services/show.js index 1240812b99..7e5571b1d9 100644 --- a/ui-v2/app/routes/dc/services/show.js +++ b/ui-v2/app/routes/dc/services/show.js @@ -6,7 +6,7 @@ import { get } from '@ember/object'; export default Route.extend({ data: service('data-source/service'), settings: service('settings'), - model: function(params, transition = {}) { + model: function(params, transition) { const dc = this.modelFor('dc').dc.Name; const nspace = this.modelFor('nspace').nspace.substr(1); return hash({ @@ -19,32 +19,19 @@ export default Route.extend({ urls: this.settings.findBySlug('urls'), chain: null, proxies: [], - }) - .then(model => { - return ['connect-proxy', 'mesh-gateway', 'ingress-gateway', 'terminating-gateway'].includes( - get(model, 'items.firstObject.Service.Kind') - ) - ? model - : hash({ - ...model, - chain: this.data.source(uri => uri`/${nspace}/${dc}/discovery-chain/${params.name}`), - proxies: this.data.source( - uri => uri`/${nspace}/${dc}/proxies/for-service/${params.name}` - ), - }); - }) - .then(model => { - return ['ingress-gateway', 'terminating-gateway'].includes( - get(model, 'items.firstObject.Service.Kind') - ) - ? hash({ - ...model, - gatewayServices: this.data.source( - uri => uri`/${nspace}/${dc}/gateways/for-service/${params.name}` - ), - }) - : model; - }); + }).then(model => { + return ['connect-proxy', 'mesh-gateway', 'ingress-gateway', 'terminating-gateway'].includes( + get(model, 'items.firstObject.Service.Kind') + ) + ? model + : hash({ + ...model, + chain: this.data.source(uri => uri`/${nspace}/${dc}/discovery-chain/${params.name}`), + proxies: this.data.source( + uri => uri`/${nspace}/${dc}/proxies/for-service/${params.name}` + ), + }); + }); }, setupController: function(controller, model) { this._super(...arguments); diff --git a/ui-v2/app/routes/dc/services/show/services.js b/ui-v2/app/routes/dc/services/show/services.js index 87d8c26652..fb4d8b6b5f 100644 --- a/ui-v2/app/routes/dc/services/show/services.js +++ b/ui-v2/app/routes/dc/services/show/services.js @@ -1,12 +1,22 @@ import Route from 'consul-ui/routing/route'; +import { inject as service } from '@ember/service'; +import { hash } from 'rsvp'; export default Route.extend({ + data: service('data-source/service'), model: function() { + const dc = this.modelFor('dc').dc.Name; + const nspace = this.modelFor('nspace').nspace.substr(1); const parent = this.routeName .split('.') .slice(0, -1) .join('.'); - return this.modelFor(parent); + const name = this.modelFor(parent).name; + return hash({ + dc: dc, + nspace: nspace, + gatewayServices: this.data.source(uri => uri`/${nspace}/${dc}/gateways/for-service/${name}`), + }); }, setupController: function(controller, model) { this._super(...arguments); diff --git a/ui-v2/app/routes/dc/services/show/upstreams.js b/ui-v2/app/routes/dc/services/show/upstreams.js index 87d8c26652..6125e6d10d 100644 --- a/ui-v2/app/routes/dc/services/show/upstreams.js +++ b/ui-v2/app/routes/dc/services/show/upstreams.js @@ -1,15 +1,5 @@ -import Route from 'consul-ui/routing/route'; +import Route from './services'; export default Route.extend({ - model: function() { - const parent = this.routeName - .split('.') - .slice(0, -1) - .join('.'); - return this.modelFor(parent); - }, - setupController: function(controller, model) { - this._super(...arguments); - controller.setProperties(model); - }, + templateName: 'dc/services/show/upstreams', }); diff --git a/ui-v2/app/templates/dc/services/show.hbs b/ui-v2/app/templates/dc/services/show.hbs index 75e86ecaeb..e2e5c50fe6 100644 --- a/ui-v2/app/templates/dc/services/show.hbs +++ b/ui-v2/app/templates/dc/services/show.hbs @@ -2,7 +2,6 @@ - {{title item.Service.Service}} diff --git a/ui-v2/app/templates/dc/services/show/services.hbs b/ui-v2/app/templates/dc/services/show/services.hbs index 857f21efd2..7d1164fe60 100644 --- a/ui-v2/app/templates/dc/services/show/services.hbs +++ b/ui-v2/app/templates/dc/services/show/services.hbs @@ -1,4 +1,5 @@ -
+ +
{{#let (hash instances=(if instance (split instance ',') undefined) diff --git a/ui-v2/app/templates/dc/services/show/upstreams.hbs b/ui-v2/app/templates/dc/services/show/upstreams.hbs index 7a09b008d9..5590ffe718 100644 --- a/ui-v2/app/templates/dc/services/show/upstreams.hbs +++ b/ui-v2/app/templates/dc/services/show/upstreams.hbs @@ -1,4 +1,5 @@ -
+ +
{{#let (hash instances=(if instance (split instance ',') undefined)