Skip to content

Commit c1d3f99

Browse files
feat: add PDisk page (#759)
1 parent 72ce541 commit c1d3f99

File tree

49 files changed

+921
-265
lines changed

Some content is hidden

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

49 files changed

+921
-265
lines changed

src/components/EntityStatus/EntityStatus.scss

Lines changed: 1 addition & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -58,61 +58,7 @@
5858
}
5959
}
6060

61-
&__status-color,
62-
&__status-icon {
63-
flex-shrink: 0;
64-
65-
margin-right: 8px;
66-
67-
border-radius: 3px;
68-
&_size_xs {
69-
aspect-ratio: 1;
70-
71-
width: 12px;
72-
height: 12px;
73-
}
74-
&_size_s {
75-
aspect-ratio: 1;
76-
77-
width: 16px;
78-
height: 16px;
79-
}
80-
&_size_m {
81-
aspect-ratio: 1;
82-
83-
width: 18px;
84-
height: 18px;
85-
}
86-
87-
&_size_l {
88-
width: 27px;
89-
height: 27px;
90-
}
91-
}
92-
93-
&__status-color {
94-
&_state_green {
95-
background-color: var(--ydb-color-status-green);
96-
}
97-
&_state_yellow {
98-
background-color: var(--ydb-color-status-yellow);
99-
}
100-
&_state_blue {
101-
background-color: var(--ydb-color-status-blue);
102-
}
103-
&_state_red {
104-
background-color: var(--ydb-color-status-red);
105-
}
106-
&_state_grey {
107-
background-color: var(--ydb-color-status-grey);
108-
}
109-
&_state_orange {
110-
background-color: var(--ydb-color-status-orange);
111-
}
112-
}
113-
114-
&__label,
115-
&__status-icon {
61+
&__label {
11662
&_state_blue {
11763
color: var(--ydb-color-status-blue);
11864
}

src/components/EntityStatus/EntityStatus.tsx

Lines changed: 5 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,13 @@
11
import {Link} from 'react-router-dom';
22
import cn from 'bem-cn-lite';
33

4-
import {Icon, Link as UIKitLink} from '@gravity-ui/uikit';
4+
import {Link as UIKitLink} from '@gravity-ui/uikit';
55

66
import {EFlag} from '../../types/api/enums';
7-
import circleExclamationIcon from '../../assets/icons/circle-exclamation.svg';
8-
import circleInfoIcon from '../../assets/icons/circle-info.svg';
9-
import circleTimesIcon from '../../assets/icons/circle-xmark.svg';
10-
import triangleExclamationIcon from '../../assets/icons/triangle-exclamation.svg';
7+
import {StatusIcon, type StatusIconMode, type StatusIconSize} from '../StatusIcon/StatusIcon';
118
import {ClipboardButton} from '../ClipboardButton';
129
import './EntityStatus.scss';
1310

14-
const icons = {
15-
[EFlag.Blue]: circleInfoIcon,
16-
[EFlag.Yellow]: circleExclamationIcon,
17-
[EFlag.Orange]: triangleExclamationIcon,
18-
[EFlag.Red]: circleTimesIcon,
19-
};
20-
2111
const b = cn('entity-status');
2212

2313
interface EntityStatusProps {
@@ -27,8 +17,8 @@ interface EntityStatusProps {
2717
path?: string;
2818
iconPath?: string;
2919

30-
size?: 'xs' | 's' | 'm' | 'l';
31-
mode?: 'color' | 'icons';
20+
size?: StatusIconSize;
21+
mode?: StatusIconMode;
3222

3323
showStatus?: boolean;
3424
externalLink?: boolean;
@@ -64,18 +54,7 @@ export function EntityStatus({
6454
return null;
6555
}
6656

67-
const modifiers = {state: status.toLowerCase(), size};
68-
69-
if (mode === 'icons' && status in icons) {
70-
return (
71-
<Icon
72-
className={b('status-icon', modifiers)}
73-
data={icons[status as keyof typeof icons]}
74-
/>
75-
);
76-
}
77-
78-
return <div className={b('status-color', modifiers)} />;
57+
return <StatusIcon status={status} size={size} mode={mode} />;
7958
};
8059
const renderStatusLink = () => {
8160
return (

src/components/ExternalLinkWithIcon/ExternalLinkWithIcon.tsx

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

src/components/InfoViewer/InfoViewer.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ export interface InfoViewerItem {
88
value: ReactNode;
99
}
1010

11-
interface InfoViewerProps {
11+
export interface InfoViewerProps {
1212
title?: string;
1313
info?: InfoViewerItem[];
1414
dots?: boolean;
@@ -20,7 +20,7 @@ interface InfoViewerProps {
2020

2121
const b = cn('info-viewer');
2222

23-
const InfoViewer = ({
23+
export const InfoViewer = ({
2424
title,
2525
info,
2626
dots = true,

src/containers/Cluster/ClusterInfoSkeleton/ClusterInfoSkeleton.scss renamed to src/components/InfoViewerSkeleton/InfoViewerSkeleton.scss

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
1-
.ydb-cluster-info-skeleton {
1+
.ydb-info-viewer-skeleton {
22
display: flex;
33
flex-direction: column;
44
gap: 16px;
55

6-
margin-top: 5px;
7-
86
&__row {
97
display: flex;
108
align-items: flex-start;
@@ -39,10 +37,4 @@
3937
min-width: 200px;
4038
max-width: 20%;
4139
}
42-
43-
&__versions {
44-
min-width: 400px;
45-
max-width: 40%;
46-
height: 36px;
47-
}
4840
}

src/containers/Cluster/ClusterInfoSkeleton/ClusterInfoSkeleton.tsx renamed to src/components/InfoViewerSkeleton/InfoViewerSkeleton.tsx

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ import block from 'bem-cn-lite';
22

33
import {Skeleton} from '@gravity-ui/uikit';
44

5-
import './ClusterInfoSkeleton.scss';
5+
import './InfoViewerSkeleton.scss';
66

7-
const b = block('ydb-cluster-info-skeleton');
7+
const b = block('ydb-info-viewer-skeleton');
88

99
const SkeletonLabel = () => (
1010
<div className={b('label')}>
@@ -13,22 +13,18 @@ const SkeletonLabel = () => (
1313
</div>
1414
);
1515

16-
interface ClusterInfoSkeletonProps {
16+
interface InfoViewerSkeletonProps {
1717
className?: string;
1818
rows?: number;
1919
}
2020

21-
export const ClusterInfoSkeleton = ({rows = 8, className}: ClusterInfoSkeletonProps) => (
21+
export const InfoViewerSkeleton = ({rows = 8, className}: InfoViewerSkeletonProps) => (
2222
<div className={b(null, className)}>
2323
{[...new Array(rows)].map((_, index) => (
2424
<div className={b('row')} key={`skeleton-row-${index}`}>
2525
<SkeletonLabel />
2626
<Skeleton className={b('value')} />
2727
</div>
2828
))}
29-
<div className={b('row')} key="versions">
30-
<SkeletonLabel />
31-
<Skeleton className={b('versions')} />
32-
</div>
3329
</div>
3430
);

src/components/ExternalLinkWithIcon/ExternalLinkWithIcon.scss renamed to src/components/LinkWithIcon/LinkWithIcon.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
.ydb-external-link-with-icon {
1+
.ydb-link-with-icon {
22
display: flex;
33
flex-wrap: nowrap;
44
align-items: center;
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
import block from 'bem-cn-lite';
2+
3+
import {Link} from '@gravity-ui/uikit';
4+
5+
import {ArrowUpRightFromSquare} from '@gravity-ui/icons';
6+
7+
import {InternalLink} from '../InternalLink';
8+
import './LinkWithIcon.scss';
9+
10+
const b = block('ydb-link-with-icon');
11+
12+
interface ExternalLinkWithIconProps {
13+
title: string;
14+
url: string;
15+
external?: boolean;
16+
}
17+
18+
export const LinkWithIcon = ({title, url, external = true}: ExternalLinkWithIconProps) => {
19+
const linkContent = (
20+
<>
21+
{title}
22+
{'\u00a0'}
23+
<ArrowUpRightFromSquare />
24+
</>
25+
);
26+
27+
if (external) {
28+
return (
29+
<Link href={url} target="_blank" className={b()}>
30+
{linkContent}
31+
</Link>
32+
);
33+
}
34+
35+
return (
36+
<InternalLink to={url} className={b()}>
37+
{linkContent}
38+
</InternalLink>
39+
);
40+
};
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
.ydb-pdisk-info {
2+
&__links {
3+
display: flex;
4+
flex-flow: row wrap;
5+
6+
gap: 12px;
7+
}
8+
}

0 commit comments

Comments
 (0)