[ARVADOS-WORKBENCH2] updated: 1.3.1-448-g825b555f

Git user git at public.curoverse.com
Mon May 13 18:04:12 UTC 2019


Summary of changes:
 src/services/auth-service/auth-service.ts            |  5 +++--
 src/store/auth/auth-action.ts                        | 12 ++++++------
 src/views-components/main-app-bar/anonymous-menu.tsx |  2 +-
 src/views/login-panel/login-panel.tsx                |  2 +-
 4 files changed, 11 insertions(+), 10 deletions(-)

       via  825b555f06eb9dfb987dee1d072bba6874552a8a (commit)
      from  0209f5e7f2ec688f545f5025bafee2f2ea90a71b (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 825b555f06eb9dfb987dee1d072bba6874552a8a
Author: Peter Amstutz <pamstutz at veritasgenetics.com>
Date:   Mon May 13 14:03:08 2019 -0400

    15064: Logging into home cluster logs into all federated clusters
    
    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 eae219dd..cec0cef1 100644
--- a/src/services/auth-service/auth-service.ts
+++ b/src/services/auth-service/auth-service.ts
@@ -108,9 +108,10 @@ export class AuthService {
         localStorage.removeItem(USER_PREFS);
     }
 
-    public login(uuidPrefix: string, homeCluster: string) {
+    public login(uuidPrefix: string, homeCluster: string, remoteHosts: { [key: string]: string }) {
         const currentUrl = `${window.location.protocol}//${window.location.host}/token`;
-        window.location.assign(`https://${homeCluster}/login?remote=${uuidPrefix}&return_to=${currentUrl}`);
+        const homeClusterHost = remoteHosts[homeCluster];
+        window.location.assign(`https://${homeClusterHost}/login?${uuidPrefix !== homeCluster ? "remote=" + uuidPrefix + "&" : ""}return_to=${currentUrl}`);
     }
 
     public logout() {
diff --git a/src/store/auth/auth-action.ts b/src/store/auth/auth-action.ts
index 09d922e0..1605e302 100644
--- a/src/store/auth/auth-action.ts
+++ b/src/store/auth/auth-action.ts
@@ -59,11 +59,11 @@ export const initAuth = (config: Config) => (dispatch: Dispatch, getState: () =>
         dispatch<any>(getUserDetails()).then((user: User) => {
             dispatch(authActions.INIT({ user, token }));
         });
-        Object.keys(config.remoteHosts).map((k) => {
-            Axios.get<Config>(getDiscoveryURL(config.remoteHosts[k]))
-                .then(response => dispatch(authActions.REMOTE_CLUSTER_CONFIG({ config: response.data })));
-        });
     }
+    Object.keys(config.remoteHosts).map((k) => {
+        Axios.get<Config>(getDiscoveryURL(config.remoteHosts[k]))
+            .then(response => dispatch(authActions.REMOTE_CLUSTER_CONFIG({ config: response.data })));
+    });
 };
 
 export const saveApiToken = (token: string) => (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => {
@@ -72,8 +72,8 @@ export const saveApiToken = (token: string) => (dispatch: Dispatch, getState: ()
     dispatch(authActions.SAVE_API_TOKEN(token));
 };
 
-export const login = (uuidPrefix: string, homeCluster: string) => (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => {
-    services.authService.login(uuidPrefix, homeCluster);
+export const login = (uuidPrefix: string, homeCluster: string, remoteHosts: { [key: string]: string }) => (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => {
+    services.authService.login(uuidPrefix, homeCluster, remoteHosts);
     dispatch(authActions.LOGIN());
 };
 
diff --git a/src/views-components/main-app-bar/anonymous-menu.tsx b/src/views-components/main-app-bar/anonymous-menu.tsx
index 5ffc4215..15329a43 100644
--- a/src/views-components/main-app-bar/anonymous-menu.tsx
+++ b/src/views-components/main-app-bar/anonymous-menu.tsx
@@ -11,6 +11,6 @@ export const AnonymousMenu = connect()(
     ({ dispatch }: DispatchProp<any>) =>
         <Button
             color="inherit"
-            onClick={() => dispatch(login("", ""))}>
+            onClick={() => dispatch(login("", "", {}))}>
             Sign in
         </Button>);
diff --git a/src/views/login-panel/login-panel.tsx b/src/views/login-panel/login-panel.tsx
index b9f3194a..41a17bf9 100644
--- a/src/views/login-panel/login-panel.tsx
+++ b/src/views/login-panel/login-panel.tsx
@@ -93,7 +93,7 @@ export const LoginPanel = withStyles(styles)(
 
                 <Typography component="div" align="right">
                     <Button variant="contained" color="primary" style={{ margin: "1em" }} className={classes.button}
-                        onClick={() => dispatch(login(uuidPrefix, remoteHosts[homeCluster]))}>
+                        onClick={() => dispatch(login(uuidPrefix, homeCluster, remoteHosts))}>
                         Log in to {uuidPrefix}
                         {uuidPrefix !== homeCluster &&
                             <span> with user from {homeCluster}</span>}

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list