github.com/anth0d/nomad@v0.0.0-20221214183521-ae3a0a2cad06/ui/app/routes/jobs/job/deployments.js (about) 1 import Route from '@ember/routing/route'; 2 import RSVP from 'rsvp'; 3 import { collect } from '@ember/object/computed'; 4 import { watchRelationship } from 'nomad-ui/utils/properties/watch'; 5 import WithWatchers from 'nomad-ui/mixins/with-watchers'; 6 import { inject as service } from '@ember/service'; 7 8 export default class DeploymentsRoute extends Route.extend(WithWatchers) { 9 @service store; 10 11 model() { 12 const job = this.modelFor('jobs.job'); 13 return ( 14 job && 15 RSVP.all([job.get('deployments'), job.get('versions')]).then(() => job) 16 ); 17 } 18 19 startWatchers(controller, model) { 20 if (model) { 21 controller.set('watchDeployments', this.watchDeployments.perform(model)); 22 controller.set('watchVersions', this.watchVersions.perform(model)); 23 } 24 } 25 26 @watchRelationship('deployments') watchDeployments; 27 @watchRelationship('versions') watchVersions; 28 29 @collect('watchDeployments', 'watchVersions') watchers; 30 }