Skip to content

Commit 26e1c94

Browse files
committed
fix: review fixes
1 parent 79faead commit 26e1c94

File tree

3 files changed

+26
-17
lines changed

3 files changed

+26
-17
lines changed

src/containers/Tenant/Diagnostics/TenantOverview/TenantMemory/MemoryDetailsSection.tsx

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,23 @@ export function MemoryDetailsSection({memoryStats}: MemoryDetailsSectionProps) {
3939
return memorySegments.filter((segment) => !segment.isInfo && segment.value > 0);
4040
}, [memorySegments]);
4141

42+
const formatValues = React.useCallback((value?: number, total?: number): [string, string] => {
43+
return [
44+
formatBytes({
45+
value: value || 0,
46+
size: 'gb',
47+
withSizeLabel: false,
48+
precision: 2,
49+
}),
50+
formatBytes({
51+
value: total || 0,
52+
size: 'gb',
53+
withSizeLabel: true,
54+
precision: 1,
55+
}),
56+
];
57+
}, []);
58+
4259
return (
4360
<div className={b()}>
4461
<div className={b('header')}>
@@ -51,20 +68,7 @@ export function MemoryDetailsSection({memoryStats}: MemoryDetailsSectionProps) {
5168
<ProgressWrapper
5269
stack={memorySegments}
5370
totalCapacity={memoryStats.HardLimit}
54-
formatValues={(value?: number, total?: number): [string, string] => [
55-
formatBytes({
56-
value: value || 0,
57-
size: 'gb',
58-
withSizeLabel: false,
59-
precision: 2,
60-
}),
61-
formatBytes({
62-
value: total || 0,
63-
size: 'gb',
64-
withSizeLabel: true,
65-
precision: 1,
66-
}),
67-
]}
71+
formatValues={formatValues}
6872
className={b('main-progress-bar')}
6973
size="m"
7074
width="full"

src/containers/Tenant/Diagnostics/TenantOverview/TenantMemory/TenantMemory.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,12 @@ export function TenantMemory({
4848
/>
4949
{memoryUsed && memoryLimit && (
5050
<div className={b('value-text')}>
51-
{formatStorageValuesToGb(Number(memoryUsed))[0]} of{' '}
52-
{formatStorageValuesToGb(Number(memoryLimit))[0]}
51+
{i18n('context_capacity-usage', {
52+
value: formatStorageValuesToGb(Number(memoryUsed))[0],
53+
capacity: formatStorageValuesToGb(
54+
Number(memoryLimit),
55+
)[0],
56+
})}
5357
</div>
5458
)}
5559
</div>

src/containers/Tenant/Diagnostics/TenantOverview/i18n/en.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,5 +50,6 @@
5050
"action_by-load": "By Load",
5151
"action_by-pool-usage": "By Pool Usage",
5252
"title_memory-details": "Memory Details",
53-
"field_memory-usage": "Memory usage"
53+
"field_memory-usage": "Memory usage",
54+
"context_capacity-usage": "{{value}} of {{capacity}}"
5455
}

0 commit comments

Comments
 (0)