import { AlertTriangle, Code, History, Minimize2 } from 'lucide-react'; import { useCurrentStateAndParams } from '@uirouter/react'; import LaptopCode from '@/assets/ico/laptop-code.svg?c'; import { PageHeader } from '@@/PageHeader'; import { Tab, WidgetTabs, findSelectedTabIndex } from '@@/Widget/WidgetTabs'; import { Icon } from '@@/Icon'; import { Badge } from '@@/Badge'; import { EventsDatatable } from '../../components/KubernetesEventsDatatable'; import { PlacementsDatatable, usePlacementTableData, usePlacementTableState, } from './PlacementsDatatable'; import { ApplicationDetailsWidget } from './ApplicationDetailsWidget'; import { ApplicationSummaryWidget } from './ApplicationSummaryWidget'; import { ApplicationContainersDatatable } from './ApplicationContainersDatatable'; import { useApplicationEventsTableData, useApplicationEventsTableState, } from './useApplicationEventsTableData'; import { ApplicationYAMLEditor } from './AppYAMLEditor/ApplicationYAMLEditor'; import { useApplicationYAML } from './AppYAMLEditor/useApplicationYAML'; export function ApplicationDetailsView() { const stateAndParams = useCurrentStateAndParams(); const { params: { namespace, name }, } = stateAndParams; // placements table data const { placementsData, isPlacementsTableLoading, hasPlacementWarning } = usePlacementTableData(); const placementsTableState = usePlacementTableState(); // events table data const { appEventsData, appEventWarningCount, isAppEventsTableLoading } = useApplicationEventsTableData(); const appEventsTableState = useApplicationEventsTableState(); // load app yaml data early to load from cache later useApplicationYAML(); const tabs: Tab[] = [ { name: 'Application', icon: LaptopCode, widget: , selectedTabParam: 'application', }, { name: (
Placement {hasPlacementWarning && ( 1 )}
), icon: Minimize2, widget: ( ), selectedTabParam: 'placement', }, { name: (
Events {appEventWarningCount >= 1 && ( {appEventWarningCount} )}
), icon: History, widget: ( ), selectedTabParam: 'events', }, { name: 'YAML', icon: Code, widget: , selectedTabParam: 'YAML', }, ]; const currentTabIndex = findSelectedTabIndex(stateAndParams, tabs); return ( <> <> {tabs[currentTabIndex].widget} ); }