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