X-Git-Url: https://git.arvados.org/arvados-workbench2.git/blobdiff_plain/f9dde5c781766b8be71d43d0f031c201a0edcfbb..98adeb294aa8bf1c1691f70ab095d20a96c0d375:/src/views/site-manager-panel/site-manager-panel-root.tsx

diff --git a/src/views/site-manager-panel/site-manager-panel-root.tsx b/src/views/site-manager-panel/site-manager-panel-root.tsx
index 3b8053e7..684e35b4 100644
--- a/src/views/site-manager-panel/site-manager-panel-root.tsx
+++ b/src/views/site-manager-panel/site-manager-panel-root.tsx
@@ -21,8 +21,7 @@ import {
 import { ArvadosTheme } from '~/common/custom-theme';
 import { Session, SessionStatus } from "~/models/session";
 import Button from "@material-ui/core/Button";
-import { User } from "~/models/user";
-import { compose } from "redux";
+import { compose, Dispatch } from "redux";
 import { Field, FormErrors, InjectedFormProps, reduxForm, reset, stopSubmit } from "redux-form";
 import { TextField } from "~/components/text-field/text-field";
 import { addSession } from "~/store/auth/auth-action-session";
@@ -89,25 +88,29 @@ export interface SiteManagerPanelRootActionProps {
 
 export interface SiteManagerPanelRootDataProps {
     sessions: Session[];
-    user: User;
 }
 
 type SiteManagerPanelRootProps = SiteManagerPanelRootDataProps & SiteManagerPanelRootActionProps & WithStyles<CssRules> & InjectedFormProps;
 const SITE_MANAGER_FORM_NAME = 'siteManagerForm';
 
+const submitSession = (remoteHost: string) =>
+    (dispatch: Dispatch) => {
+        dispatch<any>(addSession(remoteHost)).then(() => {
+            dispatch(reset(SITE_MANAGER_FORM_NAME));
+        }).catch((e: any) => {
+            const errors = {
+                remoteHost: e
+            } as FormErrors;
+            dispatch(stopSubmit(SITE_MANAGER_FORM_NAME, errors));
+        });
+    };
+
 export const SiteManagerPanelRoot = compose(
     reduxForm<{remoteHost: string}>({
         form: SITE_MANAGER_FORM_NAME,
         touchOnBlur: false,
         onSubmit: (data, dispatch) => {
-            dispatch<any>(addSession(data.remoteHost)).then(() => {
-                dispatch(reset(SITE_MANAGER_FORM_NAME));
-            }).catch((e: any) => {
-                const errors = {
-                    remoteHost: e
-                } as FormErrors;
-                dispatch(stopSubmit(SITE_MANAGER_FORM_NAME, errors));
-            });
+            dispatch(submitSession(data.remoteHost));
         }
     }),
     withStyles(styles))
@@ -116,7 +119,7 @@ export const SiteManagerPanelRoot = compose(
             <CardContent>
                 <Grid container direction="row">
                     <Grid item xs={12}>
-                        <Typography variant='body1' paragraph={true} >
+                        <Typography  paragraph={true} >
                             You can log in to multiple Arvados sites here, then use the multi-site search page to search collections and projects on all sites at once.
                         </Typography>
                     </Grid>
@@ -154,7 +157,7 @@ export const SiteManagerPanelRoot = compose(
                 <form onSubmit={handleSubmit}>
                     <Grid container direction="row">
                         <Grid item xs={12}>
-                            <Typography variant='body1' paragraph={true} className={classes.remoteSiteInfo}>
+                            <Typography  paragraph={true} className={classes.remoteSiteInfo}>
                                 To add a remote Arvados site, paste the remote site's host here (see "ARVADOS_API_HOST" on the "current token" page).
                             </Typography>
                         </Grid>
