Skip to content

feat(Healthcheck): redesign #2348

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 14 commits into from
Jun 5, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion src/components/Drawer/Drawer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
detectClickOutside?: boolean;
defaultWidth?: number;
isPercentageWidth?: boolean;
hideVeil?: boolean;
}

const DrawerPaneContentWrapper = ({
Expand All @@ -45,6 +46,7 @@
className,
detectClickOutside = false,
isPercentageWidth,
hideVeil = true,
}: DrawerPaneContentWrapperProps) => {
const [drawerWidth, setDrawerWidth] = React.useState(() => {
const savedWidth = localStorage.getItem(storageKey);
Expand Down Expand Up @@ -100,7 +102,7 @@
};

const handleClickInsideDrawer = (event: React.MouseEvent<HTMLDivElement, MouseEvent>) => {
(event.nativeEvent as DrawerEvent)._capturedInsideDrawer = true;

Check warning on line 105 in src/components/Drawer/Drawer.tsx

View workflow job for this annotation

GitHub Actions / Verify Files

Assignment to property of function parameter 'event'
};

const itemContainer = itemContainerRef?.current;
Expand All @@ -113,7 +115,7 @@
<GravityDrawer
onEscape={onClose}
onVeilClick={onClose}
hideVeil
hideVeil={hideVeil}
className={b('container', className)}
>
<DrawerItem
Expand Down Expand Up @@ -156,6 +158,7 @@
drawerControls?: DrawerControl[];
title?: React.ReactNode;
headerClassName?: string;
hideVeil?: boolean;
}

export const DrawerWrapper = ({
Expand All @@ -173,6 +176,7 @@
drawerControls = [],
title,
headerClassName,
hideVeil,
}: DrawerPaneProps) => {
React.useEffect(() => {
return () => {
Expand Down Expand Up @@ -220,6 +224,7 @@
<React.Fragment>
{children}
<DrawerPaneContentWrapper
hideVeil={hideVeil}
isVisible={isDrawerVisible}
onClose={onCloseDrawer}
drawerId={drawerId}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {Button} from '@gravity-ui/uikit';

import {EmptyState} from '../../../components/EmptyState';
import {Illustration} from '../../../components/Illustration';
import {EmptyState} from '../EmptyState';
import {Illustration} from '../Illustration';

import i18n from './i18n';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {registerKeysets} from '../../../../utils/i18n';
import {registerKeysets} from '../../../utils/i18n';

import en from './en.json';
import ru from './ru.json';
Expand Down
9 changes: 9 additions & 0 deletions src/components/EmptyState/EmptyState.scss
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
@use '../../styles/mixins.scss';

.empty-state {
$block: &;
padding: 20px;

&_size_m {
Expand All @@ -13,6 +14,14 @@
'image title'
'image description'
'image actions';

&_size_xs {
width: 321px;
height: 100px;
#{$block}__image {
margin-right: var(--g-spacing-5);
}
}
&_size_s {
width: 460px;
height: 120px;
Expand Down
1 change: 1 addition & 0 deletions src/components/EmptyState/EmptyState.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import './EmptyState.scss';
const block = cn('empty-state');

const sizes = {
xs: 100,
s: 150,
m: 250,
l: 350,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import {SquareDashed} from '@gravity-ui/icons';
import type {ButtonView} from '@gravity-ui/uikit';
import {Button, Icon} from '@gravity-ui/uikit';
import {ActionTooltip, Button, Icon} from '@gravity-ui/uikit';

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

import i18n from './i18n';

interface EnableFullscreenButtonProps {
disabled?: boolean;
view?: ButtonView;
Expand All @@ -16,9 +18,11 @@ function EnableFullscreenButton({disabled, view = 'flat-secondary'}: EnableFulls
dispatch(enableFullscreen());
};
return (
<Button onClick={onEnableFullscreen} view={view} disabled={disabled} title="Fullscreen">
<Icon data={SquareDashed} />
</Button>
<ActionTooltip title={i18n('title_fullscreen')}>
<Button onClick={onEnableFullscreen} view={view} disabled={disabled}>
<Icon data={SquareDashed} />
</Button>
</ActionTooltip>
);
}

Expand Down
3 changes: 3 additions & 0 deletions src/components/EnableFullscreenButton/i18n/en.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"title_fullscreen": "Fullscreen"
}
7 changes: 7 additions & 0 deletions src/components/EnableFullscreenButton/i18n/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import {registerKeysets} from '../../../utils/i18n';

import en from './en.json';

const COMPONENT = 'ydb-fullscreen-button';

export default registerKeysets(COMPONENT, {en});
69 changes: 69 additions & 0 deletions src/components/HealthcheckStatus/HealthcheckStatus.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
import {
CircleCheck,
CircleExclamation,
CircleInfo,
PlugConnection,
TriangleExclamation,
} from '@gravity-ui/icons';
import type {LabelProps} from '@gravity-ui/uikit';
import {Icon, Label} from '@gravity-ui/uikit';

import {SelfCheckResult} from '../../types/api/healthcheck';

import i18n from './i18n';

const SelfCheckResultToLabelTheme: Record<SelfCheckResult, LabelProps['theme']> = {
[SelfCheckResult.GOOD]: 'success',
[SelfCheckResult.DEGRADED]: 'info',
[SelfCheckResult.MAINTENANCE_REQUIRED]: 'warning',
[SelfCheckResult.EMERGENCY]: 'danger',
[SelfCheckResult.UNSPECIFIED]: 'normal',
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i18n

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's map SelfCheckResultToLabelTheme, no need to translate here

};

const SelfCheckResultToIcon: Record<
SelfCheckResult,
(props: React.SVGProps<SVGSVGElement>) => React.JSX.Element
> = {
[SelfCheckResult.GOOD]: CircleCheck,
[SelfCheckResult.DEGRADED]: CircleInfo,
[SelfCheckResult.MAINTENANCE_REQUIRED]: TriangleExclamation,
[SelfCheckResult.EMERGENCY]: CircleExclamation,
[SelfCheckResult.UNSPECIFIED]: PlugConnection,
};

const SelfCheckResultToText: Record<SelfCheckResult, string> = {
get [SelfCheckResult.GOOD]() {
return i18n('title_good');
},
get [SelfCheckResult.DEGRADED]() {
return i18n('title_degraded');
},
get [SelfCheckResult.MAINTENANCE_REQUIRED]() {
return i18n('title_maintenance');
},
get [SelfCheckResult.EMERGENCY]() {
return i18n('title_emergency');
},
get [SelfCheckResult.UNSPECIFIED]() {
return i18n('title_unspecified');
},
};

interface HealthcheckStatusProps {
status: SelfCheckResult;
size?: LabelProps['size'];
}

export function HealthcheckStatus({status, size = 'm'}: HealthcheckStatusProps) {
const theme = SelfCheckResultToLabelTheme[status];

return (
<Label
theme={theme}
icon={<Icon size={14} data={SelfCheckResultToIcon[status]} />}
size={size}
>
{SelfCheckResultToText[status]}
</Label>
);
}
7 changes: 7 additions & 0 deletions src/components/HealthcheckStatus/i18n/en.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"title_degraded": "Degraded",
"title_emergency": "Emergency",
"title_maintenance": "Maintenance required",
"title_good": "Good",
"title_unspecified": "Unspecified"
}
7 changes: 7 additions & 0 deletions src/components/HealthcheckStatus/i18n/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import {registerKeysets} from '../../../utils/i18n';

import en from './en.json';

const COMPONENT = 'ydb-healthcheck-status';

export default registerKeysets(COMPONENT, {en});
6 changes: 5 additions & 1 deletion src/components/ProgressViewer/ProgressViewer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ Props description:
6) inverseColorize - invert the colors of the progress bar
7) warningThreshold - the percentage of fullness at which the color of the progress bar changes to yellow
8) dangerThreshold - the percentage of fullness at which the color of the progress bar changes to red
9) withOverflow - percents may be more that 100%
*/
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pErcents


export interface ProgressViewerProps {
Expand All @@ -49,13 +50,15 @@ export interface ProgressViewerProps {
warningThreshold?: number;
dangerThreshold?: number;
hideCapacity?: boolean;
withOverflow?: boolean;
}

export function ProgressViewer({
value,
capacity,
formatValues = defaultFormatValues,
percents,
withOverflow,
className,
size = 'xs',
colorizeProgress,
Expand All @@ -68,12 +71,13 @@ export function ProgressViewer({

let fillWidth =
Math.floor((parseFloat(String(value)) / parseFloat(String(capacity))) * 100) || 0;
const rawFillWidth = fillWidth;
fillWidth = fillWidth > 100 ? 100 : fillWidth;
let valueText: number | string | undefined = value,
capacityText: number | string | undefined = capacity,
divider = '/';
if (percents) {
valueText = fillWidth + '%';
valueText = (withOverflow ? rawFillWidth : fillWidth) + '%';
capacityText = '';
divider = '';
} else if (formatValues) {
Expand Down
1 change: 0 additions & 1 deletion src/components/SplitPane/SplitPane.scss
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@

.gutter {
position: relative;
z-index: 10;

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

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {EmptyFilter} from '../../../components/EmptyFilter/EmptyFilter';
import {VISIBLE_ENTITIES} from '../../../store/reducers/storage/constants';
import type {VisibleEntities} from '../../../store/reducers/storage/types';
import {EmptyFilter} from '../EmptyFilter/EmptyFilter';

import i18n from './i18n';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {EmptyFilter} from '../../../components/EmptyFilter/EmptyFilter';
import {VISIBLE_ENTITIES} from '../../../store/reducers/storage/constants';
import type {VisibleEntities} from '../../../store/reducers/storage/types';
import {NodesUptimeFilterValues} from '../../../utils/nodes';
import {EmptyFilter} from '../EmptyFilter/EmptyFilter';

import i18n from './i18n';

Expand Down

This file was deleted.

Loading
Loading