Skip to content

Commit 45041ca

Browse files
committed
fix: review fixes
1 parent 6ec9842 commit 45041ca

File tree

5 files changed

+17
-22
lines changed

5 files changed

+17
-22
lines changed

src/components/MemoryViewer/MemoryViewer.scss

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ $memory-type-colors: (
2626

2727
overflow: hidden;
2828

29-
height: 23px;
29+
height: 20px;
3030

3131
border-radius: 2px;
3232
background: var(--g-color-base-generic);
@@ -96,15 +96,6 @@ $memory-type-colors: (
9696
}
9797
}
9898

99-
&_size {
100-
height: 20px;
101-
@include body-2-typography();
102-
103-
#{$block}__progress-container {
104-
height: inherit;
105-
}
106-
}
107-
10899
&__text {
109100
display: flex;
110101
justify-content: center;

src/components/MemoryViewer/MemoryViewer.tsx

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import {DefinitionList, useTheme} from '@gravity-ui/uikit';
22

33
import type {TMemoryStats} from '../../types/api/nodes';
4+
import {formatBytes} from '../../utils/bytesParsers';
45
import {cn} from '../../utils/cn';
56
import {calculateProgressStatus} from '../../utils/progress';
67
import {isNumeric} from '../../utils/utils';
@@ -71,14 +72,8 @@ export function MemoryViewer({
7172

7273
const memorySegments = getMemorySegments(stats);
7374

74-
const totalUsedMemory =
75-
memorySegments
76-
.filter(({isInfo}) => !isInfo)
77-
.reduce((acc, segment) => acc + calculateMemoryShare(segment.value), 0) /
78-
parseFloat(String(capacity));
79-
8075
const status = calculateProgressStatus({
81-
fillWidth: totalUsedMemory,
76+
fillWidth,
8277
warningThreshold,
8378
dangerThreshold,
8479
colorizeProgress: true,
@@ -109,7 +104,12 @@ export function MemoryViewer({
109104
colorizeProgress
110105
/>
111106
) : (
112-
formatValues(segmentSize, undefined)[0]
107+
formatBytes({
108+
value: segmentSize,
109+
size: 'gb',
110+
withSizeLabel: true,
111+
precision: 2,
112+
})
113113
)}
114114
</DefinitionList.Item>
115115
),
Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
{
2-
"text_memory-detailed": "Memory Detailed",
32
"text_external-consumption": "External Consumption",
43
"text_allocator-caches": "Allocator Caches",
54
"text_shared-cache": "Shared Cache",
65
"text_memtable": "MemTable",
76
"text_query-execution": "Query Execution",
7+
"text_usage": "Usage",
88
"text_soft-limit": "Soft Limit",
99
"text_hard-limit": "Hard Limit",
10-
"text_other": "Other",
11-
"memory-detailed": "Memory Detailed"
10+
"text_other": "Other"
1211
}

src/components/MemoryViewer/utils.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,12 @@ export function getMemorySegments(stats: TMemoryStats): MemorySegment[] {
7171
value: getMaybeNumber(stats.ExternalConsumption),
7272
isInfo: true,
7373
},
74+
{
75+
label: i18n('text_usage'),
76+
key: 'Usage',
77+
value: getMaybeNumber(stats.AnonRss),
78+
isInfo: true,
79+
},
7480
{
7581
label: i18n('text_soft-limit'),
7682
key: 'SoftLimit',

src/components/nodesColumns/i18n/en.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
"disk-usage": "Disk usage",
1616
"tablets": "Tablets",
1717
"load-average": "Load Average",
18-
"memory-detailed": "Memory Detailed",
1918
"load": "Load",
2019
"caches": "Caches",
2120
"sessions": "Sessions",

0 commit comments

Comments
 (0)