open-nomad/ui/app/routes/jobs/job/versions.js

24 lines
746 B
JavaScript
Raw Normal View History

import Route from '@ember/routing/route';
import { collect } from '@ember/object/computed';
import { watchRecord, watchRelationship } from 'nomad-ui/utils/properties/watch';
import WithWatchers from 'nomad-ui/mixins/with-watchers';
2017-09-19 14:47:10 +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');
return job && job.get('versions').then(() => job);
}
2018-02-27 22:57:57 +00:00
startWatchers(controller, model) {
if (model) {
controller.set('watcher', this.watch.perform(model));
controller.set('watchVersions', this.watchVersions.perform(model));
}
}
2018-02-27 22:57:57 +00:00
@watchRecord('job') watch;
@watchRelationship('versions') watchVersions;
@collect('watch', 'watchVersions') watchers;
}