From 5f3abf95916f4f2bb4394db7cf2d72714dd90fef Mon Sep 17 00:00:00 2001 From: amhsirak Date: Thu, 9 Jan 2025 22:37:05 +0530 Subject: [PATCH 01/23] chore: lint --- src/pages/PageWrappper.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/pages/PageWrappper.tsx b/src/pages/PageWrappper.tsx index cb1b382e..fef40186 100644 --- a/src/pages/PageWrappper.tsx +++ b/src/pages/PageWrappper.tsx @@ -51,9 +51,9 @@ export const PageWrapper = () => { - + {!browserId && } - + }> } /> From 1f3646a3d48e76b8f436bd478276595cd24f470a Mon Sep 17 00:00:00 2001 From: amhsirak Date: Thu, 9 Jan 2025 22:37:25 +0530 Subject: [PATCH 02/23] chore: whitespace --- src/pages/PageWrappper.tsx | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/pages/PageWrappper.tsx b/src/pages/PageWrappper.tsx index fef40186..642b31bd 100644 --- a/src/pages/PageWrappper.tsx +++ b/src/pages/PageWrappper.tsx @@ -51,9 +51,7 @@ export const PageWrapper = () => { - {!browserId && } - }> } /> From 219913b99a8e494261e1042b5e1b157087398a6b Mon Sep 17 00:00:00 2001 From: amhsirak Date: Thu, 9 Jan 2025 22:38:27 +0530 Subject: [PATCH 03/23] chore: remove unused import --- src/pages/PageWrappper.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/src/pages/PageWrappper.tsx b/src/pages/PageWrappper.tsx index 642b31bd..7a6b06d2 100644 --- a/src/pages/PageWrappper.tsx +++ b/src/pages/PageWrappper.tsx @@ -12,7 +12,6 @@ import Login from './Login'; import Register from './Register'; import UserRoute from '../routes/userRoute'; import { Routes, Route, useNavigate } from 'react-router-dom'; -import { AppBar } from '@mui/material'; export const PageWrapper = () => { const [open, setOpen] = useState(false); From 3e9913dc981b7b1599ad7931a7065baf91b996be Mon Sep 17 00:00:00 2001 From: amhsirak Date: Thu, 9 Jan 2025 22:51:59 +0530 Subject: [PATCH 04/23] feat: initialContent prop types --- src/pages/MainPage.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/src/pages/MainPage.tsx b/src/pages/MainPage.tsx index 971e1259..0087d1b3 100644 --- a/src/pages/MainPage.tsx +++ b/src/pages/MainPage.tsx @@ -18,6 +18,7 @@ import { apiUrl } from "../apiConfig"; interface MainPageProps { handleEditRecording: (id: string, fileName: string) => void; + initialContent: string; } export interface CreateRunResponse { From 3694c95c334b19b972b856192acc18fc09caf66e Mon Sep 17 00:00:00 2001 From: amhsirak Date: Thu, 9 Jan 2025 22:52:20 +0530 Subject: [PATCH 05/23] feat: initialContent prop --- src/pages/MainPage.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/MainPage.tsx b/src/pages/MainPage.tsx index 0087d1b3..052a9d34 100644 --- a/src/pages/MainPage.tsx +++ b/src/pages/MainPage.tsx @@ -31,7 +31,7 @@ export interface ScheduleRunResponse { runId: string; } -export const MainPage = ({ handleEditRecording }: MainPageProps) => { +export const MainPage = ({ handleEditRecording, initialContent }: MainPageProps) => { const { t } = useTranslation(); const [content, setContent] = React.useState('recordings'); const [sockets, setSockets] = React.useState([]); From f9a23383add5b9e0a27b78e4f8b4071cb8c7ae22 Mon Sep 17 00:00:00 2001 From: amhsirak Date: Thu, 9 Jan 2025 22:53:46 +0530 Subject: [PATCH 06/23] feat: set content based on initialContent prop --- src/pages/MainPage.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/MainPage.tsx b/src/pages/MainPage.tsx index 052a9d34..17b4bb65 100644 --- a/src/pages/MainPage.tsx +++ b/src/pages/MainPage.tsx @@ -33,7 +33,7 @@ export interface ScheduleRunResponse { export const MainPage = ({ handleEditRecording, initialContent }: MainPageProps) => { const { t } = useTranslation(); - const [content, setContent] = React.useState('recordings'); + const [content, setContent] = React.useState(initialContent); const [sockets, setSockets] = React.useState([]); const [runningRecordingId, setRunningRecordingId] = React.useState(''); const [runningRecordingName, setRunningRecordingName] = React.useState(''); From dda2aef2f94e17c26841534a03851680eb88dcbb Mon Sep 17 00:00:00 2001 From: amhsirak Date: Thu, 9 Jan 2025 23:13:03 +0530 Subject: [PATCH 07/23] feat: navigate main menu based on route --- src/components/dashboard/MainMenu.tsx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/components/dashboard/MainMenu.tsx b/src/components/dashboard/MainMenu.tsx index 463d66a3..69dace0d 100644 --- a/src/components/dashboard/MainMenu.tsx +++ b/src/components/dashboard/MainMenu.tsx @@ -2,6 +2,7 @@ import React from 'react'; import Tabs from '@mui/material/Tabs'; import Tab from '@mui/material/Tab'; import Box from '@mui/material/Box'; +import { useNavigate } from 'react-router-dom'; import { Paper, Button, useTheme } from "@mui/material"; import { AutoAwesome, FormatListBulleted, VpnKey, Usb, Article, CloudQueue, Code, } from "@mui/icons-material"; import { apiUrl } from "../../apiConfig"; @@ -16,6 +17,7 @@ interface MainMenuProps { export const MainMenu = ({ value = 'recordings', handleChangeContent }: MainMenuProps) => { const theme = useTheme(); const { t } = useTranslation(); + const navigate = useNavigate(); const handleChange = (event: React.SyntheticEvent, newValue: string) => { handleChangeContent(newValue); From 200cc8e3fccbef4024896fb24e4eb6f089ac4d07 Mon Sep 17 00:00:00 2001 From: amhsirak Date: Thu, 9 Jan 2025 23:13:39 +0530 Subject: [PATCH 08/23] feat: routes for api, proxy, robot, run --- src/pages/PageWrappper.tsx | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/pages/PageWrappper.tsx b/src/pages/PageWrappper.tsx index 7a6b06d2..0086d230 100644 --- a/src/pages/PageWrappper.tsx +++ b/src/pages/PageWrappper.tsx @@ -11,7 +11,8 @@ import { AlertSnackbar } from "../components/ui/AlertSnackbar"; import Login from './Login'; import Register from './Register'; import UserRoute from '../routes/userRoute'; -import { Routes, Route, useNavigate } from 'react-router-dom'; +import { Routes, Route, useNavigate, Navigate } from 'react-router-dom'; +import { Runs } from '../components/run/Runs'; export const PageWrapper = () => { const [open, setOpen] = useState(false); @@ -53,8 +54,12 @@ export const PageWrapper = () => { {!browserId && } }> - } /> - + } /> + } /> + } /> + } /> + } /> + }> From c76be5892e86cad025e0a3e1433949e9c6797957 Mon Sep 17 00:00:00 2001 From: amhsirak Date: Thu, 9 Jan 2025 23:14:03 +0530 Subject: [PATCH 09/23] fix: navigate to new value --- src/components/dashboard/MainMenu.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/src/components/dashboard/MainMenu.tsx b/src/components/dashboard/MainMenu.tsx index 69dace0d..f84ecc73 100644 --- a/src/components/dashboard/MainMenu.tsx +++ b/src/components/dashboard/MainMenu.tsx @@ -20,6 +20,7 @@ export const MainMenu = ({ value = 'recordings', handleChangeContent }: MainMenu const navigate = useNavigate(); const handleChange = (event: React.SyntheticEvent, newValue: string) => { + navigate(`/${newValue}`); handleChangeContent(newValue); }; From 9458c1d06ba9de2c59282c0c4407da3eb14cd477 Mon Sep 17 00:00:00 2001 From: amhsirak Date: Thu, 9 Jan 2025 23:14:26 +0530 Subject: [PATCH 10/23] chore: lint --- src/pages/PageWrappper.tsx | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/pages/PageWrappper.tsx b/src/pages/PageWrappper.tsx index 0086d230..8e42e050 100644 --- a/src/pages/PageWrappper.tsx +++ b/src/pages/PageWrappper.tsx @@ -54,12 +54,12 @@ export const PageWrapper = () => { {!browserId && } }> - } /> - } /> - } /> - } /> - } /> - + } /> + } /> + } /> + } /> + } /> + }> From 6c599da661f646f1132b1639ed39765ef8abe2ee Mon Sep 17 00:00:00 2001 From: amhsirak Date: Thu, 9 Jan 2025 23:17:37 +0530 Subject: [PATCH 11/23] feat: set switch case to robots --- src/pages/MainPage.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/MainPage.tsx b/src/pages/MainPage.tsx index 17b4bb65..b9a4f24f 100644 --- a/src/pages/MainPage.tsx +++ b/src/pages/MainPage.tsx @@ -124,7 +124,7 @@ export const MainPage = ({ handleEditRecording, initialContent }: MainPageProps) const DisplayContent = () => { switch (content) { - case 'recordings': + case 'robots': return Date: Thu, 9 Jan 2025 23:17:58 +0530 Subject: [PATCH 12/23] feat: set tab value to robots --- src/components/dashboard/MainMenu.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/dashboard/MainMenu.tsx b/src/components/dashboard/MainMenu.tsx index f84ecc73..df7b41ae 100644 --- a/src/components/dashboard/MainMenu.tsx +++ b/src/components/dashboard/MainMenu.tsx @@ -14,7 +14,7 @@ interface MainMenuProps { handleChangeContent: (newValue: string) => void; } -export const MainMenu = ({ value = 'recordings', handleChangeContent }: MainMenuProps) => { +export const MainMenu = ({ value = 'robots', handleChangeContent }: MainMenuProps) => { const theme = useTheme(); const { t } = useTranslation(); const navigate = useNavigate(); @@ -68,7 +68,7 @@ export const MainMenu = ({ value = 'recordings', handleChangeContent }: MainMenu textAlign: 'left', fontSize: 'medium', }} - value="recordings" + value="robots" label={t('mainmenu.recordings')} icon={} iconPosition="start" From c161e189f7fda4f79f59974ab453a9459222f203 Mon Sep 17 00:00:00 2001 From: amhsirak Date: Thu, 9 Jan 2025 23:18:18 +0530 Subject: [PATCH 13/23] feat: set route path /robots --- src/pages/PageWrappper.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/pages/PageWrappper.tsx b/src/pages/PageWrappper.tsx index 8e42e050..d2e482fa 100644 --- a/src/pages/PageWrappper.tsx +++ b/src/pages/PageWrappper.tsx @@ -54,8 +54,8 @@ export const PageWrapper = () => { {!browserId && } }> - } /> - } /> + } /> + } /> } /> } /> } /> From 0921bd348578ac8e8024fe87ec84fcd023213a88 Mon Sep 17 00:00:00 2001 From: amhsirak Date: Fri, 10 Jan 2025 11:22:49 +0530 Subject: [PATCH 14/23] feat: routing for robot --- src/components/robot/Recordings.tsx | 261 +++++++++++----------------- 1 file changed, 98 insertions(+), 163 deletions(-) diff --git a/src/components/robot/Recordings.tsx b/src/components/robot/Recordings.tsx index c05ea261..46484cb1 100644 --- a/src/components/robot/Recordings.tsx +++ b/src/components/robot/Recordings.tsx @@ -1,12 +1,13 @@ -import React, { useState } from 'react'; +import React, { useState } from "react"; import { RecordingsTable } from "./RecordingsTable"; import { Grid } from "@mui/material"; import { RunSettings, RunSettingsModal } from "../run/RunSettings"; import { ScheduleSettings, ScheduleSettingsModal } from "./ScheduleSettings"; import { IntegrationSettings, IntegrationSettingsModal } from "../integration/IntegrationSettings"; import { RobotSettings, RobotSettingsModal } from "./RobotSettings"; -import { RobotEditModal } from './RobotEdit'; -import { RobotDuplicationModal } from './RobotDuplicate'; +import { RobotEditModal } from "./RobotEdit"; +import { RobotDuplicationModal } from "./RobotDuplicate"; +import { useNavigate, useLocation, useParams } from "react-router-dom"; interface RecordingsProps { handleEditRecording: (id: string, fileName: string) => void; @@ -15,181 +16,115 @@ interface RecordingsProps { setRecordingInfo: (id: string, name: string) => void; } -export const Recordings = ({ handleEditRecording, handleRunRecording, setRecordingInfo, handleScheduleRecording }: RecordingsProps) => { - const [runSettingsAreOpen, setRunSettingsAreOpen] = useState(false); - const [scheduleSettingsAreOpen, setScheduleSettingsAreOpen] = useState(false); - const [integrateSettingsAreOpen, setIntegrateSettingsAreOpen] = useState(false); - const [robotSettingsAreOpen, setRobotSettingsAreOpen] = useState(false); - const [robotEditAreOpen, setRobotEditAreOpen] = useState(false); - const [robotDuplicateAreOpen, setRobotDuplicateAreOpen] = useState(false); +export const Recordings = ({ + handleEditRecording, + handleRunRecording, + setRecordingInfo, + handleScheduleRecording, +}: RecordingsProps) => { + const navigate = useNavigate(); + const location = useLocation(); + const { selectedRecordingId } = useParams(); const [params, setParams] = useState([]); - const [selectedRecordingId, setSelectedRecordingId] = useState(''); - const handleIntegrateRecording = (id: string, settings: IntegrationSettings) => { }; - const handleSettingsRecording = (id: string, settings: RobotSettings) => { }; - const handleEditRobot = (id: string, settings: RobotSettings) => { }; - const handleDuplicateRobot = (id: string, settings: RobotSettings) => { }; - const handleSettingsAndIntegrate = (id: string, name: string, params: string[]) => { - if (params.length === 0) { - setIntegrateSettingsAreOpen(true); - setRecordingInfo(id, name); - setSelectedRecordingId(id); - } else { - setParams(params); - setIntegrateSettingsAreOpen(true); - setRecordingInfo(id, name); - setSelectedRecordingId(id); - } - } - - const handleSettingsAndRun = (id: string, name: string, params: string[]) => { - if (params.length === 0) { - setRunSettingsAreOpen(true); - setRecordingInfo(id, name); - setSelectedRecordingId(id); - } else { - setParams(params); - setRunSettingsAreOpen(true); - setRecordingInfo(id, name); - setSelectedRecordingId(id); - } - } - - const handleSettingsAndSchedule = (id: string, name: string, params: string[]) => { - if (params.length === 0) { - setScheduleSettingsAreOpen(true); - setRecordingInfo(id, name); - setSelectedRecordingId(id); - } else { - setParams(params); - setScheduleSettingsAreOpen(true); - setRecordingInfo(id, name); - setSelectedRecordingId(id); - } - } - - const handleRobotSettings = (id: string, name: string, params: string[]) => { - if (params.length === 0) { - setRobotSettingsAreOpen(true); - setRecordingInfo(id, name); - setSelectedRecordingId(id); - } else { - setParams(params); - setRobotSettingsAreOpen(true); - setRecordingInfo(id, name); - setSelectedRecordingId(id); - } - } - - const handleEditRobotOption = (id: string, name: string, params: string[]) => { - if (params.length === 0) { - setRobotEditAreOpen(true); - setRecordingInfo(id, name); - setSelectedRecordingId(id); - } else { - setParams(params); - setRobotEditAreOpen(true); - setRecordingInfo(id, name); - setSelectedRecordingId(id); - } - } - - const handleDuplicateRobotOption = (id: string, name: string, params: string[]) => { - if (params.length === 0) { - setRobotDuplicateAreOpen(true); - setRecordingInfo(id, name); - setSelectedRecordingId(id); - } else { - setParams(params); - setRobotDuplicateAreOpen(true); - setRecordingInfo(id, name); - setSelectedRecordingId(id); - } - } + const handleNavigate = (path: string, id: string, name: string, params: string[]) => { + setParams(params); + setRecordingInfo(id, name); + navigate(path); + }; const handleClose = () => { setParams([]); - setRunSettingsAreOpen(false); - setRecordingInfo('', ''); - setSelectedRecordingId(''); - } + setRecordingInfo("", ""); + navigate("/robots"); // Navigate back to the main robots page + }; - const handleIntegrateClose = () => { - setParams([]); - setIntegrateSettingsAreOpen(false); - setRecordingInfo('', ''); - setSelectedRecordingId(''); - } + // Determine which modal to open based on the current route + const getCurrentModal = () => { + const currentPath = location.pathname; - const handleScheduleClose = () => { - setParams([]); - setScheduleSettingsAreOpen(false); - setRecordingInfo('', ''); - setSelectedRecordingId(''); - } - - const handleRobotSettingsClose = () => { - setParams([]); - setRobotSettingsAreOpen(false); - setRecordingInfo('', ''); - setSelectedRecordingId(''); - } - - const handleRobotEditClose = () => { - setParams([]); - setRobotEditAreOpen(false); - setRecordingInfo('', ''); - setSelectedRecordingId(''); - } - - const handleRobotDuplicateClose = () => { - setParams([]); - setRobotDuplicateAreOpen(false); - setRecordingInfo('', ''); - setSelectedRecordingId(''); - } + if (currentPath.endsWith("/run")) { + return ( + + ); + } else if (currentPath.endsWith("/schedule")) { + return ( + + ); + } else if (currentPath.endsWith("/integrate")) { + return ( + {}} + /> + ); + } else if (currentPath.endsWith("/settings")) { + return ( + {}} + /> + ); + } else if (currentPath.endsWith("/edit")) { + return ( + {}} + /> + ); + } else if (currentPath.endsWith("/duplicate")) { + return ( + {}} + /> + ); + } + return null; + }; return ( - handleRunRecording(settings)} - isTask={params.length !== 0} - params={params} - /> - handleScheduleRecording(settings)} - /> - handleIntegrateRecording(selectedRecordingId, settings)} - /> - handleSettingsRecording(selectedRecordingId, settings)} - /> - handleEditRobot(selectedRecordingId, settings)} - /> - handleDuplicateRobot(selectedRecordingId, settings)} - /> - + {getCurrentModal()} + + handleNavigate(`/robots/${id}/run`, id, name, params) + } + handleScheduleRecording={(id, name, params) => + handleNavigate(`/robots/${id}/schedule`, id, name, params) + } + handleIntegrateRecording={(id, name, params) => + handleNavigate(`/robots/${id}/integrate`, id, name, params) + } + handleSettingsRecording={(id, name, params) => + handleNavigate(`/robots/${id}/settings`, id, name, params) + } + handleEditRobot={(id, name, params) => + handleNavigate(`/robots/${id}/edit`, id, name, params) + } + handleDuplicateRobot={(id, name, params) => + handleNavigate(`/robots/${id}/duplicate`, id, name, params) + } /> ); -} \ No newline at end of file +}; From 76176a482fa8ed78cfd6df78ebe7483ac0fbd1ef Mon Sep 17 00:00:00 2001 From: amhsirak Date: Fri, 10 Jan 2025 11:23:14 +0530 Subject: [PATCH 15/23] feat: enable all robot routes /* --- src/pages/PageWrappper.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/PageWrappper.tsx b/src/pages/PageWrappper.tsx index d2e482fa..67f5cbe9 100644 --- a/src/pages/PageWrappper.tsx +++ b/src/pages/PageWrappper.tsx @@ -55,7 +55,7 @@ export const PageWrapper = () => { }> } /> - } /> + } /> } /> } /> } /> From 96423e62614655be1e95ebe954d2a212930e87a4 Mon Sep 17 00:00:00 2001 From: amhsirak Date: Fri, 10 Jan 2025 11:39:14 +0530 Subject: [PATCH 16/23] feat: use robot meta id for runs routing --- src/components/run/RunsTable.tsx | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/components/run/RunsTable.tsx b/src/components/run/RunsTable.tsx index 855f7b15..886f1058 100644 --- a/src/components/run/RunsTable.tsx +++ b/src/components/run/RunsTable.tsx @@ -12,7 +12,7 @@ import TableRow from '@mui/material/TableRow'; import { Accordion, AccordionSummary, AccordionDetails, Typography, Box, TextField } from '@mui/material'; import ExpandMoreIcon from '@mui/icons-material/ExpandMore'; import SearchIcon from '@mui/icons-material/Search'; - +import { useNavigate } from 'react-router-dom'; import { useGlobalInfoStore } from "../../context/globalInfo"; import { getStoredRuns } from "../../api/storage"; import { RunSettings } from "./RunSettings"; @@ -68,6 +68,7 @@ export const RunsTable: React.FC = ({ runningRecordingName }) => { const { t } = useTranslation(); + const navigate = useNavigate(); // Update column labels using translation if needed const translatedColumns = columns.map(column => ({ @@ -82,6 +83,12 @@ export const RunsTable: React.FC = ({ const { notify, rerenderRuns, setRerenderRuns } = useGlobalInfoStore(); + const handleAccordionChange = (robotMetaId: string, isExpanded: boolean) => { + if (isExpanded) { + navigate(`/runs/${robotMetaId}`); // Update the route when an accordion is expanded + } + }; + const handleChangePage = (event: unknown, newPage: number) => { setPage(newPage); }; @@ -155,7 +162,7 @@ export const RunsTable: React.FC = ({ {Object.entries(groupedRows).map(([id, data]) => ( - + handleAccordionChange(id, isExpanded)}> }> {data[data.length - 1].name} From 54897bfabc2507b2efdf2394220cc4177ac695ca Mon Sep 17 00:00:00 2001 From: amhsirak Date: Fri, 10 Jan 2025 11:39:32 +0530 Subject: [PATCH 17/23] feat: enable all run routes /* --- src/pages/PageWrappper.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/PageWrappper.tsx b/src/pages/PageWrappper.tsx index 67f5cbe9..d778c186 100644 --- a/src/pages/PageWrappper.tsx +++ b/src/pages/PageWrappper.tsx @@ -56,7 +56,7 @@ export const PageWrapper = () => { }> } /> } /> - } /> + } /> } /> } /> From 4f3e3ef66e3a058764fe71f75ae8f7869a60f34b Mon Sep 17 00:00:00 2001 From: amhsirak Date: Fri, 10 Jan 2025 12:27:47 +0530 Subject: [PATCH 18/23] feat: routes for independent runs --- src/components/run/ColapsibleRow.tsx | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/src/components/run/ColapsibleRow.tsx b/src/components/run/ColapsibleRow.tsx index 9612458b..30561e2c 100644 --- a/src/components/run/ColapsibleRow.tsx +++ b/src/components/run/ColapsibleRow.tsx @@ -11,6 +11,7 @@ import { GenericModal } from "../ui/GenericModal"; import { modalStyle } from "../recorder/AddWhereCondModal"; import { getUserById } from "../../api/auth"; import { useTranslation } from "react-i18next"; +import { useNavigate, useParams } from "react-router-dom"; interface RunTypeChipProps { runByUserId?: string; @@ -37,6 +38,7 @@ interface CollapsibleRowProps { } export const CollapsibleRow = ({ row, handleDelete, isOpen, currentLog, abortRunHandler, runningRecordingName }: CollapsibleRowProps) => { const { t } = useTranslation(); + const navigate = useNavigate(); const [open, setOpen] = useState(isOpen); const [openSettingsModal, setOpenSettingsModal] = useState(false); const [userEmail, setUserEmail] = useState(null); @@ -47,6 +49,8 @@ export const CollapsibleRow = ({ row, handleDelete, isOpen, currentLog, abortRun : row.runByAPI ? 'API' : 'Unknown'; + + const { robotMetaId, runId } = useParams(); const logEndRef = useRef(null); @@ -60,6 +64,16 @@ export const CollapsibleRow = ({ row, handleDelete, isOpen, currentLog, abortRun abortRunHandler(); } + const handleRowExpand = () => { + const newOpen = !open; + setOpen(newOpen); + if (newOpen) { + // Navigate to default tab (data) when expanding + navigate(`/runs/${robotMetaId}/run/${row.runId}`); + } + scrollToLogBottom(); + }; + useEffect(() => { scrollToLogBottom(); }, [currentLog]) @@ -83,10 +97,7 @@ export const CollapsibleRow = ({ row, handleDelete, isOpen, currentLog, abortRun { - setOpen(!open); - scrollToLogBottom(); - }} + onClick={handleRowExpand} > {open ? : } From 38a9821bb268dbbdcedc3dde3a1029a3de9ea9d9 Mon Sep 17 00:00:00 2001 From: amhsirak Date: Fri, 10 Jan 2025 12:28:35 +0530 Subject: [PATCH 19/23] feat: use row.robotMetaId --- src/components/run/ColapsibleRow.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/run/ColapsibleRow.tsx b/src/components/run/ColapsibleRow.tsx index 30561e2c..c31c6f25 100644 --- a/src/components/run/ColapsibleRow.tsx +++ b/src/components/run/ColapsibleRow.tsx @@ -50,7 +50,7 @@ export const CollapsibleRow = ({ row, handleDelete, isOpen, currentLog, abortRun ? 'API' : 'Unknown'; - const { robotMetaId, runId } = useParams(); + const { runId } = useParams(); const logEndRef = useRef(null); @@ -69,7 +69,7 @@ export const CollapsibleRow = ({ row, handleDelete, isOpen, currentLog, abortRun setOpen(newOpen); if (newOpen) { // Navigate to default tab (data) when expanding - navigate(`/runs/${robotMetaId}/run/${row.runId}`); + navigate(`/runs/${row.robotMetaId}/run/${row.runId}`); } scrollToLogBottom(); }; From ca103356a0a1e1b2a73686a223ccc521de788d93 Mon Sep 17 00:00:00 2001 From: amhsirak Date: Fri, 10 Jan 2025 12:28:52 +0530 Subject: [PATCH 20/23] feat: use row.runId --- src/components/run/ColapsibleRow.tsx | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/components/run/ColapsibleRow.tsx b/src/components/run/ColapsibleRow.tsx index c31c6f25..aaa09030 100644 --- a/src/components/run/ColapsibleRow.tsx +++ b/src/components/run/ColapsibleRow.tsx @@ -11,7 +11,7 @@ import { GenericModal } from "../ui/GenericModal"; import { modalStyle } from "../recorder/AddWhereCondModal"; import { getUserById } from "../../api/auth"; import { useTranslation } from "react-i18next"; -import { useNavigate, useParams } from "react-router-dom"; +import { useNavigate } from "react-router-dom"; interface RunTypeChipProps { runByUserId?: string; @@ -50,8 +50,6 @@ export const CollapsibleRow = ({ row, handleDelete, isOpen, currentLog, abortRun ? 'API' : 'Unknown'; - const { runId } = useParams(); - const logEndRef = useRef(null); const scrollToLogBottom = () => { From 409f4b2d3365147873d8953b6d20e384de335d7d Mon Sep 17 00:00:00 2001 From: amhsirak Date: Fri, 10 Jan 2025 12:32:46 +0530 Subject: [PATCH 21/23] feat: navigate to robot run list on expand close --- src/components/run/ColapsibleRow.tsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/components/run/ColapsibleRow.tsx b/src/components/run/ColapsibleRow.tsx index aaa09030..362ac1c7 100644 --- a/src/components/run/ColapsibleRow.tsx +++ b/src/components/run/ColapsibleRow.tsx @@ -66,12 +66,13 @@ export const CollapsibleRow = ({ row, handleDelete, isOpen, currentLog, abortRun const newOpen = !open; setOpen(newOpen); if (newOpen) { - // Navigate to default tab (data) when expanding navigate(`/runs/${row.robotMetaId}/run/${row.runId}`); + } else { + navigate(`/runs/${row.robotMetaId}`); } scrollToLogBottom(); }; - + useEffect(() => { scrollToLogBottom(); }, [currentLog]) From e0320bcac1bfeb14e9f86ae0bff2d26bef439b63 Mon Sep 17 00:00:00 2001 From: amhsirak Date: Fri, 10 Jan 2025 12:33:39 +0530 Subject: [PATCH 22/23] feat: disable scroll log to bottom --- src/components/run/ColapsibleRow.tsx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/components/run/ColapsibleRow.tsx b/src/components/run/ColapsibleRow.tsx index 362ac1c7..8cf27d6d 100644 --- a/src/components/run/ColapsibleRow.tsx +++ b/src/components/run/ColapsibleRow.tsx @@ -70,12 +70,12 @@ export const CollapsibleRow = ({ row, handleDelete, isOpen, currentLog, abortRun } else { navigate(`/runs/${row.robotMetaId}`); } - scrollToLogBottom(); + //scrollToLogBottom(); }; - useEffect(() => { - scrollToLogBottom(); - }, [currentLog]) + // useEffect(() => { + // scrollToLogBottom(); + // }, [currentLog]) useEffect(() => { const fetchUserEmail = async () => { From 6d6ef21d69488a3274893c6d6e9a6c4f177a6d02 Mon Sep 17 00:00:00 2001 From: amhsirak Date: Fri, 10 Jan 2025 12:36:26 +0530 Subject: [PATCH 23/23] feat: navigate to robot runs on expand close --- src/components/run/RunsTable.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/components/run/RunsTable.tsx b/src/components/run/RunsTable.tsx index 886f1058..b652aef0 100644 --- a/src/components/run/RunsTable.tsx +++ b/src/components/run/RunsTable.tsx @@ -85,7 +85,9 @@ export const RunsTable: React.FC = ({ const handleAccordionChange = (robotMetaId: string, isExpanded: boolean) => { if (isExpanded) { - navigate(`/runs/${robotMetaId}`); // Update the route when an accordion is expanded + navigate(`/runs/${robotMetaId}`); + } else { + navigate(`/runs`); } };