Merge branch 'develop' into abort-fix

This commit is contained in:
Rohit
2025-06-12 23:30:23 +05:30
committed by GitHub
12 changed files with 471 additions and 220 deletions

View File

@@ -52,16 +52,51 @@ export const MainPage = ({ handleEditRecording, initialContent }: MainPageProps)
const navigate = useNavigate();
const abortRunHandler = (runId: string, robotName: string, browserId: string) => {
notify('info', t('main_page.notifications.abort_initiated', { name: robotName }));
aborted = true;
notifyAboutAbort(runId).then(async (response) => {
if (response) {
notify('success', t('main_page.notifications.abort_success', { name: robotName }));
await stopRecording(ids.browserId);
} else {
if (!response.success) {
notify('error', t('main_page.notifications.abort_failed', { name: robotName }));
setRerenderRuns(true);
return;
}
setRerenderRuns(true);
})
if (response.isQueued) {
setRerenderRuns(true);
notify('success', t('main_page.notifications.abort_success', { name: robotName }));
setQueuedRuns(prev => {
const newSet = new Set(prev);
newSet.delete(runId);
return newSet;
});
return;
}
const abortSocket = io(`${apiUrl}/${browserId}`, {
transports: ["websocket"],
rejectUnauthorized: false
});
abortSocket.on('run-aborted', (abortData) => {
if (abortData.runId === runId) {
notify('success', t('main_page.notifications.abort_success', { name: abortData.robotName || robotName }));
setRerenderRuns(true);
abortSocket.disconnect();
}
});
abortSocket.on('connect_error', (error) => {
console.log('Abort socket connection error:', error);
notify('error', t('main_page.notifications.abort_failed', { name: robotName }));
setRerenderRuns(true);
abortSocket.disconnect();
});
});
}
const setRecordingInfo = (id: string, name: string) => {