github.com/anth0d/nomad@v0.0.0-20221214183521-ae3a0a2cad06/ui/app/components/plugin-allocation-row.js (about) 1 import AllocationRow from 'nomad-ui/components/allocation-row'; 2 import classic from 'ember-classic-decorator'; 3 import { attributeBindings } from '@ember-decorators/component'; 4 5 @classic 6 @attributeBindings( 7 'data-test-controller-allocation', 8 'data-test-node-allocation' 9 ) 10 export default class PluginAllocationRow extends AllocationRow { 11 pluginAllocation = null; 12 allocation = null; 13 14 didReceiveAttrs() { 15 // Allocation is always set through pluginAllocation 16 this.set('allocation', null); 17 this.setAllocation(); 18 } 19 20 // The allocation for the plugin's controller or storage plugin needs 21 // to be imperatively fetched since these plugins are Fragments which 22 // can't have relationships. 23 async setAllocation() { 24 if (this.pluginAllocation && !this.allocation) { 25 const allocation = await this.pluginAllocation.getAllocation(); 26 if (!this.isDestroyed) { 27 this.set('allocation', allocation); 28 this.updateStatsTracker(); 29 } 30 } 31 } 32 }