github.com/manicqin/nomad@v0.9.5/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 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    watchDeployments: watchRelationship('deployments'),
    21    watchVersions: watchRelationship('versions'),
    22  
    23    watchers: collect('watchDeployments', 'watchVersions'),
    24  });