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