import './InfraMetrics.styles.scss'; import { Empty, Radio } from 'antd'; import { RadioChangeEvent } from 'antd/lib'; import { History, Table } from 'lucide-react'; import { useState } from 'react'; import { VIEW_TYPES } from './constants'; import NodeMetrics from './NodeMetrics'; import PodMetrics from './PodMetrics'; interface MetricsDataProps { podName: string; nodeName: string; hostName: string; clusterName: string; logLineTimestamp: string; } function InfraMetrics({ podName, nodeName, hostName, clusterName, logLineTimestamp, }: MetricsDataProps): JSX.Element { const [selectedView, setSelectedView] = useState(() => podName ? VIEW_TYPES.POD : VIEW_TYPES.NODE, ); const handleModeChange = (e: RadioChangeEvent): void => { setSelectedView(e.target.value); }; if (!podName && !nodeName && !hostName) { return (
); } return (
Node {podName && (
Pod
)} {/* TODO(Rahul): Make a common config driven component for this and other infra metrics components */} {selectedView === VIEW_TYPES.NODE && ( )} {selectedView === VIEW_TYPES.POD && podName && ( )} ); } export default InfraMetrics;