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