feat: error handling
This commit is contained in:
@@ -57,8 +57,8 @@ export const MainPage = ({ handleEditRecording }: MainPageProps) => {
|
|||||||
setRunningRecordingName(fileName);
|
setRunningRecordingName(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
const readyForRunHandler = useCallback( (browserId: string, runId: string) => {
|
const readyForRunHandler = useCallback((browserId: string, runId: string) => {
|
||||||
interpretStoredRecording(runningRecordingName, runId).then( async (interpretation: boolean) => {
|
interpretStoredRecording(runningRecordingName, runId).then(async (interpretation: boolean) => {
|
||||||
if (!aborted) {
|
if (!aborted) {
|
||||||
if (interpretation) {
|
if (interpretation) {
|
||||||
notify('success', `Interpretation of ${runningRecordingName} succeeded`);
|
notify('success', `Interpretation of ${runningRecordingName} succeeded`);
|
||||||
@@ -80,8 +80,8 @@ export const MainPage = ({ handleEditRecording }: MainPageProps) => {
|
|||||||
}, [currentInterpretationLog])
|
}, [currentInterpretationLog])
|
||||||
|
|
||||||
const handleRunRecording = useCallback((settings: RunSettings) => {
|
const handleRunRecording = useCallback((settings: RunSettings) => {
|
||||||
createRunForStoredRecording(runningRecordingName, settings).then(({browserId, runId}: CreateRunResponse) => {
|
createRunForStoredRecording(runningRecordingName, settings).then(({ browserId, runId }: CreateRunResponse) => {
|
||||||
setIds({browserId, runId});
|
setIds({ browserId, runId });
|
||||||
const socket =
|
const socket =
|
||||||
io(`http://localhost:8080/${browserId}`, {
|
io(`http://localhost:8080/${browserId}`, {
|
||||||
transports: ["websocket"],
|
transports: ["websocket"],
|
||||||
@@ -105,7 +105,7 @@ export const MainPage = ({ handleEditRecording }: MainPageProps) => {
|
|||||||
|
|
||||||
const handleScheduleRecording = (settings: ScheduleSettings) => {
|
const handleScheduleRecording = (settings: ScheduleSettings) => {
|
||||||
scheduleStoredRecording(runningRecordingName, settings)
|
scheduleStoredRecording(runningRecordingName, settings)
|
||||||
.then(({message, runId}: ScheduleRunResponse) => {
|
.then(({ message, runId }: ScheduleRunResponse) => {
|
||||||
if (message === 'success') {
|
if (message === 'success') {
|
||||||
notify('success', `Recording ${runningRecordingName} scheduled successfully`);
|
notify('success', `Recording ${runningRecordingName} scheduled successfully`);
|
||||||
} else {
|
} else {
|
||||||
@@ -115,10 +115,15 @@ export const MainPage = ({ handleEditRecording }: MainPageProps) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const handleIntegrateRecording = (settings: IntegrationSettings) => {
|
const handleIntegrateRecording = (settings: IntegrationSettings) => {
|
||||||
handleUploadCredentials(runningRecordingName, settings.credentials, settings.spreadsheetId, settings.range).then(() => {
|
handleUploadCredentials(runningRecordingName, settings.credentials, settings.spreadsheetId, settings.range)
|
||||||
console.log(settings.spreadsheetId, settings.range)
|
.then((response) => {
|
||||||
notify('success', `Data written to Google Sheet successfully`);
|
if (response) {
|
||||||
});
|
notify('success', `Service Account credentials saved successfully.`);
|
||||||
|
} else {
|
||||||
|
notify('error', `Failed to save credentials.`);
|
||||||
|
|
||||||
|
}
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
const DisplayContent = () => {
|
const DisplayContent = () => {
|
||||||
@@ -144,9 +149,9 @@ export const MainPage = ({ handleEditRecording }: MainPageProps) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Stack direction='row' spacing={0} sx={{minHeight: '800px'}}>
|
<Stack direction='row' spacing={0} sx={{ minHeight: '800px' }}>
|
||||||
<MainMenu value={content} handleChangeContent={setContent}/>
|
<MainMenu value={content} handleChangeContent={setContent} />
|
||||||
{ DisplayContent() }
|
{DisplayContent()}
|
||||||
</Stack>
|
</Stack>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user