github.com/Ilhicas/nomad@v1.0.4-0.20210304152020-e86851182bc3/ui/app/components/allocation-status-bar.js (about)

     1  import { computed } from '@ember/object';
     2  import DistributionBar from './distribution-bar';
     3  
     4  export default class AllocationStatusBar extends DistributionBar {
     5    layoutName = 'components/distribution-bar';
     6  
     7    allocationContainer = null;
     8  
     9    'data-test-allocation-status-bar' = true;
    10  
    11    @computed(
    12      'allocationContainer.{queuedAllocs,completeAllocs,failedAllocs,runningAllocs,startingAllocs}'
    13    )
    14    get data() {
    15      if (!this.allocationContainer) {
    16        return [];
    17      }
    18  
    19      const allocs = this.allocationContainer.getProperties(
    20        'queuedAllocs',
    21        'completeAllocs',
    22        'failedAllocs',
    23        'runningAllocs',
    24        'startingAllocs',
    25        'lostAllocs'
    26      );
    27      return [
    28        { label: 'Queued', value: allocs.queuedAllocs, className: 'queued' },
    29        {
    30          label: 'Starting',
    31          value: allocs.startingAllocs,
    32          className: 'starting',
    33          layers: 2,
    34        },
    35        { label: 'Running', value: allocs.runningAllocs, className: 'running' },
    36        {
    37          label: 'Complete',
    38          value: allocs.completeAllocs,
    39          className: 'complete',
    40        },
    41        { label: 'Failed', value: allocs.failedAllocs, className: 'failed' },
    42        { label: 'Lost', value: allocs.lostAllocs, className: 'lost' },
    43      ];
    44    }
    45  }