Skip to content

Commit eac76af

Browse files
authored
feat(Healthcheck): redesign (#2348)
1 parent a8c5b11 commit eac76af

File tree

73 files changed

+2070
-661
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

73 files changed

+2070
-661
lines changed

src/components/Drawer/Drawer.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ interface DrawerPaneContentWrapperProps {
3232
detectClickOutside?: boolean;
3333
defaultWidth?: number;
3434
isPercentageWidth?: boolean;
35+
hideVeil?: boolean;
3536
}
3637

3738
const DrawerPaneContentWrapper = ({
@@ -45,6 +46,7 @@ const DrawerPaneContentWrapper = ({
4546
className,
4647
detectClickOutside = false,
4748
isPercentageWidth,
49+
hideVeil = true,
4850
}: DrawerPaneContentWrapperProps) => {
4951
const [drawerWidth, setDrawerWidth] = React.useState(() => {
5052
const savedWidth = localStorage.getItem(storageKey);
@@ -113,7 +115,7 @@ const DrawerPaneContentWrapper = ({
113115
<GravityDrawer
114116
onEscape={onClose}
115117
onVeilClick={onClose}
116-
hideVeil
118+
hideVeil={hideVeil}
117119
className={b('container', className)}
118120
>
119121
<DrawerItem
@@ -156,6 +158,7 @@ interface DrawerPaneProps {
156158
drawerControls?: DrawerControl[];
157159
title?: React.ReactNode;
158160
headerClassName?: string;
161+
hideVeil?: boolean;
159162
}
160163

161164
export const DrawerWrapper = ({
@@ -173,6 +176,7 @@ export const DrawerWrapper = ({
173176
drawerControls = [],
174177
title,
175178
headerClassName,
179+
hideVeil,
176180
}: DrawerPaneProps) => {
177181
React.useEffect(() => {
178182
return () => {
@@ -220,6 +224,7 @@ export const DrawerWrapper = ({
220224
<React.Fragment>
221225
{children}
222226
<DrawerPaneContentWrapper
227+
hideVeil={hideVeil}
223228
isVisible={isDrawerVisible}
224229
onClose={onCloseDrawer}
225230
drawerId={drawerId}

src/containers/Storage/EmptyFilter/EmptyFilter.tsx renamed to src/components/EmptyFilter/EmptyFilter.tsx

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

3-
import {EmptyState} from '../../../components/EmptyState';
4-
import {Illustration} from '../../../components/Illustration';
3+
import {EmptyState} from '../EmptyState';
4+
import {Illustration} from '../Illustration';
55

66
import i18n from './i18n';
77

src/containers/Storage/EmptyFilter/i18n/index.ts renamed to src/components/EmptyFilter/i18n/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {registerKeysets} from '../../../../utils/i18n';
1+
import {registerKeysets} from '../../../utils/i18n';
22

33
import en from './en.json';
44
import ru from './ru.json';

src/components/EmptyState/EmptyState.scss

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
@use '../../styles/mixins.scss';
22

33
.empty-state {
4+
$block: &;
45
padding: 20px;
56

67
&_size_m {
@@ -13,6 +14,14 @@
1314
'image title'
1415
'image description'
1516
'image actions';
17+
18+
&_size_xs {
19+
width: 321px;
20+
height: 100px;
21+
#{$block}__image {
22+
margin-right: var(--g-spacing-5);
23+
}
24+
}
1625
&_size_s {
1726
width: 460px;
1827
height: 120px;

src/components/EmptyState/EmptyState.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import './EmptyState.scss';
99
const block = cn('empty-state');
1010

1111
const sizes = {
12+
xs: 100,
1213
s: 150,
1314
m: 250,
1415
l: 350,

src/components/EnableFullscreenButton/EnableFullscreenButton.tsx

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
import {SquareDashed} from '@gravity-ui/icons';
22
import type {ButtonView} from '@gravity-ui/uikit';
3-
import {Button, Icon} from '@gravity-ui/uikit';
3+
import {ActionTooltip, Button, Icon} from '@gravity-ui/uikit';
44

55
import {enableFullscreen} from '../../store/reducers/fullscreen';
66
import {useTypedDispatch} from '../../utils/hooks';
77

8+
import i18n from './i18n';
9+
810
interface EnableFullscreenButtonProps {
911
disabled?: boolean;
1012
view?: ButtonView;
@@ -16,9 +18,11 @@ function EnableFullscreenButton({disabled, view = 'flat-secondary'}: EnableFulls
1618
dispatch(enableFullscreen());
1719
};
1820
return (
19-
<Button onClick={onEnableFullscreen} view={view} disabled={disabled} title="Fullscreen">
20-
<Icon data={SquareDashed} />
21-
</Button>
21+
<ActionTooltip title={i18n('title_fullscreen')}>
22+
<Button onClick={onEnableFullscreen} view={view} disabled={disabled}>
23+
<Icon data={SquareDashed} />
24+
</Button>
25+
</ActionTooltip>
2226
);
2327
}
2428

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"title_fullscreen": "Fullscreen"
3+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import {registerKeysets} from '../../../utils/i18n';
2+
3+
import en from './en.json';
4+
5+
const COMPONENT = 'ydb-fullscreen-button';
6+
7+
export default registerKeysets(COMPONENT, {en});
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
import {
2+
CircleCheck,
3+
CircleExclamation,
4+
CircleInfo,
5+
PlugConnection,
6+
TriangleExclamation,
7+
} from '@gravity-ui/icons';
8+
import type {LabelProps} from '@gravity-ui/uikit';
9+
import {Icon, Label} from '@gravity-ui/uikit';
10+
11+
import {SelfCheckResult} from '../../types/api/healthcheck';
12+
13+
import i18n from './i18n';
14+
15+
const SelfCheckResultToLabelTheme: Record<SelfCheckResult, LabelProps['theme']> = {
16+
[SelfCheckResult.GOOD]: 'success',
17+
[SelfCheckResult.DEGRADED]: 'info',
18+
[SelfCheckResult.MAINTENANCE_REQUIRED]: 'warning',
19+
[SelfCheckResult.EMERGENCY]: 'danger',
20+
[SelfCheckResult.UNSPECIFIED]: 'normal',
21+
};
22+
23+
const SelfCheckResultToIcon: Record<
24+
SelfCheckResult,
25+
(props: React.SVGProps<SVGSVGElement>) => React.JSX.Element
26+
> = {
27+
[SelfCheckResult.GOOD]: CircleCheck,
28+
[SelfCheckResult.DEGRADED]: CircleInfo,
29+
[SelfCheckResult.MAINTENANCE_REQUIRED]: TriangleExclamation,
30+
[SelfCheckResult.EMERGENCY]: CircleExclamation,
31+
[SelfCheckResult.UNSPECIFIED]: PlugConnection,
32+
};
33+
34+
const SelfCheckResultToText: Record<SelfCheckResult, string> = {
35+
get [SelfCheckResult.GOOD]() {
36+
return i18n('title_good');
37+
},
38+
get [SelfCheckResult.DEGRADED]() {
39+
return i18n('title_degraded');
40+
},
41+
get [SelfCheckResult.MAINTENANCE_REQUIRED]() {
42+
return i18n('title_maintenance');
43+
},
44+
get [SelfCheckResult.EMERGENCY]() {
45+
return i18n('title_emergency');
46+
},
47+
get [SelfCheckResult.UNSPECIFIED]() {
48+
return i18n('title_unspecified');
49+
},
50+
};
51+
52+
interface HealthcheckStatusProps {
53+
status: SelfCheckResult;
54+
size?: LabelProps['size'];
55+
}
56+
57+
export function HealthcheckStatus({status, size = 'm'}: HealthcheckStatusProps) {
58+
const theme = SelfCheckResultToLabelTheme[status];
59+
60+
return (
61+
<Label
62+
theme={theme}
63+
icon={<Icon size={14} data={SelfCheckResultToIcon[status]} />}
64+
size={size}
65+
>
66+
{SelfCheckResultToText[status]}
67+
</Label>
68+
);
69+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"title_degraded": "Degraded",
3+
"title_emergency": "Emergency",
4+
"title_maintenance": "Maintenance required",
5+
"title_good": "Good",
6+
"title_unspecified": "Unspecified"
7+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import {registerKeysets} from '../../../utils/i18n';
2+
3+
import en from './en.json';
4+
5+
const COMPONENT = 'ydb-healthcheck-status';
6+
7+
export default registerKeysets(COMPONENT, {en});

src/components/ProgressViewer/ProgressViewer.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ Props description:
3535
6) inverseColorize - invert the colors of the progress bar
3636
7) warningThreshold - the percentage of fullness at which the color of the progress bar changes to yellow
3737
8) dangerThreshold - the percentage of fullness at which the color of the progress bar changes to red
38+
9) withOverflow - percents may be more that 100%
3839
*/
3940

4041
export interface ProgressViewerProps {
@@ -49,13 +50,15 @@ export interface ProgressViewerProps {
4950
warningThreshold?: number;
5051
dangerThreshold?: number;
5152
hideCapacity?: boolean;
53+
withOverflow?: boolean;
5254
}
5355

5456
export function ProgressViewer({
5557
value,
5658
capacity,
5759
formatValues = defaultFormatValues,
5860
percents,
61+
withOverflow,
5962
className,
6063
size = 'xs',
6164
colorizeProgress,
@@ -68,12 +71,13 @@ export function ProgressViewer({
6871

6972
let fillWidth =
7073
Math.floor((parseFloat(String(value)) / parseFloat(String(capacity))) * 100) || 0;
74+
const rawFillWidth = fillWidth;
7175
fillWidth = fillWidth > 100 ? 100 : fillWidth;
7276
let valueText: number | string | undefined = value,
7377
capacityText: number | string | undefined = capacity,
7478
divider = '/';
7579
if (percents) {
76-
valueText = fillWidth + '%';
80+
valueText = (withOverflow ? rawFillWidth : fillWidth) + '%';
7781
capacityText = '';
7882
divider = '';
7983
} else if (formatValues) {

src/components/SplitPane/SplitPane.scss

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222

2323
.gutter {
2424
position: relative;
25-
z-index: 10;
2625

2726
background: var(--g-color-base-background);
2827

src/containers/Storage/PaginatedStorageGroupsTable/StorageGroupsEmptyDataMessage.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1+
import {EmptyFilter} from '../../../components/EmptyFilter/EmptyFilter';
12
import {VISIBLE_ENTITIES} from '../../../store/reducers/storage/constants';
23
import type {VisibleEntities} from '../../../store/reducers/storage/types';
3-
import {EmptyFilter} from '../EmptyFilter/EmptyFilter';
44

55
import i18n from './i18n';
66

src/containers/Storage/PaginatedStorageNodesTable/StorageNodesEmptyDataMessage.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1+
import {EmptyFilter} from '../../../components/EmptyFilter/EmptyFilter';
12
import {VISIBLE_ENTITIES} from '../../../store/reducers/storage/constants';
23
import type {VisibleEntities} from '../../../store/reducers/storage/types';
34
import {NodesUptimeFilterValues} from '../../../utils/nodes';
4-
import {EmptyFilter} from '../EmptyFilter/EmptyFilter';
55

66
import i18n from './i18n';
77

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

Lines changed: 0 additions & 106 deletions
This file was deleted.

0 commit comments

Comments
 (0)