2017-12-15 21:39:18 +00:00
|
|
|
import Route from '@ember/routing/route';
|
|
|
|
import RSVP from 'rsvp';
|
2018-03-01 00:27:15 +00:00
|
|
|
import { collect } from '@ember/object/computed';
|
2018-02-28 02:59:05 +00:00
|
|
|
import { watchRelationship } from 'nomad-ui/utils/properties/watch';
|
2018-03-01 00:27:15 +00:00
|
|
|
import WithWatchers from 'nomad-ui/mixins/with-watchers';
|
2017-09-19 14:47:10 +00:00
|
|
|
|
2018-03-01 00:27:15 +00:00
|
|
|
export default Route.extend(WithWatchers, {
|
2017-09-19 14:47:10 +00:00
|
|
|
model() {
|
|
|
|
const job = this.modelFor('jobs.job');
|
2018-11-06 00:06:08 +00:00
|
|
|
return job && RSVP.all([job.get('deployments'), job.get('versions')]).then(() => job);
|
2017-09-19 14:47:10 +00:00
|
|
|
},
|
2018-02-28 02:59:05 +00:00
|
|
|
|
2018-03-06 22:27:01 +00:00
|
|
|
startWatchers(controller, model) {
|
2018-11-06 00:06:08 +00:00
|
|
|
if (model) {
|
2019-03-26 07:46:44 +00:00
|
|
|
controller.set('watchDeployments', this.watchDeployments.perform(model));
|
|
|
|
controller.set('watchVersions', this.watchVersions.perform(model));
|
2018-11-06 00:06:08 +00:00
|
|
|
}
|
2018-02-28 02:59:05 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
watchDeployments: watchRelationship('deployments'),
|
|
|
|
watchVersions: watchRelationship('versions'),
|
2018-03-01 00:27:15 +00:00
|
|
|
|
|
|
|
watchers: collect('watchDeployments', 'watchVersions'),
|
2017-09-19 14:47:10 +00:00
|
|
|
});
|