15088: Fixes page refresh on link accounts page
authorEric Biagiotti <ebiagiotti@veritasgenetics.com>
Tue, 21 May 2019 20:37:12 +0000 (16:37 -0400)
committerEric Biagiotti <ebiagiotti@veritasgenetics.com>
Tue, 21 May 2019 20:37:12 +0000 (16:37 -0400)
- Makes the link accounts page to not show text if data is being processed

Arvados-DCO-1.1-Signed-off-by: Eric Biagiotti <ebiagiotti@veritasgenetics.com>

src/store/auth/auth-action.ts
src/views/link-account-panel/link-account-panel-root.tsx

index 5317ede402c6adeb7663a408317709542eb26ab0..be6e9f489e90a8ef6748095d3850d3504be6801a 100644 (file)
@@ -55,9 +55,17 @@ export const initAuth = (config: Config) => (dispatch: Dispatch, getState: () =>
     // just logged in or there has been a successful link operation
     const data = services.linkAccountService.getLinkOpStatus();
     if (!matchTokenRoute(location.pathname) && (!matchFedTokenRoute(location.pathname)) && data === undefined) {
-        dispatch<any>(cancelLinking());
+        dispatch<any>(cancelLinking()).then(() => {
+            dispatch<any>(init(config));
+        });
+    }
+    else {
+        dispatch<any>(init(config));
     }
 
+};
+
+const init = (config: Config) => (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => {
     const user = services.authService.getUser();
     const token = services.authService.getApiToken();
     const homeCluster = services.authService.getHomeCluster();
index 11159e9aa14cc402fe3fe16f33ecbe6414b2fd30..c38cbe643d5fbf0173a1ced83e942f065efc5bc7 100644 (file)
@@ -80,7 +80,7 @@ export const LinkAccountPanelRoot = withStyles(styles) (
                     <CircularProgress/>
                 </Grid>
             </Grid> }
-            { status === LinkAccountPanelStatus.INITIAL && targetUser && <div>
+            { !isProcessing && status === LinkAccountPanelStatus.INITIAL && targetUser && <div>
                 { isLocalUser(targetUser.uuid, localCluster) ? <Grid container spacing={24}>
                     <Grid container item direction="column" spacing={24}>
                         <Grid item>
@@ -139,7 +139,7 @@ export const LinkAccountPanelRoot = withStyles(styles) (
                     </Grid>
                 </Grid>}
             </div> }
-            { (status === LinkAccountPanelStatus.LINKING || status === LinkAccountPanelStatus.ERROR) && userToLink && targetUser &&
+            { !isProcessing && (status === LinkAccountPanelStatus.LINKING || status === LinkAccountPanelStatus.ERROR) && userToLink && targetUser &&
             <Grid container spacing={24}>
                 { status === LinkAccountPanelStatus.LINKING && <Grid container item direction="column" spacing={24}>
                     <Grid item>