github.com/anth0d/nomad@v0.0.0-20221214183521-ae3a0a2cad06/ui/app/components/job-client-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-job-client-status-bar')
     8  export default class JobClientStatusBar extends DistributionBar {
     9    layoutName = 'components/distribution-bar';
    10  
    11    'data-test-job-client-status-bar' = true;
    12    job = null;
    13    jobClientStatus = null;
    14  
    15    @computed('job.namespace', 'jobClientStatus.byStatus')
    16    get data() {
    17      const {
    18        queued,
    19        starting,
    20        running,
    21        complete,
    22        degraded,
    23        failed,
    24        lost,
    25        notScheduled,
    26        unknown,
    27      } = this.jobClientStatus.byStatus;
    28  
    29      return [
    30        {
    31          label: 'Queued',
    32          value: queued.length,
    33          className: 'queued',
    34          legendLink: {
    35            queryParams: {
    36              status: JSON.stringify(['queued']),
    37              namespace: this.job.namespace.get('id'),
    38            },
    39          },
    40        },
    41        {
    42          label: 'Starting',
    43          value: starting.length,
    44          className: 'starting',
    45          legendLink: {
    46            queryParams: {
    47              status: JSON.stringify(['starting']),
    48              namespace: this.job.namespace.get('id'),
    49            },
    50          },
    51          layers: 2,
    52        },
    53        {
    54          label: 'Running',
    55          value: running.length,
    56          className: 'running',
    57          legendLink: {
    58            queryParams: {
    59              status: JSON.stringify(['running']),
    60              namespace: this.job.namespace.get('id'),
    61            },
    62          },
    63        },
    64        {
    65          label: 'Complete',
    66          value: complete.length,
    67          className: 'complete',
    68          legendLink: {
    69            queryParams: {
    70              status: JSON.stringify(['complete']),
    71              namespace: this.job.namespace.get('id'),
    72            },
    73          },
    74        },
    75        {
    76          label: 'Unknown',
    77          value: unknown.length,
    78          className: 'unknown',
    79          legendLink: {
    80            queryParams: {
    81              status: JSON.stringify(['unknown']),
    82              namespace: this.job.namespace.get('id'),
    83            },
    84          },
    85          help: 'Some allocations for this job were degraded or lost connectivity.',
    86        },
    87        {
    88          label: 'Degraded',
    89          value: degraded.length,
    90          className: 'degraded',
    91          legendLink: {
    92            queryParams: {
    93              status: JSON.stringify(['degraded']),
    94              namespace: this.job.namespace.get('id'),
    95            },
    96          },
    97          help: 'Some allocations for this job were not successfull or did not run.',
    98        },
    99        {
   100          label: 'Failed',
   101          value: failed.length,
   102          className: 'failed',
   103          legendLink: {
   104            queryParams: {
   105              status: JSON.stringify(['failed']),
   106              namespace: this.job.namespace.get('id'),
   107            },
   108          },
   109        },
   110        {
   111          label: 'Lost',
   112          value: lost.length,
   113          className: 'lost',
   114          legendLink: {
   115            queryParams: {
   116              status: JSON.stringify(['lost']),
   117              namespace: this.job.namespace.get('id'),
   118            },
   119          },
   120        },
   121        {
   122          label: 'Not Scheduled',
   123          value: notScheduled.length,
   124          className: 'not-scheduled',
   125          legendLink: {
   126            queryParams: {
   127              status: JSON.stringify(['notScheduled']),
   128              namespace: this.job.namespace.get('id'),
   129            },
   130          },
   131          help: 'No allocations for this job were scheduled into these clients.',
   132        },
   133      ];
   134    }
   135  }