github.com/Ilhicas/nomad@v1.0.4-0.20210304152020-e86851182bc3/ui/app/routes/clients/client/index.js (about)

     1  import { inject as service } from '@ember/service';
     2  import Route from '@ember/routing/route';
     3  import { collect } from '@ember/object/computed';
     4  import { watchRecord, watchRelationship } from 'nomad-ui/utils/properties/watch';
     5  import WithWatchers from 'nomad-ui/mixins/with-watchers';
     6  
     7  export default class ClientRoute extends Route.extend(WithWatchers) {
     8    @service store;
     9  
    10    setupController(controller, model) {
    11      controller.set('flagAsDraining', model && model.isDraining);
    12  
    13      return super.setupController(...arguments);
    14    }
    15  
    16    resetController(controller) {
    17      controller.setProperties({
    18        eligibilityError: null,
    19        stopDrainError: null,
    20        drainError: null,
    21        flagAsDraining: false,
    22        showDrainNotification: false,
    23        showDrainUpdateNotification: false,
    24        showDrainStoppedNotification: false,
    25      });
    26    }
    27  
    28    startWatchers(controller, model) {
    29      if (model) {
    30        controller.set('watchModel', this.watch.perform(model));
    31        controller.set('watchAllocations', this.watchAllocations.perform(model));
    32      }
    33    }
    34  
    35    @watchRecord('node') watch;
    36    @watchRelationship('allocations') watchAllocations;
    37  
    38    @collect('watch', 'watchAllocations') watchers;
    39  }