github.com/Ilhicas/nomad@v1.0.4-0.20210304152020-e86851182bc3/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  
     4  @classic
     5  export default class PluginAllocationRow extends AllocationRow {
     6    pluginAllocation = null;
     7    allocation = null;
     8  
     9    didReceiveAttrs() {
    10      // Allocation is always set through pluginAllocation
    11      this.set('allocation', null);
    12      this.setAllocation();
    13    }
    14  
    15    // The allocation for the plugin's controller or storage plugin needs
    16    // to be imperatively fetched since these plugins are Fragments which
    17    // can't have relationships.
    18    async setAllocation() {
    19      if (this.pluginAllocation && !this.allocation) {
    20        const allocation = await this.pluginAllocation.getAllocation();
    21        if (!this.isDestroyed) {
    22          this.set('allocation', allocation);
    23          this.updateStatsTracker();
    24        }
    25      }
    26    }
    27  }