2021-03-17 14:40:56 +00:00
|
|
|
import { inject as service } from '@ember/service';
|
|
|
|
import SingleRoute from 'consul-ui/routing/single';
|
|
|
|
import { hash } from 'rsvp';
|
|
|
|
|
|
|
|
export default class ShowRoute extends SingleRoute {
|
|
|
|
@service('repository/auth-method') repo;
|
2021-03-26 15:47:47 +00:00
|
|
|
@service('repository/binding-rule') bindingRuleRepo;
|
2021-03-17 14:40:56 +00:00
|
|
|
|
|
|
|
model(params) {
|
2021-03-26 15:47:47 +00:00
|
|
|
const dc = this.modelFor('dc').dc;
|
2021-05-26 16:43:46 +00:00
|
|
|
const nspace = this.optionalParams().nspace;
|
2021-03-26 15:47:47 +00:00
|
|
|
|
2021-03-17 14:40:56 +00:00
|
|
|
return super.model(...arguments).then(model => {
|
|
|
|
return hash({
|
|
|
|
...model,
|
|
|
|
...{
|
|
|
|
item: this.repo.findBySlug({
|
|
|
|
id: params.id,
|
2021-03-26 15:47:47 +00:00
|
|
|
dc: dc.Name,
|
|
|
|
ns: nspace,
|
|
|
|
}),
|
|
|
|
bindingRules: this.bindingRuleRepo.findAllByDatacenter({
|
|
|
|
ns: nspace,
|
|
|
|
dc: dc.Name,
|
|
|
|
authmethod: params.id,
|
2021-03-17 14:40:56 +00:00
|
|
|
}),
|
|
|
|
},
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
setupController(controller, model) {
|
|
|
|
super.setupController(...arguments);
|
|
|
|
controller.setProperties(model);
|
|
|
|
}
|
|
|
|
}
|