github.com/hernad/nomad@v1.6.112/ui/app/components/das/recommendation-row.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 ResourcesDiffs from 'nomad-ui/utils/resources-diffs';
     8  import { action } from '@ember/object';
     9  import { tracked } from '@glimmer/tracking';
    10  
    11  export default class DasRecommendationRow extends Component {
    12    @tracked cpu;
    13    @tracked memory;
    14  
    15    @action
    16    storeDiffs() {
    17      // Prevent resource toggling from affecting the summary diffs
    18  
    19      const diffs = new ResourcesDiffs(
    20        this.args.summary.taskGroup,
    21        1,
    22        this.args.summary.recommendations,
    23        this.args.summary.excludedRecommendations
    24      );
    25  
    26      const aggregateDiffs = new ResourcesDiffs(
    27        this.args.summary.taskGroup,
    28        this.args.summary.taskGroup.count,
    29        this.args.summary.recommendations,
    30        this.args.summary.excludedRecommendations
    31      );
    32  
    33      this.cpu = {
    34        delta: diffs.cpu.delta,
    35        signedDiff: diffs.cpu.signedDiff,
    36        percentDiff: diffs.cpu.percentDiff,
    37        signedAggregateDiff: aggregateDiffs.cpu.signedDiff,
    38      };
    39  
    40      this.memory = {
    41        delta: diffs.memory.delta,
    42        signedDiff: diffs.memory.signedDiff,
    43        percentDiff: diffs.memory.percentDiff,
    44        signedAggregateDiff: aggregateDiffs.memory.signedDiff,
    45      };
    46    }
    47  }