2017-12-15 21:39:18 +00:00
|
|
|
import Route from '@ember/routing/route';
|
2018-03-01 00:27:15 +00:00
|
|
|
import { collect } from '@ember/object/computed';
|
2021-12-28 16:08:12 +00:00
|
|
|
import {
|
|
|
|
watchRecord,
|
|
|
|
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
|
|
|
|
2020-06-10 13:49:16 +00:00
|
|
|
export default class VersionsRoute extends Route.extend(WithWatchers) {
|
2017-09-19 14:47:10 +00:00
|
|
|
model() {
|
|
|
|
const job = this.modelFor('jobs.job');
|
2018-11-05 23:42:04 +00:00
|
|
|
return job && job.get('versions').then(() => job);
|
2020-06-10 13:49:16 +00:00
|
|
|
}
|
2018-02-27 22:57:57 +00:00
|
|
|
|
2018-03-06 22:27:01 +00:00
|
|
|
startWatchers(controller, model) {
|
2018-11-05 23:42:04 +00:00
|
|
|
if (model) {
|
2021-04-20 13:33:16 +00:00
|
|
|
controller.set('watcher', this.watch.perform(model));
|
|
|
|
controller.set('watchVersions', this.watchVersions.perform(model));
|
2018-11-05 23:42:04 +00:00
|
|
|
}
|
2020-06-10 13:49:16 +00:00
|
|
|
}
|
2018-02-27 22:57:57 +00:00
|
|
|
|
2021-04-20 13:33:16 +00:00
|
|
|
@watchRecord('job') watch;
|
2020-06-10 13:49:16 +00:00
|
|
|
@watchRelationship('versions') watchVersions;
|
2021-04-20 13:33:16 +00:00
|
|
|
|
|
|
|
@collect('watch', 'watchVersions') watchers;
|
2020-06-10 13:49:16 +00:00
|
|
|
}
|