import React from 'react'; import {Flex, Text} from '@gravity-ui/uikit'; import type {IssuesTree} from '../../../../store/reducers/healthcheckInfo/types'; import type {StatusFlag} from '../../../../types/api/healthcheck'; import {b} from '../shared'; function getTypeText(type: string) { const normalizedType = type.split('_').join(' '); let result = normalizedType.charAt(0).toUpperCase() + normalizedType.slice(1).toLowerCase(); result = result.replace(/\bvdisk\b/gi, 'VDisk').replace(/\bpdisk\b/gi, 'PDisk'); return result; } interface HealthcheckIssueTabsProps { parents: IssuesTree[]; selectedTab: string; setSelectedTab: (tab: string) => void; } export function HealthcheckIssueTabs({ parents, selectedTab, setSelectedTab, }: HealthcheckIssueTabsProps) { //parent.length === 1 means that it's only issue itself, no need to render tabs if (parents.length <= 1) { return null; } return ( {parents.map((parent, index) => ( setSelectedTab(parent.id)} > {parent.status && } {parent.type && getTypeText(parent.type)} {index !== parents.length - 1 && /} ))} ); } interface HealthcheckIssueTabProps { children: React.ReactNode; active?: boolean; onClick: VoidFunction; } function HealthcjeckIssueTab({children, active, onClick}: HealthcheckIssueTabProps) { return ( {children} ); } interface TabStatusProps { status: StatusFlag; } function TabStatus({status}: TabStatusProps) { return
; }