Use more explicit branching of reserved amounts based on metric type

This commit is contained in:
Michael Lange 2021-03-24 13:55:18 -07:00
parent ab9c824c42
commit d787dda298
3 changed files with 9 additions and 3 deletions

View file

@ -45,7 +45,9 @@ export default class AllocationPrimaryMetric extends Component {
}
get reservedAmount() {
return this.metric === 'cpu' ? this.tracker.reservedCPU : this.tracker.reservedMemory;
if (this.metric === 'cpu') return this.tracker.reservedCPU;
if (this.metric === 'memory') return this.tracker.reservedMemory;
return null;
}
get chartClass() {

View file

@ -28,7 +28,9 @@ export default class NodePrimaryMetric extends Component {
}
get reservedAmount() {
return this.metric === 'cpu' ? this.tracker.reservedCPU : this.tracker.reservedMemory;
if (this.metric === 'cpu') return this.tracker.reservedCPU;
if (this.metric === 'memory') return this.tracker.reservedMemory;
return null;
}
get chartClass() {

View file

@ -31,7 +31,9 @@ export default class TaskPrimaryMetric extends Component {
get reservedAmount() {
if (!this.tracker) return null;
const task = this.tracker.tasks.findBy('task', this.taskState.name);
return this.metric === 'cpu' ? task.reservedCPU : task.reservedMemory;
if (this.metric === 'cpu') return task.reservedCPU;
if (this.metric === 'memory') return task.reservedMemory;
return null;
}
get chartClass() {