github.com/hernad/nomad@v1.6.112/ui/app/components/job-status/latest-deployment.js (about)

     1  /**
     2   * Copyright (c) HashiCorp, Inc.
     3   * SPDX-License-Identifier: MPL-2.0
     4   */
     5  
     6  import Component from '@glimmer/component';
     7  import { alias } from '@ember/object/computed';
     8  
     9  export default class JobStatusLatestDeploymentComponent extends Component {
    10    @alias('args.job.latestDeployment') deployment;
    11    @alias('deployment.status') status;
    12  
    13    get healthyAllocs() {
    14      return this.deployment
    15        .get('taskGroupSummaries')
    16        .mapBy('healthyAllocs')
    17        .reduce((sum, count) => sum + count, 0);
    18    }
    19    get desiredTotal() {
    20      return this.deployment
    21        .get('taskGroupSummaries')
    22        .mapBy('desiredTotal')
    23        .reduce((sum, count) => sum + count, 0);
    24    }
    25  
    26    get statusColor() {
    27      switch (this.status) {
    28        case 'successful':
    29          return 'success';
    30        case 'failed':
    31          return 'critical';
    32        default:
    33          return 'neutral';
    34      }
    35    }
    36  }