|
|
@ -1,6 +1,5 @@
|
|
|
|
import { inject as service } from '@ember/service';
|
|
|
|
import { inject as service } from '@ember/service';
|
|
|
|
import Route from 'consul-ui/routing/route';
|
|
|
|
import Route from 'consul-ui/routing/route';
|
|
|
|
import { hash } from 'rsvp';
|
|
|
|
|
|
|
|
import { get } from '@ember/object';
|
|
|
|
import { get } from '@ember/object';
|
|
|
|
import { action, setProperties } from '@ember/object';
|
|
|
|
import { action, setProperties } from '@ember/object';
|
|
|
|
|
|
|
|
|
|
|
@ -24,54 +23,48 @@ export default class ShowRoute extends Route {
|
|
|
|
this.refresh();
|
|
|
|
this.refresh();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
model(params, transition) {
|
|
|
|
async model(params, transition) {
|
|
|
|
const dc = this.modelFor('dc').dc.Name;
|
|
|
|
const dc = this.modelFor('dc').dc.Name;
|
|
|
|
const nspace = this.modelFor('nspace').nspace.substr(1);
|
|
|
|
const nspace = this.modelFor('nspace').nspace.substr(1);
|
|
|
|
return hash({
|
|
|
|
const slug = params.name;
|
|
|
|
slug: params.name,
|
|
|
|
|
|
|
|
dc: dc,
|
|
|
|
let chain = null;
|
|
|
|
nspace: nspace,
|
|
|
|
let topology = null;
|
|
|
|
items: this.data.source(
|
|
|
|
let proxies = [];
|
|
|
|
uri => uri`/${nspace}/${dc}/service-instances/for-service/${params.name}`
|
|
|
|
|
|
|
|
),
|
|
|
|
const urls = this.config.get().dashboard_url_templates;
|
|
|
|
urls: this.config.get().dashboard_url_templates,
|
|
|
|
const items = await this.data.source(
|
|
|
|
chain: null,
|
|
|
|
uri => uri`/${nspace}/${dc}/service-instances/for-service/${params.name}`
|
|
|
|
proxies: [],
|
|
|
|
);
|
|
|
|
topology: null,
|
|
|
|
|
|
|
|
})
|
|
|
|
const item = get(items, 'firstObject');
|
|
|
|
.then(model => {
|
|
|
|
if (get(item, 'IsOrigin')) {
|
|
|
|
return ['connect-proxy', 'mesh-gateway', 'ingress-gateway', 'terminating-gateway'].includes(
|
|
|
|
chain = await this.data.source(uri => uri`/${nspace}/${dc}/discovery-chain/${params.name}`);
|
|
|
|
get(model, 'items.firstObject.Service.Kind')
|
|
|
|
proxies = await this.data.source(
|
|
|
|
)
|
|
|
|
uri => uri`/${nspace}/${dc}/proxies/for-service/${params.name}`
|
|
|
|
? model
|
|
|
|
);
|
|
|
|
: hash({
|
|
|
|
|
|
|
|
...model,
|
|
|
|
if (get(item, 'IsMeshOrigin')) {
|
|
|
|
chain: this.data.source(uri => uri`/${nspace}/${dc}/discovery-chain/${params.name}`),
|
|
|
|
let kind = get(item, 'Service.Kind');
|
|
|
|
// Whilst `proxies` isn't used anywhere in the show templates
|
|
|
|
|
|
|
|
// it provides a relationship of ProxyInstance on the ServiceInstance
|
|
|
|
|
|
|
|
// which can respond at a completely different blocking rate to
|
|
|
|
|
|
|
|
// the ServiceInstance itself
|
|
|
|
|
|
|
|
proxies: this.data.source(
|
|
|
|
|
|
|
|
uri => uri`/${nspace}/${dc}/proxies/for-service/${params.name}`
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
.then(model => {
|
|
|
|
|
|
|
|
let kind = get(model, 'items.firstObject.Service.Kind');
|
|
|
|
|
|
|
|
if (typeof kind === 'undefined') {
|
|
|
|
if (typeof kind === 'undefined') {
|
|
|
|
kind = '';
|
|
|
|
kind = '';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return ['mesh-gateway', 'terminating-gateway'].includes(
|
|
|
|
topology = await this.data.source(
|
|
|
|
get(model, 'items.firstObject.Service.Kind')
|
|
|
|
uri => uri`/${nspace}/${dc}/topology/${params.name}/${kind}`
|
|
|
|
)
|
|
|
|
);
|
|
|
|
? model
|
|
|
|
}
|
|
|
|
: hash({
|
|
|
|
}
|
|
|
|
...model,
|
|
|
|
|
|
|
|
topology: this.data.source(
|
|
|
|
return {
|
|
|
|
uri => uri`/${nspace}/${dc}/topology/${params.name}/${kind}`
|
|
|
|
dc,
|
|
|
|
),
|
|
|
|
nspace,
|
|
|
|
});
|
|
|
|
slug,
|
|
|
|
});
|
|
|
|
items,
|
|
|
|
|
|
|
|
urls,
|
|
|
|
|
|
|
|
chain,
|
|
|
|
|
|
|
|
proxies,
|
|
|
|
|
|
|
|
topology,
|
|
|
|
|
|
|
|
};
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
setupController(controller, model) {
|
|
|
|
setupController(controller, model) {
|
|
|
|