Skip to content

Commit f06d479

Browse files
committed
fix: review fixes
1 parent f92f597 commit f06d479

File tree

6 files changed

+16
-19
lines changed

6 files changed

+16
-19
lines changed

src/components/ProgressWrapper/SingleProgress.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ export function SingleProgress({
3838
}, [formatValues, value, capacity]);
3939

4040
const displayText = React.useMemo(() => {
41-
return formatProgressText(valueText, capacityText, numericCapacity, i18n);
41+
return formatProgressText(valueText, capacityText, numericCapacity);
4242
}, [valueText, capacityText, numericCapacity]);
4343

4444
return (

src/components/ProgressWrapper/StackProgress.tsx

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,7 @@ export function StackProgress({
4646
}, [formatValues, totalValue, numericTotalCapacity]);
4747

4848
const displayText = React.useMemo(() => {
49-
return formatProgressText(
50-
totalValueText,
51-
totalCapacityText,
52-
numericTotalCapacity || 0,
53-
i18n,
54-
);
49+
return formatProgressText(totalValueText, totalCapacityText, numericTotalCapacity || 0);
5550
}, [totalValueText, totalCapacityText, numericTotalCapacity]);
5651

5752
return (

src/components/ProgressWrapper/progressUtils.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import type {FormatProgressViewerValues} from '../../utils/progress';
22
import {isNumeric, safeParseNumber} from '../../utils/utils';
33

4+
import i18n from './i18n';
5+
46
// Constants that were previously in TenantStorage/constants
57
export const DEFAULT_PROGRESS_WIDTH = 400;
68
export const MAX_PERCENTAGE = 100;
@@ -31,7 +33,6 @@ export function formatProgressText(
3133
valueText: string | number | undefined,
3234
capacityText: string | number | undefined,
3335
numericCapacity: number,
34-
i18n: any,
3536
): string {
3637
if (numericCapacity <= 0) {
3738
return String(valueText);

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

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@ export function MemorySegmentItem({segment}: MemorySegmentItemProps) {
1818

1919
const valueText = formatSegmentValue(segment.value, segment.capacity);
2020

21+
const progressStyle: React.CSSProperties & Record<string, string> = {
22+
'--g-progress-filled-background-color': segmentColor,
23+
};
24+
2125
return (
2226
<div className={b('segment-row')}>
2327
<div className={b('segment-indicator')} style={{backgroundColor: segmentColor}} />
@@ -31,13 +35,7 @@ export function MemorySegmentItem({segment}: MemorySegmentItemProps) {
3135
>
3236
<Flex alignItems="center" gap="3">
3337
<div className={b('segment-progress')}>
34-
<div
35-
style={
36-
{
37-
'--g-progress-filled-background-color': segmentColor,
38-
} as React.CSSProperties
39-
}
40-
>
38+
<div style={progressStyle}>
4139
<Progress
4240
value={
4341
segment.capacity

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
flex-shrink: 0;
66

77
min-width: 84px;
8+
margin-top: var(--g-spacing-2);
89

910
text-align: right;
1011
white-space: nowrap;

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

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,12 @@ export function TenantMemory({
4646
memoryUsed={memoryUsed}
4747
memoryLimit={memoryLimit}
4848
/>
49-
<div className={b('value-text')} style={{marginTop: '8px'}}>
50-
{formatStorageValuesToGb(Number(memoryUsed))[0]} of{' '}
51-
{formatStorageValuesToGb(Number(memoryLimit))[0]}
52-
</div>
49+
{memoryUsed && memoryLimit && (
50+
<div className={b('value-text')}>
51+
{formatStorageValuesToGb(Number(memoryUsed))[0]} of{' '}
52+
{formatStorageValuesToGb(Number(memoryLimit))[0]}
53+
</div>
54+
)}
5355
</div>
5456
),
5557
},

0 commit comments

Comments
 (0)