Skip to content

Commit 69833fa

Browse files
committed
fix: some logics fixes
1 parent 9e260df commit 69833fa

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
{
22
"value_of_capacity": "{{value}} of {{capacity}}",
3-
"no-data": "no data"
3+
"no-data": "No data"
44
}

src/containers/Tenant/Diagnostics/TenantOverview/TenantStorage/ProgressWrapper.tsx

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,10 @@ export function ProgressWrapper({
3838
return <div className={className}>{i18n('alert_no-data')}</div>;
3939
}
4040

41-
if (numericCapacity <= 0 && capacity !== undefined) {
42-
return <div className={className}>{i18n('alert_no-data')}</div>;
43-
}
44-
45-
const rawPercentage = Math.floor((numericValue / numericCapacity) * MAX_PERCENTAGE);
41+
const rawPercentage =
42+
numericCapacity > 0
43+
? Math.floor((numericValue / numericCapacity) * MAX_PERCENTAGE)
44+
: MAX_PERCENTAGE;
4645
const fillWidth = Math.max(MIN_PERCENTAGE, rawPercentage);
4746
const clampedFillWidth = Math.min(fillWidth, MAX_PERCENTAGE);
4847

@@ -54,7 +53,7 @@ export function ProgressWrapper({
5453
}, [formatValues, value, capacity]);
5554

5655
const displayText = React.useMemo(() => {
57-
if (!isNumeric(numericCapacity) || numericCapacity <= 0) {
56+
if (numericCapacity <= 0) {
5857
return String(valueText);
5958
}
6059
return i18n('value_of_capacity', {value: valueText, capacity: capacityText});

0 commit comments

Comments
 (0)