[ARVADOS-WORKBENCH2] updated: 1.3.0-213-gdf3c8dde

Git user git at public.curoverse.com
Tue Dec 18 05:05:55 EST 2018


Summary of changes:
 src/index.tsx                                |  2 +-
 src/store/auth/auth-action-session.ts        |  9 ++++++++-
 src/store/auth/auth-action.ts                |  5 ++---
 src/views-components/api-token/api-token.tsx | 10 ++++++++--
 4 files changed, 19 insertions(+), 7 deletions(-)

       via  df3c8dde9f8ec2189fd927ff3f225c167a595002 (commit)
      from  f9dde5c781766b8be71d43d0f031c201a0edcfbb (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 df3c8dde9f8ec2189fd927ff3f225c167a595002
Author: Daniel Kos <daniel.kos at contractors.roche.com>
Date:   Tue Dec 18 11:05:52 2018 +0100

    Fix session initialization
    
    Feature #14478
    
    Arvados-DCO-1.1-Signed-off-by: Daniel Kos <daniel.kos at contractors.roche.com>

diff --git a/src/index.tsx b/src/index.tsx
index 1b7a281d..1561c3ff 100644
--- a/src/index.tsx
+++ b/src/index.tsx
@@ -109,7 +109,7 @@ fetchConfig()
         store.dispatch(loadVocabulary);
         store.dispatch(loadFileViewersConfig);
 
-        const TokenComponent = (props: any) => <ApiToken authService={services.authService} {...props} />;
+        const TokenComponent = (props: any) => <ApiToken authService={services.authService} config={config} {...props} />;
         const MainPanelComponent = (props: any) => <MainPanel {...props} />;
 
         const App = () =>
diff --git a/src/store/auth/auth-action-session.ts b/src/store/auth/auth-action-session.ts
index 83e98e96..e5e2e575 100644
--- a/src/store/auth/auth-action-session.ts
+++ b/src/store/auth/auth-action-session.ts
@@ -12,7 +12,7 @@ import { authActions } from "~/store/auth/auth-action";
 import { Config, DISCOVERY_URL } from "~/common/config";
 import { Session, SessionStatus } from "~/models/session";
 import { progressIndicatorActions } from "~/store/progress-indicator/progress-indicator-actions";
-import { UserDetailsResponse } from "~/services/auth-service/auth-service";
+import { AuthService, UserDetailsResponse } from "~/services/auth-service/auth-service";
 import * as jsSHA from "jssha";
 
 const getRemoteHostBaseUrl = async (remoteHost: string): Promise<string | null> => {
@@ -197,6 +197,13 @@ export const toggleSession = (session: Session) =>
         services.authService.saveSessions(getState().auth.sessions);
     };
 
+export const initSessions = (authService: AuthService, config: Config, user: User) =>
+    (dispatch: Dispatch<any>) => {
+        const sessions = authService.buildSessions(config, user);
+        authService.saveSessions(sessions);
+        dispatch(authActions.SET_SESSIONS(sessions));
+    };
+
 export const loadSiteManagerPanel = () =>
     async (dispatch: Dispatch<any>) => {
         try {
diff --git a/src/store/auth/auth-action.ts b/src/store/auth/auth-action.ts
index ed998ab5..6c54a5c9 100644
--- a/src/store/auth/auth-action.ts
+++ b/src/store/auth/auth-action.ts
@@ -11,6 +11,7 @@ import { SshKeyResource } from '~/models/ssh-key';
 import { User } from "~/models/user";
 import { Session } from "~/models/session";
 import { Config } from '~/common/config';
+import { initSessions } from "~/store/auth/auth-action-session";
 
 export const authActions = unionize({
     SAVE_API_TOKEN: ofType<string>(),
@@ -49,10 +50,8 @@ export const initAuth = (config: Config) => (dispatch: Dispatch, getState: () =>
     }
     if (token && user) {
         dispatch(authActions.INIT({ user, token }));
+        dispatch<any>(initSessions(services.authService, config, user));
     }
-    const sessions = services.authService.buildSessions(config, user);
-    services.authService.saveSessions(sessions);
-    dispatch(authActions.SET_SESSIONS(sessions));
 };
 
 export const saveApiToken = (token: string) => (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => {
diff --git a/src/views-components/api-token/api-token.tsx b/src/views-components/api-token/api-token.tsx
index 718d3589..43c55a92 100644
--- a/src/views-components/api-token/api-token.tsx
+++ b/src/views-components/api-token/api-token.tsx
@@ -5,13 +5,17 @@
 import { RouteProps } from "react-router";
 import * as React from "react";
 import { connect, DispatchProp } from "react-redux";
-import { getUserDetails, saveApiToken } from "~/store/auth/auth-action";
+import { authActions, getUserDetails, saveApiToken } from "~/store/auth/auth-action";
 import { getUrlParameter } from "~/common/url";
 import { AuthService } from "~/services/auth-service/auth-service";
 import { navigateToRootProject } from "~/store/navigation/navigation-action";
+import { User } from "~/models/user";
+import { Config } from "~/common/config";
+import { initSessions } from "~/store/auth/auth-action-session";
 
 interface ApiTokenProps {
     authService: AuthService;
+    config: Config;
 }
 
 export const ApiToken = connect()(
@@ -20,7 +24,9 @@ export const ApiToken = connect()(
             const search = this.props.location ? this.props.location.search : "";
             const apiToken = getUrlParameter(search, 'api_token');
             this.props.dispatch(saveApiToken(apiToken));
-            this.props.dispatch<any>(getUserDetails()).finally(() => {
+            this.props.dispatch<any>(getUserDetails()).then((user: User) => {
+                this.props.dispatch(initSessions(this.props.authService, this.props.config, user));
+            }).finally(() => {
                 this.props.dispatch(navigateToRootProject);
             });
         }

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list