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

26 lines
815 B
JavaScript
Raw Normal View History

import Route from '@ember/routing/route';
import RSVP from 'rsvp';
2018-02-28 02:59:05 +00:00
import { watchRelationship } from 'nomad-ui/utils/properties/watch';
2017-09-19 14:47:10 +00:00
export default Route.extend({
model() {
const job = this.modelFor('jobs.job');
return RSVP.all([job.get('deployments'), job.get('versions')]).then(() => job);
},
2018-02-28 02:59:05 +00:00
setupController(controller, model) {
controller.set('watchDeployments', this.get('watchDeployments').perform(model));
controller.set('watchVersions', this.get('watchVersions').perform(model));
return this._super(...arguments);
},
deactivate() {
this.get('watchDeployments').cancelAll();
this.get('watchVersions').cancelAll();
return this._super(...arguments);
},
watchDeployments: watchRelationship('deployments'),
watchVersions: watchRelationship('versions'),
2017-09-19 14:47:10 +00:00
});