import * as React from 'react';
import { connect, DispatchProp } from 'react-redux';
-import { Grid, Typography, Button, Select, FormControl } from '@material-ui/core';
+import { Grid, Typography, Button, Select } from '@material-ui/core';
import { StyleRulesCallback, WithStyles, withStyles } from '@material-ui/core/styles';
import { login, authActions } from '~/store/auth/auth-action';
import { ArvadosTheme } from '~/common/custom-theme';
type LoginPanelProps = DispatchProp<any> & WithStyles<CssRules> & {
remoteHosts: { [key: string]: string },
homeCluster: string,
- uuidPrefix: string
+ uuidPrefix: string,
+ loginCluster: string
};
export const LoginPanel = withStyles(styles)(
connect((state: RootState) => ({
remoteHosts: state.auth.remoteHosts,
homeCluster: state.auth.homeCluster,
- uuidPrefix: state.auth.localCluster
- }))(({ classes, dispatch, remoteHosts, homeCluster, uuidPrefix }: LoginPanelProps) =>
+ uuidPrefix: state.auth.localCluster,
+ loginCluster: state.auth.loginCluster
+ }))(({ classes, dispatch, remoteHosts, homeCluster, uuidPrefix, loginCluster }: LoginPanelProps) =>
<Grid container justify="center" alignItems="center"
className={classes.root}
style={{ marginTop: 56, overflowY: "auto", height: "100%" }}>
Arvados Workbench uses your name and email address only for identification, and does not retrieve any other personal information from Google.
</Typography>
- {Object.keys(remoteHosts).length > 1 &&
+ {Object.keys(remoteHosts).length > 1 && loginCluster === "" &&
<Typography component="div" align="right">
<label>Please select the cluster that hosts your user account:</label>
<Select native value={homeCluster} style={{ margin: "1em" }}
<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> with user from {homeCluster}</span>}
+ onClick={() => dispatch(login(uuidPrefix, homeCluster, loginCluster, remoteHosts))}>
+ Log in
+ {uuidPrefix !== homeCluster && loginCluster !== homeCluster &&
+ <span> to {uuidPrefix} with user from {homeCluster}</span>}
</Button>
</Typography>
</Grid>