Merge pull request #417 from getmaxun/show-run
feat: display currently running robot run
This commit is contained in:
@@ -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();
|
||||
};
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ import TableRow from '@mui/material/TableRow';
|
||||
import { Accordion, AccordionSummary, AccordionDetails, Typography, Box, TextField, CircularProgress, Tooltip } from '@mui/material';
|
||||
import ExpandMoreIcon from '@mui/icons-material/ExpandMore';
|
||||
import SearchIcon from '@mui/icons-material/Search';
|
||||
import { useNavigate } from 'react-router-dom';
|
||||
import { useLocation, useNavigate } from 'react-router-dom';
|
||||
import { useGlobalInfoStore } from "../../context/globalInfo";
|
||||
import { getStoredRuns } from "../../api/storage";
|
||||
import { RunSettings } from "./RunSettings";
|
||||
@@ -85,6 +85,21 @@ export const RunsTable: React.FC<RunsTableProps> = ({
|
||||
}) => {
|
||||
const { t } = useTranslation();
|
||||
const navigate = useNavigate();
|
||||
const location = useLocation();
|
||||
|
||||
const getUrlParams = () => {
|
||||
const match = location.pathname.match(/\/runs\/([^\/]+)(?:\/run\/([^\/]+))?/);
|
||||
return {
|
||||
robotMetaId: match?.[1] || null,
|
||||
urlRunId: match?.[2] || null
|
||||
};
|
||||
};
|
||||
|
||||
const { robotMetaId: urlRobotMetaId, urlRunId } = getUrlParams();
|
||||
|
||||
const isAccordionExpanded = useCallback((currentRobotMetaId: string) => {
|
||||
return currentRobotMetaId === urlRobotMetaId;
|
||||
}, [urlRobotMetaId]);
|
||||
|
||||
const [accordionPage, setAccordionPage] = useState(0);
|
||||
const [accordionsPerPage, setAccordionsPerPage] = useState(10);
|
||||
@@ -314,10 +329,11 @@ export const RunsTable: React.FC<RunsTableProps> = ({
|
||||
key={`row-${row.id}`}
|
||||
row={row}
|
||||
handleDelete={handleDelete}
|
||||
isOpen={runId === row.runId && runningRecordingName === row.name}
|
||||
isOpen={urlRunId === row.runId || (runId === row.runId && runningRecordingName === row.name)}
|
||||
currentLog={currentInterpretationLog}
|
||||
abortRunHandler={abortRunHandler}
|
||||
runningRecordingName={runningRecordingName}
|
||||
urlRunId={urlRunId}
|
||||
/>
|
||||
));
|
||||
}, [paginationStates, runId, runningRecordingName, currentInterpretationLog, abortRunHandler, handleDelete, accordionSortConfigs]);
|
||||
|
||||
Reference in New Issue
Block a user