89136cbf6a
Manual interventions: • decorators on the same line for service and controller injections and most computed property macros • preserving import order when possible, both per-line and intra-line • moving new imports to the bottom • removal of classic decorator for trivial cases • conversion of init to constructor when appropriate
28 lines
833 B
JavaScript
28 lines
833 B
JavaScript
import AllocationRow from 'nomad-ui/components/allocation-row';
|
|
import classic from 'ember-classic-decorator';
|
|
|
|
@classic
|
|
export default class PluginAllocationRow extends AllocationRow {
|
|
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();
|
|
}
|
|
}
|
|
}
|
|
}
|