mirror of
https://github.com/kemko/nomad.git
synced 2026-01-06 18:35:44 +03:00
Properly manage the lifecycle of allocations for storage nodes and controllers
This commit is contained in:
@@ -1,7 +1,23 @@
|
||||
import { alias } from '@ember/object/computed';
|
||||
import AllocationRow from 'nomad-ui/components/allocation-row';
|
||||
|
||||
export default AllocationRow.extend({
|
||||
pluginAllocation: null,
|
||||
allocation: alias('pluginAllocation.allocation'),
|
||||
allocation: null,
|
||||
|
||||
didReceiveAttrs() {
|
||||
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();
|
||||
}
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user