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