diff --git a/ui100/src/ApiConsole.tsx b/ui100/src/ApiConsole.tsx index 50496b47..5779de08 100644 --- a/ui100/src/ApiConsole.tsx +++ b/ui100/src/ApiConsole.tsx @@ -1,4 +1,4 @@ -import {useCallback, useEffect, useRef, useState} from "react"; +import {JSX, useCallback, useEffect, useRef, useState} from "react"; import {Configuration, MetadataApi} from "./api"; import {layout, mergeVisualOverview, nodesEqual, VisualOverview} from "./model/visualizer.ts"; import {Grid2} from "@mui/material"; @@ -25,7 +25,7 @@ const ApiConsole = ({ logout }: ApiConsoleProps) => { const selectedNode = useStore((state) => state.selectedNode); const updateEnvironments = useStore((state) => state.updateEnvironments); const [mainPanel, setMainPanel] = useState(); - const [sidePanel, setSidePanel] = useState(<>); + const [sidePanel, setSidePanel] = useState(null); let showVisualizer = true; const handleKeyPress = useCallback((event) => { @@ -135,10 +135,12 @@ const ApiConsole = ({ logout }: ApiConsoleProps) => { break; } } else { - setSidePanel(<>); + setSidePanel(null); } }, [selectedNode]); + let wrappedSidePanel = sidePanel ? {sidePanel} : null; + return (
@@ -146,9 +148,7 @@ const ApiConsole = ({ logout }: ApiConsoleProps) => { {mainPanel} - - {sidePanel} - + {wrappedSidePanel}
); diff --git a/ui100/src/TabularView.tsx b/ui100/src/TabularView.tsx index 2dba19d5..3db28c78 100644 --- a/ui100/src/TabularView.tsx +++ b/ui100/src/TabularView.tsx @@ -11,6 +11,7 @@ import {Node} from "@xyflow/react"; const TabularView = () => { const nodes = useStore((state) => state.nodes); + const updateNodes = useStore((state) => state.updateNodes); const selectedNode = useStore((state) => state.selectedNode); const updateSelectedNode = useStore((state) => state.updateSelectedNode); const [rowSelection, setRowSelection] = useState({}); @@ -25,7 +26,9 @@ const TabularView = () => { useEffect(() => { let sn = nodes.find(node => Object.keys(rowSelection).includes(node.id)); + console.log("sn", sn); updateSelectedNode(sn); + updateNodes(nodes.map(node => (sn && node.id === sn.id) ? { ...node, selected: true } : { ...node, selected: false })); }, [rowSelection]); const columns = useMemo[]>( @@ -52,7 +55,12 @@ const TabularView = () => { state: { rowSelection }, muiTableBodyRowProps: ({ row }) => ({ onClick: () => { - setRowSelection({[row.id]: true}) + if(rowSelection[row.id]) { + setRowSelection({}); + } else { + setRowSelection({[row.id]: true}); + } + }, selected: rowSelection[row.id], sx: {