feat: redirect to nested run on robot run

This commit is contained in:
Rohit
2025-01-29 23:52:00 +05:30
parent 98ba9623c5
commit 737e0cb8fc

View File

@@ -15,6 +15,7 @@ import { ScheduleSettings } from "../components/robot/ScheduleSettings";
import { IntegrationSettings } from "../components/integration/IntegrationSettings";
import { RobotSettings } from "../components/robot/RobotSettings";
import { apiUrl } from "../apiConfig";
import { useNavigate } from 'react-router-dom';
interface MainPageProps {
handleEditRecording: (id: string, fileName: string) => void;
@@ -24,6 +25,7 @@ interface MainPageProps {
export interface CreateRunResponse {
browserId: string;
runId: string;
robotMetaId: string;
}
export interface ScheduleRunResponse {
@@ -40,12 +42,14 @@ export const MainPage = ({ handleEditRecording, initialContent }: MainPageProps)
const [currentInterpretationLog, setCurrentInterpretationLog] = React.useState('');
const [ids, setIds] = React.useState<CreateRunResponse>({
browserId: '',
runId: ''
runId: '',
robotMetaId: ''
});
let aborted = false;
const { notify, setRerenderRuns, setRecordingId } = useGlobalInfoStore();
const navigate = useNavigate();
const abortRunHandler = (runId: string) => {
aborted = true;
@@ -88,8 +92,9 @@ export const MainPage = ({ handleEditRecording, initialContent }: MainPageProps)
}, [currentInterpretationLog])
const handleRunRecording = useCallback((settings: RunSettings) => {
createRunForStoredRecording(runningRecordingId, settings).then(({ browserId, runId }: CreateRunResponse) => {
setIds({ browserId, runId });
createRunForStoredRecording(runningRecordingId, settings).then(({ browserId, runId, robotMetaId }: CreateRunResponse) => {
setIds({ browserId, runId, robotMetaId });
navigate(`/runs/${robotMetaId}/run/${runId}`);
const socket =
io(`${apiUrl}/${browserId}`, {
transports: ["websocket"],