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

23 lines
806 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 Route.extend(WithWatchers, {
2017-09-19 14:47:10 +00:00
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
startWatchers(controller, model) {
2018-02-28 02:59:05 +00:00
controller.set('watchDeployments', this.get('watchDeployments').perform(model));
controller.set('watchVersions', this.get('watchVersions').perform(model));
},
watchDeployments: watchRelationship('deployments'),
watchVersions: watchRelationship('versions'),
watchers: collect('watchDeployments', 'watchVersions'),
2017-09-19 14:47:10 +00:00
});