import React from 'react'; import { Cluster, ClusterFeaturesEnum } from 'generated-sources'; import { clusterBrokersPath, clusterTopicsPath, clusterConsumerGroupsPath, clusterSchemasPath, clusterConnectorsPath, clusterConnectsPath, clusterKsqlDbPath, } from 'lib/paths'; import ClusterMenuItem from './ClusterMenuItem'; import ClusterTab from './ClusterTab/ClusterTab'; import * as S from './Nav.styled'; interface Props { cluster: Cluster; singleMode?: boolean; } const ClusterMenu: React.FC = ({ cluster: { name, status, features }, singleMode, }) => { const hasFeatureConfigured = (key: ClusterFeaturesEnum) => features?.includes(key); const [isOpen, setIsOpen] = React.useState(!!singleMode); return ( setIsOpen((prev) => !prev)} /> {isOpen && ( {hasFeatureConfigured(ClusterFeaturesEnum.SCHEMA_REGISTRY) && ( )} {hasFeatureConfigured(ClusterFeaturesEnum.KAFKA_CONNECT) && ( location.pathname.startsWith(clusterConnectsPath(name)) || location.pathname.startsWith(clusterConnectorsPath(name)) } /> )} {hasFeatureConfigured(ClusterFeaturesEnum.KSQL_DB) && ( )} )} ); }; export default ClusterMenu;