Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 1 addition & 22 deletions ui/app/components/client-node-row.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -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');
Expand Down
15 changes: 11 additions & 4 deletions ui/app/routes/clients/client/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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;
Expand Down
5 changes: 5 additions & 0 deletions ui/app/routes/clients/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}
Expand Down
Loading