import * as React from 'react';
import { Dispatch } from 'redux';
import { connect } from 'react-redux';
-import { saveAccountLinkData } from '~/store/link-account-panel/link-account-panel-actions';
import { Grid, Typography, Button } from '@material-ui/core';
import { StyleRulesCallback, WithStyles, withStyles } from '@material-ui/core/styles';
import { ArvadosTheme } from '~/common/custom-theme';
-import { LinkAccountType } from '~/models/link-account';
-
+import { navigateToLinkAccount } from '~/store/navigation/navigation-action';
+import { RootState } from '~/store/store';
type CssRules = 'root' | 'ontop' | 'title';
});
export interface InactivePanelActionProps {
- linkAccount: () => void;
+ startLinking: () => void;
}
const mapDispatchToProps = (dispatch: Dispatch): InactivePanelActionProps => ({
- linkAccount: () => dispatch<any>(saveAccountLinkData(LinkAccountType.ACCESS_OTHER_ACCOUNT))
+ startLinking: () => {
+ dispatch<any>(navigateToLinkAccount);
+ }
});
-type InactivePanelProps = WithStyles<CssRules> & InactivePanelActionProps;
+export interface InactivePanelStateProps {
+ inactivePageText: string;
+}
+
+type InactivePanelProps = WithStyles<CssRules> & InactivePanelActionProps & InactivePanelStateProps;
-export const InactivePanel = connect(null, mapDispatchToProps)(withStyles(styles)((({ classes, linkAccount }: InactivePanelProps) =>
- <Grid container justify="center" alignItems="center" direction="column" spacing={24}
- className={classes.root}
- style={{ marginTop: 56, height: "100%" }}>
- <Grid item>
- <Typography variant='h6' align="center" className={classes.title}>
- Hi! You're logged in, but...
- </Typography>
- </Grid>
- <Grid item>
- <Typography align="center">
- Your account is inactive. An administrator must activate your account before you can get any further.
- </Typography>
- </Grid>
- <Grid item>
- <Typography align="center">
- If you would like to use this login to access another account click "Link Account".
- </Typography>
- </Grid>
- <Grid item>
- <Button className={classes.ontop} color="primary" variant="contained" onClick={() => linkAccount()}>
- Link Account
- </Button>
- </Grid>
- </Grid >
- )));
+export const InactivePanel = connect((state: RootState) => ({
+ inactivePageText: state.auth.config.clusterConfig.Workbench.InactivePageHTML
+}), mapDispatchToProps)(withStyles(styles)((({ classes, startLinking, inactivePageText }: InactivePanelProps) =>
+ <Grid container justify="center" alignItems="center" direction="column" spacing={24}
+ className={classes.root}
+ style={{ marginTop: 56, height: "100%" }}>
+ <Grid item>
+ <Typography>
+ <div dangerouslySetInnerHTML={{ __html: inactivePageText }} style={{ margin: "1em" }} />
+ </Typography>
+ </Grid>
+ <Grid item>
+ <Typography align="center">
+ If you would like to use this login to access another account click "Link Account".
+ </Typography>
+ </Grid>
+ <Grid item>
+ <Button className={classes.ontop} color="primary" variant="contained" onClick={() => startLinking()}>
+ Link Account
+ </Button>
+ </Grid>
+ </Grid >
+)));