From b4c5622604e42ef5bdf40631f91f975cf2c8b7dd Mon Sep 17 00:00:00 2001 From: Rohit Date: Wed, 29 Jan 2025 23:55:15 +0530 Subject: [PATCH] feat: display table cell on robot meta id --- src/components/run/ColapsibleRow.tsx | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/src/components/run/ColapsibleRow.tsx b/src/components/run/ColapsibleRow.tsx index 8cf27d6d..87e38684 100644 --- a/src/components/run/ColapsibleRow.tsx +++ b/src/components/run/ColapsibleRow.tsx @@ -35,8 +35,9 @@ interface CollapsibleRowProps { currentLog: string; abortRunHandler: () => void; runningRecordingName: string; + urlRunId: string | null; } -export const CollapsibleRow = ({ row, handleDelete, isOpen, currentLog, abortRunHandler, runningRecordingName }: CollapsibleRowProps) => { +export const CollapsibleRow = ({ row, handleDelete, isOpen, currentLog, abortRunHandler, runningRecordingName, urlRunId }: CollapsibleRowProps) => { const { t } = useTranslation(); const navigate = useNavigate(); const [open, setOpen] = useState(isOpen); @@ -62,14 +63,18 @@ export const CollapsibleRow = ({ row, handleDelete, isOpen, currentLog, abortRun abortRunHandler(); } + useEffect(() => { + setOpen(urlRunId === row.runId || isOpen); + }, [urlRunId, row.runId, isOpen]); + const handleRowExpand = () => { const newOpen = !open; setOpen(newOpen); - if (newOpen) { - navigate(`/runs/${row.robotMetaId}/run/${row.runId}`); - } else { - navigate(`/runs/${row.robotMetaId}`); - } + navigate( + newOpen + ? `/runs/${row.robotMetaId}/run/${row.runId}` + : `/runs/${row.robotMetaId}` + ); //scrollToLogBottom(); };