feat: routes for independent runs
This commit is contained in:
@@ -11,6 +11,7 @@ import { GenericModal } from "../ui/GenericModal";
|
|||||||
import { modalStyle } from "../recorder/AddWhereCondModal";
|
import { modalStyle } from "../recorder/AddWhereCondModal";
|
||||||
import { getUserById } from "../../api/auth";
|
import { getUserById } from "../../api/auth";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
|
import { useNavigate, useParams } from "react-router-dom";
|
||||||
|
|
||||||
interface RunTypeChipProps {
|
interface RunTypeChipProps {
|
||||||
runByUserId?: string;
|
runByUserId?: string;
|
||||||
@@ -37,6 +38,7 @@ interface CollapsibleRowProps {
|
|||||||
}
|
}
|
||||||
export const CollapsibleRow = ({ row, handleDelete, isOpen, currentLog, abortRunHandler, runningRecordingName }: CollapsibleRowProps) => {
|
export const CollapsibleRow = ({ row, handleDelete, isOpen, currentLog, abortRunHandler, runningRecordingName }: CollapsibleRowProps) => {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
|
const navigate = useNavigate();
|
||||||
const [open, setOpen] = useState(isOpen);
|
const [open, setOpen] = useState(isOpen);
|
||||||
const [openSettingsModal, setOpenSettingsModal] = useState(false);
|
const [openSettingsModal, setOpenSettingsModal] = useState(false);
|
||||||
const [userEmail, setUserEmail] = useState<string | null>(null);
|
const [userEmail, setUserEmail] = useState<string | null>(null);
|
||||||
@@ -47,6 +49,8 @@ export const CollapsibleRow = ({ row, handleDelete, isOpen, currentLog, abortRun
|
|||||||
: row.runByAPI
|
: row.runByAPI
|
||||||
? 'API'
|
? 'API'
|
||||||
: 'Unknown';
|
: 'Unknown';
|
||||||
|
|
||||||
|
const { robotMetaId, runId } = useParams();
|
||||||
|
|
||||||
const logEndRef = useRef<HTMLDivElement | null>(null);
|
const logEndRef = useRef<HTMLDivElement | null>(null);
|
||||||
|
|
||||||
@@ -60,6 +64,16 @@ export const CollapsibleRow = ({ row, handleDelete, isOpen, currentLog, abortRun
|
|||||||
abortRunHandler();
|
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(() => {
|
useEffect(() => {
|
||||||
scrollToLogBottom();
|
scrollToLogBottom();
|
||||||
}, [currentLog])
|
}, [currentLog])
|
||||||
@@ -83,10 +97,7 @@ export const CollapsibleRow = ({ row, handleDelete, isOpen, currentLog, abortRun
|
|||||||
<IconButton
|
<IconButton
|
||||||
aria-label="expand row"
|
aria-label="expand row"
|
||||||
size="small"
|
size="small"
|
||||||
onClick={() => {
|
onClick={handleRowExpand}
|
||||||
setOpen(!open);
|
|
||||||
scrollToLogBottom();
|
|
||||||
}}
|
|
||||||
>
|
>
|
||||||
{open ? <KeyboardArrowUp /> : <KeyboardArrowDown />}
|
{open ? <KeyboardArrowUp /> : <KeyboardArrowDown />}
|
||||||
</IconButton>
|
</IconButton>
|
||||||
|
|||||||
Reference in New Issue
Block a user