Skip to content
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

feat: add PDisk page #759

Merged
merged 2 commits into from
Mar 15, 2024
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
56 changes: 1 addition & 55 deletions src/components/EntityStatus/EntityStatus.scss
Original file line number Diff line number Diff line change
Expand Up @@ -58,61 +58,7 @@
}
}

&__status-color,
&__status-icon {
flex-shrink: 0;

margin-right: 8px;

border-radius: 3px;
&_size_xs {
aspect-ratio: 1;

width: 12px;
height: 12px;
}
&_size_s {
aspect-ratio: 1;

width: 16px;
height: 16px;
}
&_size_m {
aspect-ratio: 1;

width: 18px;
height: 18px;
}

&_size_l {
width: 27px;
height: 27px;
}
}

&__status-color {
&_state_green {
background-color: var(--ydb-color-status-green);
}
&_state_yellow {
background-color: var(--ydb-color-status-yellow);
}
&_state_blue {
background-color: var(--ydb-color-status-blue);
}
&_state_red {
background-color: var(--ydb-color-status-red);
}
&_state_grey {
background-color: var(--ydb-color-status-grey);
}
&_state_orange {
background-color: var(--ydb-color-status-orange);
}
}

&__label,
&__status-icon {
&__label {
&_state_blue {
color: var(--ydb-color-status-blue);
}
Expand Down
31 changes: 5 additions & 26 deletions src/components/EntityStatus/EntityStatus.tsx
Original file line number Diff line number Diff line change
@@ -1,23 +1,13 @@
import {Link} from 'react-router-dom';
import cn from 'bem-cn-lite';

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

import {EFlag} from '../../types/api/enums';
import circleExclamationIcon from '../../assets/icons/circle-exclamation.svg';
import circleInfoIcon from '../../assets/icons/circle-info.svg';
import circleTimesIcon from '../../assets/icons/circle-xmark.svg';
import triangleExclamationIcon from '../../assets/icons/triangle-exclamation.svg';
import {StatusIcon, type StatusIconMode, type StatusIconSize} from '../StatusIcon/StatusIcon';
import {ClipboardButton} from '../ClipboardButton';
import './EntityStatus.scss';

const icons = {
[EFlag.Blue]: circleInfoIcon,
[EFlag.Yellow]: circleExclamationIcon,
[EFlag.Orange]: triangleExclamationIcon,
[EFlag.Red]: circleTimesIcon,
};

const b = cn('entity-status');

interface EntityStatusProps {
Expand All @@ -27,8 +17,8 @@ interface EntityStatusProps {
path?: string;
iconPath?: string;

size?: 'xs' | 's' | 'm' | 'l';
mode?: 'color' | 'icons';
size?: StatusIconSize;
mode?: StatusIconMode;

showStatus?: boolean;
externalLink?: boolean;
Expand Down Expand Up @@ -64,18 +54,7 @@ export function EntityStatus({
return null;
}

const modifiers = {state: status.toLowerCase(), size};

if (mode === 'icons' && status in icons) {
return (
<Icon
className={b('status-icon', modifiers)}
data={icons[status as keyof typeof icons]}
/>
);
}

return <div className={b('status-color', modifiers)} />;
return <StatusIcon status={status} size={size} mode={mode} />;
};
const renderStatusLink = () => {
return (
Expand Down
24 changes: 0 additions & 24 deletions src/components/ExternalLinkWithIcon/ExternalLinkWithIcon.tsx

This file was deleted.

4 changes: 2 additions & 2 deletions src/components/InfoViewer/InfoViewer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export interface InfoViewerItem {
value: ReactNode;
}

interface InfoViewerProps {
export interface InfoViewerProps {
title?: string;
info?: InfoViewerItem[];
dots?: boolean;
Expand All @@ -20,7 +20,7 @@ interface InfoViewerProps {

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

const InfoViewer = ({
export const InfoViewer = ({
title,
info,
dots = true,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
.ydb-cluster-info-skeleton {
.ydb-info-viewer-skeleton {
display: flex;
flex-direction: column;
gap: 16px;

margin-top: 5px;

&__row {
display: flex;
align-items: flex-start;
Expand Down Expand Up @@ -39,10 +37,4 @@
min-width: 200px;
max-width: 20%;
}

&__versions {
min-width: 400px;
max-width: 40%;
height: 36px;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ import block from 'bem-cn-lite';

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

import './ClusterInfoSkeleton.scss';
import './InfoViewerSkeleton.scss';

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

const SkeletonLabel = () => (
<div className={b('label')}>
Expand All @@ -13,22 +13,18 @@ const SkeletonLabel = () => (
</div>
);

interface ClusterInfoSkeletonProps {
interface InfoViewerSkeletonProps {
className?: string;
rows?: number;
}

export const ClusterInfoSkeleton = ({rows = 8, className}: ClusterInfoSkeletonProps) => (
export const InfoViewerSkeleton = ({rows = 8, className}: InfoViewerSkeletonProps) => (
<div className={b(null, className)}>
{[...new Array(rows)].map((_, index) => (
<div className={b('row')} key={`skeleton-row-${index}`}>
<SkeletonLabel />
<Skeleton className={b('value')} />
</div>
))}
<div className={b('row')} key="versions">
<SkeletonLabel />
<Skeleton className={b('versions')} />
</div>
Comment on lines -29 to -32
Copy link
Member Author

Choose a reason for hiding this comment

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

Since ClusterInfo is moved to a separate tab, layout shifts on data load doesn't affect us as much as before, so there is no need to fully preserve content height.

Removed separate versions row to make component usable for all tabs and pages

</div>
);
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.ydb-external-link-with-icon {
.ydb-link-with-icon {
display: flex;
flex-wrap: nowrap;
align-items: center;
Expand Down
40 changes: 40 additions & 0 deletions src/components/LinkWithIcon/LinkWithIcon.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import block from 'bem-cn-lite';

import {Link} from '@gravity-ui/uikit';

import {ArrowUpRightFromSquare} from '@gravity-ui/icons';

import {InternalLink} from '../InternalLink';
import './LinkWithIcon.scss';

const b = block('ydb-link-with-icon');

interface ExternalLinkWithIconProps {
title: string;
url: string;
external?: boolean;
}

export const LinkWithIcon = ({title, url, external = true}: ExternalLinkWithIconProps) => {
const linkContent = (
<>
{title}
{'\u00a0'}
<ArrowUpRightFromSquare />
</>
);

if (external) {
return (
<Link href={url} target="_blank" className={b()}>
{linkContent}
</Link>
);
}

return (
<InternalLink to={url} className={b()}>
{linkContent}
</InternalLink>
);
};
8 changes: 8 additions & 0 deletions src/components/PDiskInfo/PDiskInfo.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
.ydb-pdisk-info {
&__links {
display: flex;
flex-flow: row wrap;

gap: 12px;
}
}
Loading
Loading