open-nomad/ui/app/components/allocation-row.js
Michael Lange 877cbe6fbc Add a loading state to job information on allocation row.
This information is already loaded when traversing to an alloc row from
a job, but not when traversing to an alloc row from a node.
2017-10-03 17:18:33 -07:00

37 lines
816 B
JavaScript

import Ember from 'ember';
import { lazyClick } from '../helpers/lazy-click';
const { Component } = Ember;
export default Component.extend({
tagName: 'tr',
classNames: ['allocation-row', 'is-interactive'],
allocation: null,
// Used to determine whether the row should mention the node or the job
context: null,
onClick() {},
click(event) {
lazyClick([this.get('onClick'), event]);
},
didReceiveAttrs() {
// If the job for this allocation is incomplete, reload it to get
// detailed information.
const allocation = this.get('allocation');
if (
allocation &&
allocation.get('job') &&
!allocation.get('job.isPending') &&
!allocation.get('taskGroup')
) {
const job = allocation.get('job.content');
job && job.reload();
}
},
});