15557: Improve error handling and resposiveness when starting copied workflows
authorStephen Smith <stephen@curii.com>
Mon, 9 Jan 2023 21:09:01 +0000 (16:09 -0500)
committerStephen Smith <stephen@curii.com>
Mon, 9 Jan 2023 21:09:01 +0000 (16:09 -0500)
Arvados-DCO-1.1-Signed-off-by: Stephen Smith <stephen@curii.com>

src/store/processes/processes-actions.ts

index 11a36e0561f722d20002c1fc7ae7f011605201e7..b28b943ef11fd50dae440a1762578caf773eff82 100644 (file)
@@ -109,10 +109,14 @@ export const startWorkflow = (uuid: string) =>
     async (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => {
         try {
             const process = await services.containerRequestService.update(uuid, { priority: 1, state: ContainerRequestState.COMMITTED });
-            dispatch(snackbarActions.OPEN_SNACKBAR({ message: 'Process started', hideDuration: 2000, kind: SnackbarKind.SUCCESS }));
-            return process;
+            if (process) {
+                dispatch<any>(updateResources([process]));
+                dispatch(snackbarActions.OPEN_SNACKBAR({ message: 'Process started', hideDuration: 2000, kind: SnackbarKind.SUCCESS }));
+            } else {
+                dispatch<any>(snackbarActions.OPEN_SNACKBAR({ message: `Failed to start process`, kind: SnackbarKind.ERROR }));
+            }
         } catch (e) {
-            throw new Error('Could not cancel the process.');
+            dispatch<any>(snackbarActions.OPEN_SNACKBAR({ message: `Failed to start process`, kind: SnackbarKind.ERROR }));
         }
     };