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