[ARVADOS-WORKBENCH2] created: 1.4.1-94-g39a2bbbb

Git user git at public.curoverse.com
Thu Nov 7 16:34:50 UTC 2019


        at  39a2bbbbe3099f039acf73358753f91c0dc39677 (commit)


commit 39a2bbbbe3099f039acf73358753f91c0dc39677
Author: Peter Amstutz <pamstutz at veritasgenetics.com>
Date:   Thu Nov 7 11:33:33 2019 -0500

    15803: If user is inactive, attempt to self-activate.
    
    This mimics the behavior of workbench 1, however we don't support
    displaying / signing user agreements.

diff --git a/src/services/user-service/user-service.ts b/src/services/user-service/user-service.ts
index bcf81d55..ddb9a364 100644
--- a/src/services/user-service/user-service.ts
+++ b/src/services/user-service/user-service.ts
@@ -12,6 +12,14 @@ export class UserService extends CommonResourceService<UserResource> {
         super(serverApi, "users", actions);
     }
 
+    activate(uuid: string) {
+        return CommonResourceService.defaultResponse(
+            this.serverApi
+                .post(this.resourceType + `${uuid}/activate`),
+            this.actions
+        );
+    }
+
     unsetup(uuid: string) {
         return CommonResourceService.defaultResponse(
             this.serverApi
diff --git a/src/store/auth/auth-action.ts b/src/store/auth/auth-action.ts
index 9f18b5b0..cadf3c6e 100644
--- a/src/store/auth/auth-action.ts
+++ b/src/store/auth/auth-action.ts
@@ -81,6 +81,11 @@ const init = (config: Config) => (dispatch: Dispatch, getState: () => RootState,
         dispatch<any>(initSessions(services.authService, config, user));
         dispatch<any>(getUserDetails()).then((user: User) => {
             dispatch(authActions.INIT({ user, token }));
+            if (!user.isActive) {
+                services.userService.activate(user.uuid).then((user: User) => {
+                    dispatch(authActions.INIT({ user, token }));
+                });
+            }
         }).catch((err: AxiosError) => {
             if (err.response) {
                 // Bad token

commit dd3d65aa7dea7269352eabe19096cb3dc44eb6c5
Author: Peter Amstutz <pamstutz at veritasgenetics.com>
Date:   Wed Nov 6 17:43:46 2019 -0500

    15803: toggleIsActive will use unsetup to deactivate user
    
    Also re-enables generic error reporting for API errors.

diff --git a/src/index.tsx b/src/index.tsx
index 5a941638..d4203a87 100644
--- a/src/index.tsx
+++ b/src/index.tsx
@@ -61,6 +61,7 @@ import { loadFileViewersConfig } from '~/store/file-viewers/file-viewers-actions
 import { collectionAdminActionSet } from '~/views-components/context-menu/action-sets/collection-admin-action-set';
 import { processResourceAdminActionSet } from '~/views-components/context-menu/action-sets/process-resource-admin-action-set';
 import { projectAdminActionSet } from '~/views-components/context-menu/action-sets/project-admin-action-set';
+import { snackbarActions, SnackbarKind } from "~/store/snackbar/snackbar-actions";
 
 console.log(`Starting arvados [${getBuildInfo()}]`);
 
@@ -99,8 +100,12 @@ fetchConfig()
                 store.dispatch(progressIndicatorActions.TOGGLE_WORKING({ id, working }));
             },
             errorFn: (id, error) => {
-                // console.error("Backend error:", error);
-                // store.dispatch(snackbarActions.OPEN_SNACKBAR({ message: "Backend error", kind: SnackbarKind.ERROR }));
+                console.error("Backend error:", error);
+                store.dispatch(snackbarActions.OPEN_SNACKBAR({
+                    message: `${error.errors[0]}`,
+                    kind: SnackbarKind.ERROR,
+                    hideDuration: 8000
+                }));
             }
         });
         const store = configureStore(history, services);
diff --git a/src/services/user-service/user-service.ts b/src/services/user-service/user-service.ts
index a69203dc..bcf81d55 100644
--- a/src/services/user-service/user-service.ts
+++ b/src/services/user-service/user-service.ts
@@ -11,4 +11,12 @@ export class UserService extends CommonResourceService<UserResource> {
     constructor(serverApi: AxiosInstance, actions: ApiActions) {
         super(serverApi, "users", actions);
     }
+
+    unsetup(uuid: string) {
+        return CommonResourceService.defaultResponse(
+            this.serverApi
+                .post(this.resourceType + uuid + '/unsetup'),
+            this.actions
+        );
+    }
 }
diff --git a/src/store/users/users-actions.ts b/src/store/users/users-actions.ts
index 44b2bad6..9e9f0954 100644
--- a/src/store/users/users-actions.ts
+++ b/src/store/users/users-actions.ts
@@ -109,7 +109,12 @@ export const toggleIsActive = (uuid: string) =>
         const { resources } = getState();
         const data = getResource<UserResource>(uuid)(resources);
         const isActive = data!.isActive;
-        const newActivity = await services.userService.update(uuid, { isActive: !isActive });
+        let newActivity;
+        if (isActive) {
+            newActivity = await services.userService.unsetup(uuid);
+        } else {
+            newActivity = await services.userService.update(uuid, { isActive: true });
+        }
         dispatch<any>(loadUsersPanel());
         return newActivity;
     };

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list