import React from 'react'; import {Flex} from '@gravity-ui/uikit'; import {DoughnutMetrics} from '../../../../components/DoughnutMetrics/DoughnutMetrics'; import {EntityStatus} from '../../../../components/EntityStatus/EntityStatus'; import {Skeleton} from '../../../../components/Skeleton/Skeleton'; import {EFlag} from '../../../../types/api/enums'; import type {ProgressStatus} from '../../../../utils/progress'; import {b} from '../shared'; const ProgressStatusToEFlag: Record = { good: EFlag.Green, warning: EFlag.Yellow, danger: EFlag.Red, }; interface ClusterMetricsDougnutCardProps extends Omit { status: ProgressStatus; fillWidth: number; percents: string; legend: {main?: string; secondary?: string; note?: React.ReactNode}; } interface ClusterMetricsCommonCardProps { children?: React.ReactNode; title?: string; className?: string; collapsed?: boolean; } export function ClusterMetricsCard({ children, className, collapsed, }: ClusterMetricsCommonCardProps) { return ( {children} ); } export function ClusterMetricsCardContent({ title, percents, legend, collapsed, ...rest }: ClusterMetricsDougnutCardProps) { const {main: mainLegend, secondary: secondaryLegend, note: legendNote} = legend; if (collapsed) { const {status} = rest; return ( {`${title} : ${percents}`} ); } return ( {percents}
{mainLegend && {mainLegend}} {secondaryLegend && ( {secondaryLegend} )}
); } interface ClusterMetricsCardSkeletonProps { collapsed?: boolean; } function ClusterMetricsCardSkeleton({collapsed}: ClusterMetricsCardSkeletonProps) { return ( ); } export function ClusterDashboardSkeleton({collapsed}: ClusterMetricsCardSkeletonProps) { return ( ); }