2020-05-04 19:25:49 +00:00
|
|
|
import AllocationRow from 'nomad-ui/components/allocation-row';
|
2020-06-10 13:49:16 +00:00
|
|
|
import classic from 'ember-classic-decorator';
|
2020-05-04 19:25:49 +00:00
|
|
|
|
2020-06-10 13:49:16 +00:00
|
|
|
@classic
|
|
|
|
export default class PluginAllocationRow extends AllocationRow {
|
|
|
|
pluginAllocation = null;
|
|
|
|
allocation = null;
|
2020-05-12 02:59:38 +00:00
|
|
|
|
|
|
|
didReceiveAttrs() {
|
2020-05-13 04:29:27 +00:00
|
|
|
// Allocation is always set through pluginAllocation
|
|
|
|
this.set('allocation', null);
|
2020-05-12 02:59:38 +00:00
|
|
|
this.setAllocation();
|
2020-06-10 13:49:16 +00:00
|
|
|
}
|
2020-05-12 02:59:38 +00:00
|
|
|
|
|
|
|
// The allocation for the plugin's controller or storage plugin needs
|
|
|
|
// to be imperatively fetched since these plugins are Fragments which
|
|
|
|
// can't have relationships.
|
|
|
|
async setAllocation() {
|
|
|
|
if (this.pluginAllocation && !this.allocation) {
|
|
|
|
const allocation = await this.pluginAllocation.getAllocation();
|
|
|
|
if (!this.isDestroyed) {
|
|
|
|
this.set('allocation', allocation);
|
|
|
|
this.updateStatsTracker();
|
|
|
|
}
|
|
|
|
}
|
2020-06-10 13:49:16 +00:00
|
|
|
}
|
|
|
|
}
|