github.com/hernad/nomad@v1.6.112/ui/app/routes/clients/client/index.js (about) 1 /** 2 * Copyright (c) HashiCorp, Inc. 3 * SPDX-License-Identifier: MPL-2.0 4 */ 5 6 import { inject as service } from '@ember/service'; 7 import Route from '@ember/routing/route'; 8 import { collect } from '@ember/object/computed'; 9 import { 10 watchRecord, 11 watchRelationship, 12 } from 'nomad-ui/utils/properties/watch'; 13 import WithWatchers from 'nomad-ui/mixins/with-watchers'; 14 15 export default class ClientRoute extends Route.extend(WithWatchers) { 16 @service store; 17 18 setupController(controller, model) { 19 controller.set('flagAsDraining', model && model.isDraining); 20 21 return super.setupController(...arguments); 22 } 23 24 resetController(controller) { 25 controller.setProperties({ 26 eligibilityError: null, 27 stopDrainError: null, 28 drainError: null, 29 flagAsDraining: false, 30 showDrainNotification: false, 31 showDrainUpdateNotification: false, 32 showDrainStoppedNotification: false, 33 }); 34 } 35 36 startWatchers(controller, model) { 37 if (model) { 38 controller.set('watchModel', this.watch.perform(model)); 39 controller.set('watchAllocations', this.watchAllocations.perform(model)); 40 } 41 } 42 43 @watchRecord('node') watch; 44 @watchRelationship('allocations') watchAllocations; 45 46 @collect('watch', 'watchAllocations') watchers; 47 }