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-05-12 21:34:47 +00:00
|
|
|
|
2020-11-09 09:25:35 +00:00
|
|
|
export default class ServicesRoute extends Route {
|
2020-12-01 15:45:09 +00:00
|
|
|
@service('data-source/service') data;
|
|
|
|
|
|
|
|
queryParams = {
|
|
|
|
sortBy: 'sort',
|
|
|
|
instance: 'instance',
|
|
|
|
searchproperty: {
|
|
|
|
as: 'searchproperty',
|
|
|
|
empty: [['Name', 'Tags']],
|
|
|
|
},
|
|
|
|
search: {
|
|
|
|
as: 'filter',
|
|
|
|
replace: true,
|
|
|
|
},
|
|
|
|
};
|
2020-11-09 09:25:35 +00:00
|
|
|
|
2020-12-02 15:42:18 +00:00
|
|
|
async model(params, transition) {
|
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-12-02 15:42:18 +00:00
|
|
|
const gatewayServices = await this.data.source(
|
|
|
|
uri => uri`/${nspace}/${dc}/gateways/for-service/${name}`
|
|
|
|
);
|
|
|
|
return {
|
|
|
|
dc,
|
|
|
|
nspace,
|
|
|
|
gatewayServices,
|
|
|
|
};
|
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
|
|
|
}
|
|
|
|
}
|