[ARVADOS-WORKBENCH2] updated: 1.3.1-452-gf35559bd

Git user git at public.curoverse.com
Mon May 13 21:46:59 UTC 2019


Summary of changes:
 src/services/auth-service/auth-service.ts | 6 ++++++
 src/store/auth/auth-action.ts             | 2 ++
 2 files changed, 8 insertions(+)

       via  f35559bdd3569d836d084524ff64ed050e3c926e (commit)
      from  2a60ee742601aec7a0bc6ee832da39d834d82eb7 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.


commit f35559bdd3569d836d084524ff64ed050e3c926e
Author: Peter Amstutz <pamstutz at veritasgenetics.com>
Date:   Mon May 13 17:46:29 2019 -0400

    15064: Save/load homeCluster from localStorage.
    
    Arvados-DCO-1.1-Signed-off-by: Peter Amstutz <pamstutz at veritasgenetics.com>

diff --git a/src/services/auth-service/auth-service.ts b/src/services/auth-service/auth-service.ts
index cec0cef1..a80d89ba 100644
--- a/src/services/auth-service/auth-service.ts
+++ b/src/services/auth-service/auth-service.ts
@@ -20,6 +20,7 @@ export const USER_IS_ADMIN = 'isAdmin';
 export const USER_IS_ACTIVE = 'isActive';
 export const USER_USERNAME = 'username';
 export const USER_PREFS = 'prefs';
+export const HOME_CLUSTER = 'homeCluster';
 
 export interface UserDetailsResponse {
     email: string;
@@ -42,6 +43,7 @@ export class AuthService {
 
     public saveApiToken(token: string) {
         localStorage.setItem(API_TOKEN_KEY, token);
+        localStorage.setItem(HOME_CLUSTER, token.split('/')[1].substr(0, 5));
     }
 
     public removeApiToken() {
@@ -52,6 +54,10 @@ export class AuthService {
         return localStorage.getItem(API_TOKEN_KEY) || undefined;
     }
 
+    public getHomeCluster() {
+        return localStorage.getItem(HOME_CLUSTER) || undefined;
+    }
+
     public getUuid() {
         return localStorage.getItem(USER_UUID_KEY) || undefined;
     }
diff --git a/src/store/auth/auth-action.ts b/src/store/auth/auth-action.ts
index c06e064e..7ebbbaa6 100644
--- a/src/store/auth/auth-action.ts
+++ b/src/store/auth/auth-action.ts
@@ -50,10 +50,12 @@ function removeAuthorizationHeader(client: AxiosInstance) {
 export const initAuth = (config: Config) => (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => {
     const user = services.authService.getUser();
     const token = services.authService.getApiToken();
+    const homeCluster = services.authService.getHomeCluster();
     if (token) {
         setAuthorizationHeader(services, token);
     }
     dispatch(authActions.CONFIG({ config }));
+    dispatch(authActions.SET_HOME_CLUSTER(homeCluster || config.uuidPrefix));
     if (token && user) {
         dispatch(authActions.INIT({ user, token }));
         dispatch<any>(initSessions(services.authService, config, user));

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list