Files
nomad/ui/app/components/plugin-allocation-row.js
2020-05-12 21:30:33 -07:00

26 lines
752 B
JavaScript

import AllocationRow from 'nomad-ui/components/allocation-row';
export default AllocationRow.extend({
pluginAllocation: null,
allocation: null,
didReceiveAttrs() {
// Allocation is always set through pluginAllocation
this.set('allocation', null);
this.setAllocation();
},
// 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();
}
}
},
});