github.com/Ilhicas/nomad@v1.0.4-0.20210304152020-e86851182bc3/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  
     7  export default class DeploymentsRoute extends Route.extend(WithWatchers) {
     8    model() {
     9      const job = this.modelFor('jobs.job');
    10      return job && RSVP.all([job.get('deployments'), job.get('versions')]).then(() => job);
    11    }
    12  
    13    startWatchers(controller, model) {
    14      if (model) {
    15        controller.set('watchDeployments', this.watchDeployments.perform(model));
    16        controller.set('watchVersions', this.watchVersions.perform(model));
    17      }
    18    }
    19  
    20    @watchRelationship('deployments') watchDeployments;
    21    @watchRelationship('versions') watchVersions;
    22  
    23    @collect('watchDeployments', 'watchVersions') watchers;
    24  }