github.com/hernad/nomad@v1.6.112/ui/app/components/service-status-bar.js (about)

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