Skip to content

Commit a6715ca

Browse files
Copilotastandrik
andcommitted
feat: make RAM and CPU bars fill container width in tables
Co-authored-by: astandrik <[email protected]>
1 parent c0d5ed9 commit a6715ca

File tree

7 files changed

+29
-5
lines changed

7 files changed

+29
-5
lines changed

src/components/MemoryViewer/MemoryViewer.scss

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,11 @@ $memory-type-colors: (
1919
min-width: 150px;
2020
padding: 0 var(--g-spacing-1);
2121

22+
&_width_full {
23+
width: 100%;
24+
min-width: 40px;
25+
}
26+
2227
&__progress-container {
2328
position: relative;
2429

src/components/MemoryViewer/MemoryViewer.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ export interface MemoryProgressViewerProps {
4343
dangerThreshold?: number;
4444
formatValues: FormatProgressViewerValues;
4545
percents?: boolean;
46+
width?: 'full';
4647
}
4748

4849
export function MemoryViewer({
@@ -52,6 +53,7 @@ export function MemoryViewer({
5253
className,
5354
warningThreshold,
5455
dangerThreshold,
56+
width,
5557
}: MemoryProgressViewerProps) {
5658
const memoryUsage = stats.AnonRss ?? calculateAllocatedMemory(stats);
5759

@@ -134,7 +136,7 @@ export function MemoryViewer({
134136
</DefinitionList>
135137
)}
136138
>
137-
<div className={b({theme, status}, className)}>
139+
<div className={b({theme, status, width}, className)}>
138140
<div className={b('progress-container')}>
139141
{memorySegments
140142
.filter(({isInfo}) => !isInfo)

src/components/ProgressViewer/ProgressViewer.scss

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,11 @@
2222
border-radius: 2px;
2323
background: var(--g-color-base-generic);
2424

25+
&_width_full {
26+
width: 100%;
27+
min-width: 40px;
28+
}
29+
2530
&_theme_dark {
2631
color: var(--g-color-text-light-primary);
2732

src/components/ProgressViewer/ProgressViewer.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ export interface ProgressViewerProps {
3838
dangerThreshold?: number;
3939
hideCapacity?: boolean;
4040
withOverflow?: boolean;
41+
width?: 'full';
4142
}
4243

4344
export function ProgressViewer({
@@ -53,6 +54,7 @@ export function ProgressViewer({
5354
warningThreshold,
5455
dangerThreshold,
5556
hideCapacity,
57+
width,
5658
}: ProgressViewerProps) {
5759
const theme = useTheme();
5860

@@ -96,7 +98,7 @@ export function ProgressViewer({
9698

9799
if (isNumeric(value)) {
98100
return (
99-
<div className={b({size, theme, status}, className)}>
101+
<div className={b({size, theme, status, width}, className)}>
100102
<div className={b('line')} style={lineStyle}></div>
101103
<span className={b('text')}>{renderContent()}</span>
102104
</div>
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
.ydb-nodes-columns {
22
&__column-ram,
33
&__column-cpu {
4+
flex: 1;
5+
46
min-width: 40px;
57
}
68
}

src/components/nodesColumns/columns.tsx

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,7 @@ export function getRAMColumn<T extends {MemoryUsed?: string; MemoryLimit?: strin
187187
className={b('column-ram')}
188188
colorizeProgress
189189
hideCapacity
190+
width="full"
190191
/>
191192
</CellWithPopover>
192193
);
@@ -205,13 +206,18 @@ export function getMemoryColumn<
205206
defaultOrder: DataTable.DESCENDING,
206207
render: ({row}) => {
207208
return row.MemoryStats ? (
208-
<MemoryViewer formatValues={formatStorageValuesToGb} stats={row.MemoryStats} />
209+
<MemoryViewer
210+
formatValues={formatStorageValuesToGb}
211+
stats={row.MemoryStats}
212+
width="full"
213+
/>
209214
) : (
210215
<ProgressViewer
211216
value={row.MemoryUsed}
212217
capacity={row.MemoryLimit}
213218
formatValues={formatStorageValuesToGb}
214219
colorizeProgress={true}
220+
width="full"
215221
/>
216222
);
217223
},
@@ -283,6 +289,7 @@ export function getCpuColumn<
283289
capacity={1}
284290
colorizeProgress
285291
percents
292+
width="full"
286293
/>
287294
</CellWithPopover>
288295
);
Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
.cpu-usage-bar {
22
&__progress {
3-
width: 60px;
4-
min-width: 60px;
3+
flex: 1;
4+
5+
min-width: 40px;
56
}
67
}

0 commit comments

Comments
 (0)