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

25 lines
853 B
JavaScript
Raw Normal View History

import Route from '@ember/routing/route';
import RSVP from 'rsvp';
import { collect } from '@ember/object/computed';
2018-02-28 02:59:05 +00:00
import { 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 DeploymentsRoute extends Route.extend(WithWatchers) {
2017-09-19 14:47:10 +00:00
model() {
const job = this.modelFor('jobs.job');
return job && RSVP.all([job.get('deployments'), job.get('versions')]).then(() => job);
}
2018-02-28 02:59:05 +00:00
startWatchers(controller, model) {
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-02-28 02:59:05 +00:00
@watchRelationship('deployments') watchDeployments;
@watchRelationship('versions') watchVersions;
@collect('watchDeployments', 'watchVersions') watchers;
}