mirror of
https://github.com/kemko/nomad.git
synced 2026-01-04 17:35:43 +03:00
Watch nodes and allocs on the nodes list page
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import ApplicationAdapter from './application';
|
||||
import Watchable from './watchable';
|
||||
|
||||
export default ApplicationAdapter.extend({
|
||||
export default Watchable.extend({
|
||||
findAllocations(node) {
|
||||
const url = `${this.buildURL('node', node.get('id'), node, 'findRecord')}/allocations`;
|
||||
return this.ajax(url, 'GET').then(allocs => {
|
||||
|
||||
@@ -1,7 +1,11 @@
|
||||
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';
|
||||
|
||||
export default Component.extend({
|
||||
store: service(),
|
||||
|
||||
tagName: 'tr',
|
||||
classNames: ['client-node-row', 'is-interactive'],
|
||||
|
||||
@@ -17,7 +21,16 @@ export default Component.extend({
|
||||
// Reload the node in order to get detail information
|
||||
const node = this.get('node');
|
||||
if (node) {
|
||||
node.reload();
|
||||
node.reload().then(() => {
|
||||
this.get('watch').perform(node, 100);
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
willDestroy() {
|
||||
this.get('watch').cancelAll();
|
||||
this._super(...arguments);
|
||||
},
|
||||
|
||||
watch: watchRelationship('allocations'),
|
||||
});
|
||||
|
||||
@@ -3,6 +3,7 @@ import Route from '@ember/routing/route';
|
||||
import RSVP from 'rsvp';
|
||||
import WithForbiddenState from 'nomad-ui/mixins/with-forbidden-state';
|
||||
import notifyForbidden from 'nomad-ui/utils/notify-forbidden';
|
||||
import { watchAll } from 'nomad-ui/utils/properties/watch';
|
||||
|
||||
export default Route.extend(WithForbiddenState, {
|
||||
store: service(),
|
||||
@@ -18,4 +19,16 @@ export default Route.extend(WithForbiddenState, {
|
||||
agents: this.get('store').findAll('agent'),
|
||||
}).catch(notifyForbidden(this));
|
||||
},
|
||||
|
||||
setupController(controller) {
|
||||
controller.set('modelWatch', this.get('watch').perform());
|
||||
return this._super(...arguments);
|
||||
},
|
||||
|
||||
deactivate() {
|
||||
this.get('watch').cancelAll();
|
||||
this._super(...arguments);
|
||||
},
|
||||
|
||||
watch: watchAll('node'),
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user