X-Git-Url: https://git.arvados.org/arvados-workbench2.git/blobdiff_plain/e9ddaee3dd51a6efbbfc509191ff00d552e1a169..0bdf4669744c1ad68507a158bca8285e672399ab:/src/views/login-panel/login-panel.tsx?ds=sidebyside

diff --git a/src/views/login-panel/login-panel.tsx b/src/views/login-panel/login-panel.tsx
index 2928a94e..afc35f71 100644
--- a/src/views/login-panel/login-panel.tsx
+++ b/src/views/login-panel/login-panel.tsx
@@ -4,11 +4,11 @@
 
 import * as React from 'react';
 import { connect, DispatchProp } from 'react-redux';
-import { Grid, Typography, Button } from '@material-ui/core';
+import { Grid, Typography, Button, Select } from '@material-ui/core';
 import { StyleRulesCallback, WithStyles, withStyles } from '@material-ui/core/styles';
-import { login } from '~/store/auth/auth-action';
+import { login, authActions } from '~/store/auth/auth-action';
 import { ArvadosTheme } from '~/common/custom-theme';
-import * as classNames from 'classnames';
+import { RootState } from '~/store/store';
 
 type CssRules = 'root' | 'container' | 'title' | 'content' | 'content__bolder' | 'button';
 
@@ -23,7 +23,6 @@ const styles: StyleRulesCallback<CssRules> = (theme: ArvadosTheme) => ({
             left: 0,
             bottom: 0,
             right: 0,
-            background: 'url("arvados-logo-big.png") no-repeat center center',
             opacity: 0.2,
         }
     },
@@ -48,33 +47,44 @@ const styles: StyleRulesCallback<CssRules> = (theme: ArvadosTheme) => ({
     }
 });
 
-type LoginPanelProps = DispatchProp<any> & WithStyles<CssRules>;
+type LoginPanelProps = DispatchProp<any> & WithStyles<CssRules> & {
+    remoteHosts: { [key: string]: string },
+    homeCluster: string,
+    uuidPrefix: string,
+    welcomePage: string
+};
 
-export const LoginPanel = withStyles(styles)(connect()(
-    ({ classes, dispatch }: LoginPanelProps) =>
-    <Grid container direction="column" item xs alignItems="center" justify="center" className={classes.root}>
-        <Grid item className={classes.container}>
-            <Typography variant="title" align="center" className={classes.title}>
-                Welcome to the Arvados Wrokbench
-            </Typography>
-            <Typography variant="body1" className={classes.content}>
-                The "Log in" button below will show you a Google sign-in page.
-                After you assure Google that you want to log in here with your Google account, you will be redirected back here to Arvados Workbench.
-            </Typography>
-            <Typography variant="body1" className={classes.content}>
-                If you have never used Arvados Workbench before, logging in for the first time will automatically create a new account.
-            </Typography>
-            <Typography variant="body2" className={classNames(classes.content, classes.content__bolder)}>
-                IMPORTANT: Please keep in mind to store exploratory data only but not any information used for clinical decision making.
-            </Typography>
-            <Typography variant="body1" className={classes.content}>
-                Arvados Workbench uses your name and email address only for identification, and does not retrieve any other personal information from Google.
-            </Typography>
-            <Typography component="div" align="right">
-                <Button variant="contained" color="primary" className={classes.button} onClick={() => dispatch(login())}>
-                    Log in
-                </Button>
-            </Typography>
-        </Grid>
-    </Grid>
-));
+export const LoginPanel = withStyles(styles)(
+    connect((state: RootState) => ({
+        remoteHosts: state.auth.remoteHosts,
+        homeCluster: state.auth.homeCluster,
+        uuidPrefix: state.auth.localCluster,
+        welcomePage: state.config.clusterConfig.Workbench.WelcomePageHTML
+    }))(({ classes, dispatch, remoteHosts, homeCluster, uuidPrefix, welcomePage }: LoginPanelProps) =>
+        <Grid container justify="center" alignItems="center"
+            className={classes.root}
+            style={{ marginTop: 56, overflowY: "auto", height: "100%" }}>
+            <Grid item className={classes.container}>
+                <Typography>
+                    <div dangerouslySetInnerHTML={{ __html: welcomePage }} style={{ margin: "1em" }} />
+                </Typography>
+                {Object.keys(remoteHosts).length > 1 &&
+                    <Typography component="div" align="right">
+                        <label>Please select the cluster that hosts your user account:</label>
+                        <Select native value={homeCluster} style={{ margin: "1em" }}
+                            onChange={(event) => dispatch(authActions.SET_HOME_CLUSTER(event.target.value))}>
+                            {Object.keys(remoteHosts).map((k) => <option key={k} value={k}>{k}</option>)}
+                        </Select>
+                    </Typography>}
+
+                <Typography component="div" align="right">
+                    <Button variant="contained" color="primary" style={{ margin: "1em" }} className={classes.button}
+                        onClick={() => dispatch(login(uuidPrefix, homeCluster, remoteHosts))}>
+                        Log in to {uuidPrefix}
+                        {uuidPrefix !== homeCluster &&
+                            <span>&nbsp;with user from {homeCluster}</span>}
+                    </Button>
+                </Typography>
+            </Grid>
+        </Grid >
+    ));
