@@ -60,13 +60,13 @@ export const deleteRunFromStorage = async (id: string): Promise<boolean> => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
export const editRecordingFromStorage = async (browserId: string, robotId: string): Promise<WorkflowFile | null> => {
|
export const editRecordingFromStorage = async (browserId: string, id: string): Promise<WorkflowFile | null> => {
|
||||||
try {
|
try {
|
||||||
const response = await axios.put(`http://localhost:8080/workflow/${browserId}/${robotId}`);
|
const response = await axios.put(`http://localhost:8080/workflow/${browserId}/${id}`);
|
||||||
if (response.status === 200) {
|
if (response.status === 200) {
|
||||||
return response.data;
|
return response.data;
|
||||||
} else {
|
} else {
|
||||||
throw new Error(`Couldn't edit stored recording ${robotId}`);
|
throw new Error(`Couldn't edit stored recording ${id}`);
|
||||||
}
|
}
|
||||||
} catch(error: any) {
|
} catch(error: any) {
|
||||||
console.log(error);
|
console.log(error);
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ export const MainPage = ({ handleEditRecording }: MainPageProps) => {
|
|||||||
|
|
||||||
let aborted = false;
|
let aborted = false;
|
||||||
|
|
||||||
const { notify, setRerenderRuns } = useGlobalInfoStore();
|
const { notify, setRerenderRuns, setRecordingId } = useGlobalInfoStore();
|
||||||
|
|
||||||
const abortRunHandler = (runId: string) => {
|
const abortRunHandler = (runId: string) => {
|
||||||
aborted = true;
|
aborted = true;
|
||||||
@@ -58,6 +58,7 @@ export const MainPage = ({ handleEditRecording }: MainPageProps) => {
|
|||||||
|
|
||||||
const setRecordingInfo = (id: string, name: string) => {
|
const setRecordingInfo = (id: string, name: string) => {
|
||||||
setRunningRecordingId(id);
|
setRunningRecordingId(id);
|
||||||
|
setRecordingId(id);
|
||||||
setRunningRecordingName(name);
|
setRunningRecordingName(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ export const RecordingPage = ({ recordingName }: RecordingPageProps) => {
|
|||||||
|
|
||||||
const { setId, socket } = useSocketStore();
|
const { setId, socket } = useSocketStore();
|
||||||
const { setWidth } = useBrowserDimensionsStore();
|
const { setWidth } = useBrowserDimensionsStore();
|
||||||
const { browserId, setBrowserId } = useGlobalInfoStore();
|
const { browserId, setBrowserId, recordingId } = useGlobalInfoStore();
|
||||||
|
|
||||||
const handleShowOutputData = useCallback(() => {
|
const handleShowOutputData = useCallback(() => {
|
||||||
setShowOutputData(true);
|
setShowOutputData(true);
|
||||||
@@ -93,15 +93,15 @@ export const RecordingPage = ({ recordingName }: RecordingPageProps) => {
|
|||||||
}, [socket]);
|
}, [socket]);
|
||||||
|
|
||||||
const handleLoaded = useCallback(() => {
|
const handleLoaded = useCallback(() => {
|
||||||
if (recordingName && browserId) {
|
if (recordingName && browserId && recordingId) {
|
||||||
editRecordingFromStorage(browserId, recordingName).then(() => setIsLoaded(true));
|
editRecordingFromStorage(browserId, recordingId).then(() => setIsLoaded(true));
|
||||||
} else {
|
} else {
|
||||||
if (browserId === 'new-recording') {
|
if (browserId === 'new-recording') {
|
||||||
socket?.emit('new-recording');
|
socket?.emit('new-recording');
|
||||||
}
|
}
|
||||||
setIsLoaded(true);
|
setIsLoaded(true);
|
||||||
}
|
}
|
||||||
}, [socket, browserId, recordingName, isLoaded])
|
}, [socket, browserId, recordingName, recordingId, isLoaded])
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
socket?.on('loaded', handleLoaded);
|
socket?.on('loaded', handleLoaded);
|
||||||
|
|||||||
Reference in New Issue
Block a user