github.com/anth0d/nomad@v0.0.0-20221214183521-ae3a0a2cad06/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 {
     5    watchRecord,
     6    watchRelationship,
     7  } from 'nomad-ui/utils/properties/watch';
     8  import WithWatchers from 'nomad-ui/mixins/with-watchers';
     9  
    10  export default class ClientRoute extends Route.extend(WithWatchers) {
    11    @service store;
    12  
    13    setupController(controller, model) {
    14      controller.set('flagAsDraining', model && model.isDraining);
    15  
    16      return super.setupController(...arguments);
    17    }
    18  
    19    resetController(controller) {
    20      controller.setProperties({
    21        eligibilityError: null,
    22        stopDrainError: null,
    23        drainError: null,
    24        flagAsDraining: false,
    25        showDrainNotification: false,
    26        showDrainUpdateNotification: false,
    27        showDrainStoppedNotification: false,
    28      });
    29    }
    30  
    31    startWatchers(controller, model) {
    32      if (model) {
    33        controller.set('watchModel', this.watch.perform(model));
    34        controller.set('watchAllocations', this.watchAllocations.perform(model));
    35      }
    36    }
    37  
    38    @watchRecord('node') watch;
    39    @watchRelationship('allocations') watchAllocations;
    40  
    41    @collect('watch', 'watchAllocations') watchers;
    42  }