github.com/iqoqo/nomad@v0.11.3-0.20200911112621-d7021c74d101/ui/app/components/plugin-allocation-row.js (about)

     1  import AllocationRow from 'nomad-ui/components/allocation-row';
     2  
     3  export default AllocationRow.extend({
     4    pluginAllocation: null,
     5    allocation: null,
     6  
     7    didReceiveAttrs() {
     8      // Allocation is always set through pluginAllocation
     9      this.set('allocation', null);
    10      this.setAllocation();
    11    },
    12  
    13    // The allocation for the plugin's controller or storage plugin needs
    14    // to be imperatively fetched since these plugins are Fragments which
    15    // can't have relationships.
    16    async setAllocation() {
    17      if (this.pluginAllocation && !this.allocation) {
    18        const allocation = await this.pluginAllocation.getAllocation();
    19        if (!this.isDestroyed) {
    20          this.set('allocation', allocation);
    21          this.updateStatsTracker();
    22        }
    23      }
    24    },
    25  });