2020-10-01 08:33:22 +00:00
|
|
|
import Route from 'consul-ui/routing/route';
|
2018-05-22 15:03:45 +00:00
|
|
|
import { inject as service } from '@ember/service';
|
|
|
|
import { hash } from 'rsvp';
|
|
|
|
|
2020-07-09 09:08:47 +00:00
|
|
|
export default Route.extend({
|
2018-10-26 16:36:15 +00:00
|
|
|
repo: service('repository/intention'),
|
2020-09-18 10:14:06 +00:00
|
|
|
model: function({ intention_id }, transition) {
|
2019-12-17 18:47:37 +00:00
|
|
|
const dc = this.modelFor('dc').dc.Name;
|
|
|
|
const nspace = '*';
|
2018-05-22 15:03:45 +00:00
|
|
|
return hash({
|
2020-07-09 09:08:47 +00:00
|
|
|
dc: dc,
|
|
|
|
nspace: nspace,
|
|
|
|
item:
|
2020-09-18 10:14:06 +00:00
|
|
|
typeof intention_id !== 'undefined'
|
|
|
|
? this.repo.findBySlug(intention_id, dc, nspace)
|
|
|
|
: this.repo.create({
|
|
|
|
Datacenter: dc,
|
|
|
|
}),
|
2018-05-22 15:03:45 +00:00
|
|
|
});
|
|
|
|
},
|
|
|
|
setupController: function(controller, model) {
|
2020-10-01 08:33:22 +00:00
|
|
|
this._super(...arguments);
|
2018-05-22 15:03:45 +00:00
|
|
|
controller.setProperties(model);
|
|
|
|
},
|
|
|
|
});
|