Skip to content
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
2 changes: 1 addition & 1 deletion src/components/BasicNodeViewer/BasicNodeViewer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import cn from 'bem-cn-lite';
import type {AdditionalNodesProps} from '../../types/additionalProps';
import type {PreparedNode} from '../../store/reducers/node/types';

import EntityStatus from '../EntityStatus/EntityStatus';
import {EntityStatus} from '../EntityStatus/EntityStatus';
import {Tags} from '../Tags';
import {Icon} from '../Icon';

Expand Down
136 changes: 0 additions & 136 deletions src/components/EntityStatus/EntityStatus.js

This file was deleted.

2 changes: 0 additions & 2 deletions src/components/EntityStatus/EntityStatus.scss
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,6 @@
}

&__status-color {
&_state_running,
&_state_green {
background-color: var(--ydb-color-status-green);
}
Expand All @@ -104,7 +103,6 @@
&_state_red {
background-color: var(--ydb-color-status-red);
}
&_state_gray,
&_state_grey {
background-color: var(--ydb-color-status-grey);
}
Expand Down
124 changes: 124 additions & 0 deletions src/components/EntityStatus/EntityStatus.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
import {Link} from 'react-router-dom';
import cn from 'bem-cn-lite';

import {Icon, 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 {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 {
status?: EFlag;
name?: string;
label?: string;
path?: string;
iconPath?: string;

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

showStatus?: boolean;
externalLink?: boolean;
withLeftTrim?: boolean;

hasClipboardButton?: boolean;
clipboardButtonAlwaysVisible?: boolean;

className?: string;
}

export function EntityStatus({
status = EFlag.Grey,
name = '',
label,
path,
iconPath,

size = 's',
mode = 'color',

showStatus = true,
externalLink = false,
withLeftTrim = false,

hasClipboardButton,
clipboardButtonAlwaysVisible = false,

className,
}: EntityStatusProps) {
const renderIcon = () => {
if (!showStatus) {
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)} />;
};
const renderStatusLink = () => {
return (
<UIKitLink target="_blank" href={iconPath}>
{renderIcon()}
</UIKitLink>
);
};
const renderLink = () => {
if (externalLink) {
return (
<UIKitLink className={b('name')} href={path}>
{name}
</UIKitLink>
);
}

return path ? (
<Link className={b('name')} to={path}>
{name}
</Link>
) : (
name && <span className={b('name')}>{name}</span>
);
};
return (
<div className={b(null, className)} title={name}>
{iconPath ? renderStatusLink() : renderIcon()}
{label && (
<span title={label} className={b('label', {size, state: status.toLowerCase()})}>
{label}
</span>
)}
<span className={b('link', {'with-left-trim': withLeftTrim})}>{renderLink()}</span>
{hasClipboardButton && (
<ClipboardButton
text={name}
size="s"
className={b('clipboard-button', {
visible: clipboardButtonAlwaysVisible,
})}
/>
)}
</div>
);
}
2 changes: 1 addition & 1 deletion src/components/NodeHostWrapper/NodeHostWrapper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import type {NodeAddress} from '../../types/additionalProps';
import {getDefaultNodePath} from '../../containers/Node/NodePages';
import {isUnavailableNode} from '../../utils/nodes';

import EntityStatus from '../EntityStatus/EntityStatus';
import {EntityStatus} from '../EntityStatus/EntityStatus';
import {NodeEndpointsTooltipContent} from '../TooltipsContent';
import {Icon} from '../Icon';
import {CellWithPopover} from '../CellWithPopover/CellWithPopover';
Expand Down
2 changes: 1 addition & 1 deletion src/components/Tablet/Tablet.scss
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
padding: 10px;
}

&_status_gray {
&_status_grey {
background-color: var(--ydb-color-status-grey);
}
&_status_yellow {
Expand Down
2 changes: 1 addition & 1 deletion src/components/TabletsOverall/TabletsOverall.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ function TabletsOverall({tablets}: TabletsOverallProps) {
value: statesForOverallProgress[key],
}));

// sort stack to achieve order "green, orange, yellow, red, blue, gray"
// sort stack to achieve order "green, orange, yellow, red, blue, grey"
stack.sort((a, b) => COLORS_PRIORITY[b.colorKey] - COLORS_PRIORITY[a.colorKey]);

return (
Expand Down
2 changes: 1 addition & 1 deletion src/components/TabletsStatistic/TabletsStatistic.scss
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
color: var(--g-color-text-danger);
background: var(--g-color-base-danger-light);
}
&_state_gray {
&_state_grey {
color: var(--g-color-text-secondary);
border: 1px solid var(--g-color-line-generic-hover);
}
Expand Down
2 changes: 1 addition & 1 deletion src/components/VirtualTable/TableHead.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ export const TableHead = <T,>({
let newSortParams: SortParams = {};

// Order is changed in following order:
// 1. Inactive Sort Order - gray icon of default order
// 1. Inactive Sort Order - grey icon of default order
// 2. Active default order
// 3. Active not default order
if (columnId === sortParams.columnId) {
Expand Down
2 changes: 1 addition & 1 deletion src/containers/Cluster/Cluster.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import {Tenants} from '../Tenants/Tenants';
import {StorageWrapper} from '../Storage/StorageWrapper';
import {NodesWrapper} from '../Nodes/NodesWrapper';
import {Versions} from '../Versions/Versions';
import EntityStatus from '../../components/EntityStatus/EntityStatus';
import {EntityStatus} from '../../components/EntityStatus/EntityStatus';
import {CLUSTER_DEFAULT_TITLE} from '../../utils/constants';

import {ClusterInfo} from './ClusterInfo/ClusterInfo';
Expand Down
2 changes: 1 addition & 1 deletion src/containers/Clusters/Clusters.scss
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
&_type_red {
background: var(--ydb-color-status-red);
}
&_type_gray {
&_type_grey {
background: var(--ydb-color-status-grey);
}
&_type_orange {
Expand Down
2 changes: 1 addition & 1 deletion src/containers/Heatmap/HeatmapCanvas/HeatmapCanvas.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export const HeatmapCanvas = (props) => {
const rectX = (index % columnsCount) * (TABLET_SIZE + TABLET_PADDING);
const rectY = Math.floor(index / columnsCount) * (TABLET_SIZE + TABLET_PADDING);

ctx.fillStyle = tablet.color || 'gray';
ctx.fillStyle = tablet.color || 'grey';
ctx.fillRect(rectX, rectY, TABLET_SIZE, TABLET_SIZE);
};
}
Expand Down
7 changes: 5 additions & 2 deletions src/containers/Node/NodeStructure/Pdisk.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {ArrowToggle, Button, Popover} from '@gravity-ui/uikit';
import DataTable, {type Column} from '@gravity-ui/react-data-table';

import type {ValueOf} from '../../../types/common';
import {EFlag} from '../../../types/api/enums';
import type {
PreparedStructurePDisk,
PreparedStructureVDisk,
Expand All @@ -19,7 +20,7 @@ import {
createPDiskDeveloperUILink,
createVDiskDeveloperUILink,
} from '../../../utils/developerUI/developerUI';
import EntityStatus from '../../../components/EntityStatus/EntityStatus';
import {EntityStatus} from '../../../components/EntityStatus/EntityStatus';
import InfoViewer, {type InfoViewerItem} from '../../../components/InfoViewer/InfoViewer';
import {ProgressViewer} from '../../../components/ProgressViewer/ProgressViewer';
import {Icon} from '../../../components/Icon';
Expand Down Expand Up @@ -110,7 +111,9 @@ function getColumns({
width: 70,
render: ({row}) => {
return (
<EntityStatus status={row.VDiskState === EVDiskState.OK ? 'green' : 'red'} />
<EntityStatus
status={row.VDiskState === EVDiskState.OK ? EFlag.Green : EFlag.Red}
/>
);
},
sortAccessor: (row) => (row.VDiskState === EVDiskState.OK ? 1 : 0),
Expand Down
Loading