2018-05-22 15:03:45 +00:00
|
|
|
import { inject as service } from '@ember/service';
|
2020-11-09 09:25:35 +00:00
|
|
|
import Route from 'consul-ui/routing/route';
|
2018-05-22 15:03:45 +00:00
|
|
|
import { hash } from 'rsvp';
|
|
|
|
|
2020-11-09 09:25:35 +00:00
|
|
|
export default class EditRoute extends Route {
|
|
|
|
@service('repository/intention')
|
|
|
|
repo;
|
|
|
|
|
|
|
|
model({ 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
|
|
|
});
|
2020-11-09 09:25:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
setupController(controller, model) {
|
|
|
|
super.setupController(...arguments);
|
2018-05-22 15:03:45 +00:00
|
|
|
controller.setProperties(model);
|
2020-11-09 09:25:35 +00:00
|
|
|
}
|
|
|
|
}
|