github.com/hernad/nomad@v1.6.112/ui/app/components/das/diffs-table.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 9 export default class DasResourceTotalsComponent extends Component { 10 get diffs() { 11 return new ResourcesDiffs( 12 this.args.model, 13 1, 14 this.args.recommendations, 15 this.args.excludedRecommendations 16 ); 17 } 18 19 get cpuClass() { 20 return classForDelta(this.diffs.cpu.delta); 21 } 22 23 get memoryClass() { 24 return classForDelta(this.diffs.memory.delta); 25 } 26 } 27 28 function classForDelta(delta) { 29 if (delta > 0) { 30 return 'increase'; 31 } else if (delta < 0) { 32 return 'decrease'; 33 } 34 35 return ''; 36 }