diff --git a/ui/app/components/client-node-row.js b/ui/app/components/client-node-row.js index 32e551fba17..aca4d7a3be1 100644 --- a/ui/app/components/client-node-row.js +++ b/ui/app/components/client-node-row.js @@ -6,7 +6,6 @@ import { inject as service } from '@ember/service'; import Component from '@ember/component'; import { lazyClick } from '../helpers/lazy-click'; -import { watchRelationship } from 'nomad-ui/utils/properties/watch'; import WithVisibilityDetection from 'nomad-ui/mixins/with-component-visibility-detection'; import { computed } from '@ember/object'; import { classNames, tagName } from '@ember-decorators/component'; @@ -33,30 +32,10 @@ export default class ClientNodeRow extends Component.extend( // Reload the node in order to get detail information const node = this.node; if (node) { - node.reload().then(() => { - this.watch.perform(node, 100); - }); + node.reload(); } } - visibilityHandler() { - if (document.hidden) { - this.watch.cancelAll(); - } else { - const node = this.node; - if (node) { - this.watch.perform(node, 100); - } - } - } - - willDestroy() { - this.watch.cancelAll(); - super.willDestroy(...arguments); - } - - @watchRelationship('allocations') watch; - @computed('node.status') get nodeStatusColor() { let status = this.get('node.status'); diff --git a/ui/app/routes/clients/client/index.js b/ui/app/routes/clients/client/index.js index 7527b69a25d..05f0ae5feca 100644 --- a/ui/app/routes/clients/client/index.js +++ b/ui/app/routes/clients/client/index.js @@ -21,7 +21,12 @@ export default class ClientRoute extends Route.extend(WithWatchers) { return super.setupController(...arguments); } - resetController(controller) { + resetController(controller, isExiting) { + if (isExiting) { + controller.set('watchModel', null); + controller.set('watchAllocations', null); + } + controller.setProperties({ eligibilityError: null, stopDrainError: null, @@ -34,10 +39,12 @@ export default class ClientRoute extends Route.extend(WithWatchers) { } startWatchers(controller, model) { - if (model) { - controller.set('watchModel', this.watch.perform(model)); - controller.set('watchAllocations', this.watchAllocations.perform(model)); + if (!model) { + return; } + + controller.set('watchModel', this.watch.perform(model)); + controller.set('watchAllocations', this.watchAllocations.perform(model)); } @watchRecord('node') watch; diff --git a/ui/app/routes/clients/index.js b/ui/app/routes/clients/index.js index b9678f080fa..dec1750ec9c 100644 --- a/ui/app/routes/clients/index.js +++ b/ui/app/routes/clients/index.js @@ -12,6 +12,11 @@ import { inject as service } from '@ember/service'; export default class IndexRoute extends Route.extend(WithWatchers) { @service store; + deactivate() { + this.cancelAllWatchers(); + super.deactivate(...arguments); + } + startWatchers(controller) { controller.set('watcher', this.watch.perform()); }