mirror of
https://github.com/harvester/harvester-ui-extension.git
synced 2025-12-13 13:11:43 +00:00
fix: separate used/allocated units
Signed-off-by: andy.lee <andy.lee@suse.com>
This commit is contained in:
parent
59aec78631
commit
ab77b21aa8
@ -72,17 +72,23 @@ export default {
|
|||||||
return stats;
|
return stats;
|
||||||
},
|
},
|
||||||
|
|
||||||
units() {
|
allocatedUnits() {
|
||||||
|
const exponent = exponentNeeded(this.storageStats.total, 1024);
|
||||||
|
|
||||||
|
return `${ UNITS[exponent] }iB`;
|
||||||
|
},
|
||||||
|
|
||||||
|
usedUnits() {
|
||||||
const exponent = exponentNeeded(this.storageStats.maximum, 1024);
|
const exponent = exponentNeeded(this.storageStats.maximum, 1024);
|
||||||
|
|
||||||
return `${ UNITS[exponent] }iB`;
|
return `${ UNITS[exponent] }iB`;
|
||||||
},
|
},
|
||||||
|
|
||||||
used() {
|
formatUsed() {
|
||||||
let out = this.formatter(this.storageStats.used);
|
let out = this.formatter(this.storageStats.used);
|
||||||
|
|
||||||
if (!Number.parseFloat(out) > 0) {
|
if (!Number.parseFloat(out) > 0) {
|
||||||
out = this.formatter(this.storageStats.used, { canRoundToZero: false });
|
out = this.formatter(this.storageStats.used, { canRoundToZero: true });
|
||||||
}
|
}
|
||||||
|
|
||||||
return out;
|
return out;
|
||||||
@ -92,7 +98,7 @@ export default {
|
|||||||
let out = this.formatter(this.storageStats.scheduled);
|
let out = this.formatter(this.storageStats.scheduled);
|
||||||
|
|
||||||
if (!Number.parseFloat(out) > 0) {
|
if (!Number.parseFloat(out) > 0) {
|
||||||
out = this.formatter(this.storageStats.scheduled, { canRoundToZero: false });
|
out = this.formatter(this.storageStats.scheduled, { canRoundToZero: true });
|
||||||
}
|
}
|
||||||
|
|
||||||
return out;
|
return out;
|
||||||
@ -100,9 +106,9 @@ export default {
|
|||||||
|
|
||||||
usedAmountTemplateValues() {
|
usedAmountTemplateValues() {
|
||||||
return {
|
return {
|
||||||
used: this.used,
|
used: this.formatUsed,
|
||||||
total: this.formatter(this.storageStats.maximum),
|
total: this.formatter(this.storageStats.maximum),
|
||||||
unit: this.units,
|
unit: this.usedUnits,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -110,7 +116,7 @@ export default {
|
|||||||
return {
|
return {
|
||||||
used: this.formatAllocated,
|
used: this.formatAllocated,
|
||||||
total: this.formatter(this.storageStats.total),
|
total: this.formatter(this.storageStats.total),
|
||||||
unit: this.units,
|
unit: this.allocatedUnits,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -141,7 +147,7 @@ export default {
|
|||||||
<ConsumptionGauge
|
<ConsumptionGauge
|
||||||
:capacity="storageStats.total"
|
:capacity="storageStats.total"
|
||||||
:used="storageStats.scheduled"
|
:used="storageStats.scheduled"
|
||||||
:units="units"
|
:units="allocatedUnits"
|
||||||
:number-formatter="formatter"
|
:number-formatter="formatter"
|
||||||
:resource-name="resourceName"
|
:resource-name="resourceName"
|
||||||
>
|
>
|
||||||
@ -161,7 +167,7 @@ export default {
|
|||||||
<ConsumptionGauge
|
<ConsumptionGauge
|
||||||
:capacity="storageStats.maximum"
|
:capacity="storageStats.maximum"
|
||||||
:used="storageStats.used"
|
:used="storageStats.used"
|
||||||
:units="units"
|
:units="usedUnits"
|
||||||
:number-formatter="formatter"
|
:number-formatter="formatter"
|
||||||
:resource-name="showAllocated ? '' : resourceName"
|
:resource-name="showAllocated ? '' : resourceName"
|
||||||
:class="{
|
:class="{
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user