2020-10-05 13:48:26 +00:00
|
|
|
import { inject as service } from '@ember/service';
|
2020-11-09 09:25:35 +00:00
|
|
|
import Route from 'consul-ui/routing/route';
|
2020-10-05 13:48:26 +00:00
|
|
|
import { hash } from 'rsvp';
|
2020-05-12 21:34:47 +00:00
|
|
|
|
2020-11-09 09:25:35 +00:00
|
|
|
export default class ServicesRoute extends Route {
|
|
|
|
@service('data-source/service')
|
|
|
|
data;
|
|
|
|
|
|
|
|
model() {
|
2020-10-05 13:48:26 +00:00
|
|
|
const dc = this.modelFor('dc').dc.Name;
|
|
|
|
const nspace = this.modelFor('nspace').nspace.substr(1);
|
2020-05-12 21:34:47 +00:00
|
|
|
const parent = this.routeName
|
|
|
|
.split('.')
|
|
|
|
.slice(0, -1)
|
|
|
|
.join('.');
|
2020-10-19 14:20:27 +00:00
|
|
|
const name = this.modelFor(parent).slug;
|
2020-10-05 13:48:26 +00:00
|
|
|
return hash({
|
|
|
|
dc: dc,
|
|
|
|
nspace: nspace,
|
|
|
|
gatewayServices: this.data.source(uri => uri`/${nspace}/${dc}/gateways/for-service/${name}`),
|
|
|
|
});
|
2020-11-09 09:25:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
setupController(controller, model) {
|
|
|
|
super.setupController(...arguments);
|
2020-05-12 21:34:47 +00:00
|
|
|
controller.setProperties(model);
|
2020-11-09 09:25:35 +00:00
|
|
|
}
|
|
|
|
}
|