diff --git a/ui/src/views/dashboard/CapacityDashboard.vue b/ui/src/views/dashboard/CapacityDashboard.vue index dae53cf0015..c2461b5adce 100644 --- a/ui/src/views/dashboard/CapacityDashboard.vue +++ b/ui/src/views/dashboard/CapacityDashboard.vue @@ -174,6 +174,12 @@
@@ -184,15 +190,19 @@

- {{ displayData(ctype, statsMap[ctype]?.capacityused) }} {{ $t('label.allocated') }} | {{ displayData(ctype, statsMap[ctype]?.capacitytotal) }} {{ $t('label.total') }} + {{ displayDataUsedOrAllocated(ctype, statsMap[ctype]?.capacityused, statsMap[ctype]?.capacityallocated) }} {{ this.displayAllocatedCompute ? $t('label.allocated') : $t('label.used') }} | {{ displayData(ctype, statsMap[ctype]?.capacitytotal) }} {{ $t('label.total') }}
@@ -346,6 +356,7 @@ export default { zones: [], zoneSelected: {}, statsMap: {}, + displayAllocatedCompute: false, data: { pods: 0, clusters: 0, @@ -402,6 +413,18 @@ export default { } return 'normal' }, + displayPercentUsedOrAllocated (used, allocated, total) { + var value = this.displayAllocatedCompute ? allocated : used + return parseFloat(100.0 * value / total) + }, + displayPercentFormatUsedOrAllocated (used, allocated, total) { + var value = this.displayAllocatedCompute ? allocated : used + return parseFloat(100.0 * value / total).toFixed(2) + '%' + }, + displayDataUsedOrAllocated (dataType, used, allocated) { + var value = this.displayAllocatedCompute ? allocated : used + return this.displayData(dataType, value) + }, displayData (dataType, value) { if (!value) { value = 0