Refactor allocation-row

This commit is contained in:
Michael Lange 2018-05-02 13:59:28 -07:00
parent 97db138ce8
commit 927caa441e

View file

@ -24,7 +24,8 @@ export default Component.extend({
stats: null,
statsError: false,
enablePolling: computed(() => !Ember.testing),
// enablePolling: computed(() => !Ember.testing),
enablePolling: false,
onClick() {},
@ -59,12 +60,11 @@ export default Component.extend({
const allocation = this.get('allocation');
if (allocation) {
this.get('fetchStats').perform(allocation);
run.scheduleOnce('afterRender', this, qualifyAllocation);
} else {
this.get('fetchStats').cancelAll();
this.set('stats', null);
}
run.scheduleOnce('afterRender', this, qualifyJob);
},
fetchStats: task(function*(allocation) {
@ -84,6 +84,14 @@ export default Component.extend({
}).drop(),
});
function qualifyAllocation() {
const allocation = this.get('allocation');
return allocation.reload().then(() => {
this.get('fetchStats').perform(allocation);
run.scheduleOnce('afterRender', this, qualifyJob);
});
}
function qualifyJob() {
const allocation = this.get('allocation');
if (allocation.get('originalJobId')) {