Merge branch '20449-processes-refresh' refs #20449 2.6-release 2.6-staging 2.6.3
authorPeter Amstutz <peter.amstutz@curii.com>
Fri, 2 Jun 2023 20:54:45 +0000 (16:54 -0400)
committerPeter Amstutz <peter.amstutz@curii.com>
Fri, 2 Jun 2023 20:54:45 +0000 (16:54 -0400)
Arvados-DCO-1.1-Signed-off-by: Peter Amstutz <peter.amstutz@curii.com>

src/components/confirmation-dialog/confirmation-dialog.tsx
src/routes/route-change-handlers.ts
src/services/common-service/common-resource-service.ts
src/store/auth/auth-middleware.ts
src/store/processes/processes-actions.ts

index 28b19bb9bb2722a9ba6683464c3df2269ba61df9..fa09ffc62dc48ac476ca88cc75850a2e9d0bde4c 100644 (file)
@@ -26,8 +26,8 @@ export const ConfirmationDialog = (props: ConfirmationDialogProps & WithDialogPr
             <DialogContent style={{ display: 'flex', alignItems: 'center' }}>
                 <WarningIcon />
                 <DialogContentText style={{ paddingLeft: '8px' }}>
-                    <div>{props.data.text}</div>
-                    <div>{props.data.info}</div>
+                    <span style={{display: 'block'}}>{props.data.text}</span>
+                    <span style={{display: 'block'}}>{props.data.info}</span>
                 </DialogContentText>
             </DialogContent>
             <DialogActions style={{ margin: '0px 24px 24px' }}>
index eef52058529b69acd74f17416552561382487e03..bdc1ddc06325bb473dc7493595df0f42fd56c5a7 100644 (file)
@@ -60,6 +60,8 @@ const handleLocationChange = (store: RootStore) => ({ pathname }: Location) => {
         }
     }
 
+    document.title = `Arvados (${store.getState().auth.config.uuidPrefix}) - ${pathname.slice(1)}`;
+
     if (projectMatch) {
         store.dispatch(openProjectPanel(projectMatch.params.id));
     } else if (collectionMatch) {
index d9be8dae9f2a402268217cd8704c0e1d5f538a48..515eb6a4b9522b38a25e74c5997bfc7c673ed3d9 100644 (file)
@@ -13,6 +13,7 @@ export enum CommonResourceServiceError {
     OWNERSHIP_CYCLE = 'OwnershipCycle',
     MODIFYING_CONTAINER_REQUEST_FINAL_STATE = 'ModifyingContainerRequestFinalState',
     NAME_HAS_ALREADY_BEEN_TAKEN = 'NameHasAlreadyBeenTaken',
+    PERMISSION_ERROR_FORBIDDEN = 'PermissionErrorForbidden',
     UNKNOWN = 'Unknown',
     NONE = 'None'
 }
@@ -64,11 +65,11 @@ export const getCommonResourceServiceError = (errorResponse: any) => {
                 return CommonResourceServiceError.MODIFYING_CONTAINER_REQUEST_FINAL_STATE;
             case /Name has already been taken/.test(error):
                 return CommonResourceServiceError.NAME_HAS_ALREADY_BEEN_TAKEN;
+            case /403 Forbidden/.test(error):
+                return CommonResourceServiceError.PERMISSION_ERROR_FORBIDDEN;
             default:
                 return CommonResourceServiceError.UNKNOWN;
         }
     }
     return CommonResourceServiceError.NONE;
 };
-
-
index eb1e42b5de74c475452647489482dc1892754740..0d08405ae11e87f329553e236e4550c0720a6fd6 100644 (file)
@@ -56,7 +56,7 @@ export const authMiddleware = (services: ServiceRepository): Middleware => store
             }
         },
         SET_CONFIG: ({ config }) => {
-            document.title = `Arvados Workbench (${config.uuidPrefix})`;
+            document.title = `Arvados (${config.uuidPrefix})`;
             next(action);
         },
         LOGOUT: ({ deleteLinkData, preservePath }) => {
index b26c2017f7552fa54c4d6e44f57ad398ff1b45ce..4a27cba6da89b4cd8a1b3ea1705cd5f646dff1fc 100644 (file)
@@ -24,6 +24,7 @@ import { CommandOutputParameter } from "cwlts/mappings/v1.0/CommandOutputParamet
 import { ContainerResource } from "models/container";
 import { ContainerRequestResource, ContainerRequestState } from "models/container-request";
 import { FilterBuilder } from "services/api/filter-builder";
+import { CommonResourceServiceError, getCommonResourceServiceError } from "services/common-service/common-resource-service";
 
 export const loadProcess = (containerRequestUuid: string) =>
     async (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository): Promise<Process | undefined> => {
@@ -291,8 +292,17 @@ export const REMOVE_PROCESS_DIALOG = 'removeProcessDialog';
 
 export const removeProcessPermanently = (uuid: string) =>
     async (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => {
-        dispatch(snackbarActions.OPEN_SNACKBAR({ message: 'Removing ...', kind: SnackbarKind.INFO }));
-        await services.containerRequestService.delete(uuid);
-        dispatch(projectPanelActions.REQUEST_ITEMS());
-        dispatch(snackbarActions.OPEN_SNACKBAR({ message: 'Removed.', hideDuration: 2000, kind: SnackbarKind.SUCCESS }));
+        try {
+            dispatch(snackbarActions.OPEN_SNACKBAR({ message: 'Removing ...', kind: SnackbarKind.INFO }));
+            await services.containerRequestService.delete(uuid, false);
+            dispatch(projectPanelActions.REQUEST_ITEMS());
+            dispatch(snackbarActions.OPEN_SNACKBAR({ message: 'Removed.', hideDuration: 2000, kind: SnackbarKind.SUCCESS }));
+        } catch(e) {
+            const error = getCommonResourceServiceError(e);
+            if (error === CommonResourceServiceError.PERMISSION_ERROR_FORBIDDEN) {
+                dispatch(snackbarActions.OPEN_SNACKBAR({ message: `Access denied`, hideDuration: 2000, kind: SnackbarKind.ERROR }));
+            } else {
+                dispatch(snackbarActions.OPEN_SNACKBAR({ message: `Deletion failed`, hideDuration: 2000, kind: SnackbarKind.ERROR }));
+            }
+        }
     };