github.com/anth0d/nomad@v0.0.0-20221214183521-ae3a0a2cad06/ui/app/components/service-status-bar.js (about)

     1  import { computed } from '@ember/object';
     2  import DistributionBar from './distribution-bar';
     3  import { attributeBindings } from '@ember-decorators/component';
     4  import classic from 'ember-classic-decorator';
     5  
     6  @classic
     7  @attributeBindings('data-test-service-status-bar')
     8  export default class ServiceStatusBar extends DistributionBar {
     9    layoutName = 'components/distribution-bar';
    10  
    11    status = null;
    12  
    13    'data-test-service-status-bar' = true;
    14  
    15    @computed('status.{failure,pending,success}')
    16    get data() {
    17      if (!this.status) {
    18        return [];
    19      }
    20  
    21      const pending = this.status.pending || 0;
    22      const failing = this.status.failure || 0;
    23      const success = this.status.success || 0;
    24  
    25      const [grey, red, green] = ['queued', 'failed', 'running'];
    26  
    27      return [
    28        {
    29          label: 'Pending',
    30          value: pending,
    31          className: grey,
    32        },
    33        {
    34          label: 'Failing',
    35          value: failing,
    36          className: red,
    37        },
    38        {
    39          label: 'Success',
    40          value: success,
    41          className: green,
    42        },
    43      ];
    44    }
    45  }