Skip to content

Commit c13b1d0

Browse files
committed
fix: review fixes
1 parent 0020323 commit c13b1d0

File tree

11 files changed

+177
-390
lines changed

11 files changed

+177
-390
lines changed

THREADS_IMPLEMENTATION.md

Lines changed: 0 additions & 140 deletions
This file was deleted.
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import {Flex, HelpMark} from '@gravity-ui/uikit';
2+
3+
interface TitleWithHelpMarkProps {
4+
header: string;
5+
note: string;
6+
}
7+
8+
export function TitleWithHelpMark({header, note}: TitleWithHelpMarkProps) {
9+
return (
10+
<Flex gap={1} alignItems="center">
11+
{header}
12+
<HelpMark popoverProps={{placement: ['right', 'left']}}>{note}</HelpMark>
13+
</Flex>
14+
);
15+
}
Lines changed: 1 addition & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,6 @@
11
.cpu-usage-bar {
2-
display: flex;
3-
align-items: center;
4-
gap: 8px;
5-
6-
min-width: 120px;
7-
82
&__progress {
9-
flex: 1;
10-
3+
width: 60px;
114
min-width: 60px;
125
}
13-
14-
&__text {
15-
font-size: 12px;
16-
white-space: nowrap;
17-
}
18-
19-
&__total {
20-
font-weight: 500;
21-
}
22-
23-
&__breakdown {
24-
margin-left: 4px;
25-
26-
color: var(--g-color-text-secondary);
27-
}
286
}
Lines changed: 14 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
import {Progress} from '@gravity-ui/uikit';
1+
import {Flex, Text} from '@gravity-ui/uikit';
22

3+
import {ProgressViewer} from '../../../../components/ProgressViewer/ProgressViewer';
34
import {cn} from '../../../../utils/cn';
45

56
import './CpuUsageBar.scss';
@@ -12,37 +13,26 @@ interface CpuUsageBarProps {
1213
className?: string;
1314
}
1415

15-
/**
16-
* Component to display CPU usage as a progress bar showing both system and user usage
17-
*/
1816
export function CpuUsageBar({systemUsage = 0, userUsage = 0, className}: CpuUsageBarProps) {
1917
const totalUsage = systemUsage + userUsage;
2018
const systemPercent = Math.round(systemUsage * 100);
2119
const userPercent = Math.round(userUsage * 100);
2220
const totalPercent = Math.round(totalUsage * 100);
2321

24-
// Determine color based on total load
25-
const getProgressTheme = (): 'success' | 'warning' | 'danger' => {
26-
if (totalUsage >= 1.0) {
27-
return 'danger';
28-
} // 100% or more load
29-
if (totalUsage >= 0.8) {
30-
return 'warning';
31-
} // 80% or more load
32-
return 'success';
33-
};
34-
3522
return (
36-
<div className={b(null, className)}>
23+
<Flex gap={2} className={b(null, className)}>
3724
<div className={b('progress')}>
38-
<Progress value={Math.min(totalPercent, 100)} theme={getProgressTheme()} size="s" />
39-
</div>
40-
<div className={b('text')}>
41-
<span className={b('total')}>{totalPercent}%</span>
42-
<span className={b('breakdown')}>
43-
(S: {systemPercent}%, U: {userPercent}%)
44-
</span>
25+
<ProgressViewer
26+
value={totalPercent}
27+
percents={true}
28+
colorizeProgress={true}
29+
capacity={100}
30+
className={b('progress')}
31+
/>
4532
</div>
46-
</div>
33+
<Text color="secondary">
34+
(Sys: {systemPercent}%, U: {userPercent}%)
35+
</Text>
36+
</Flex>
4737
);
4838
}
Lines changed: 3 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,10 @@
1-
.thread-states-bar {
2-
&__bar {
3-
display: flex;
4-
overflow: hidden;
5-
6-
min-width: 80px;
7-
height: 16px;
8-
margin-bottom: 4px;
9-
10-
border: 1px solid var(--g-color-line-generic);
11-
border-radius: 4px;
12-
background-color: var(--g-color-base-generic);
13-
}
14-
15-
&__segment {
16-
transition: opacity 0.2s ease;
17-
18-
&:hover {
19-
opacity: 0.8;
20-
}
21-
}
22-
23-
&__legend {
24-
display: flex;
25-
flex-wrap: wrap;
26-
gap: 8px;
27-
28-
font-size: 11px;
29-
30-
color: var(--g-color-text-secondary);
31-
}
32-
33-
&__legend-item {
34-
display: flex;
35-
align-items: center;
36-
gap: 4px;
37-
38-
white-space: nowrap;
39-
}
40-
1+
.ydb-thread-states-bar {
412
&__legend-color {
423
flex-shrink: 0;
434

445
width: 8px;
45-
height: 8px;
6+
aspect-ratio: 1;
467

47-
border-radius: 2px;
8+
border-radius: var(--g-border-radius-xs);
489
}
4910
}

0 commit comments

Comments
 (0)