open-nomad/ui/app/components/allocation-row.js

37 lines
816 B
JavaScript
Raw Normal View History

2017-09-19 14:47:10 +00:00
import Ember from 'ember';
import { lazyClick } from '../helpers/lazy-click';
2017-09-19 14:47:10 +00:00
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]);
2017-09-19 14:47:10 +00:00
},
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();
}
},
2017-09-19 14:47:10 +00:00
});