1 // Copyright (C) The Arvados Authors. All rights reserved.
3 // SPDX-License-Identifier: AGPL-3.0
5 import React from 'react';
6 import { Dispatch } from 'redux';
7 import { connect } from 'react-redux';
8 import { Grid, Typography, Button } from '@material-ui/core';
9 import { StyleRulesCallback, WithStyles, withStyles } from '@material-ui/core/styles';
10 import { ArvadosTheme } from 'common/custom-theme';
11 import { navigateToLinkAccount } from 'store/navigation/navigation-action';
12 import { RootState } from 'store/store';
14 export type CssRules = 'root' | 'ontop' | 'title';
16 const styles: StyleRulesCallback<CssRules> = (theme: ArvadosTheme) => ({
19 backgroundColor: theme.palette.grey["200"],
27 background: 'url("arvados-logo-big.png") no-repeat center center',
35 marginBottom: theme.spacing.unit * 6,
36 color: theme.palette.grey["800"]
40 export interface InactivePanelActionProps {
41 startLinking: () => void;
44 const mapDispatchToProps = (dispatch: Dispatch): InactivePanelActionProps => ({
46 dispatch<any>(navigateToLinkAccount);
50 const mapStateToProps = (state: RootState): InactivePanelStateProps => ({
51 inactivePageText: state.auth.config.clusterConfig.Workbench.InactivePageHTML,
52 isLoginClusterFederation: state.auth.config.clusterConfig.Login.LoginCluster !== '',
55 export interface InactivePanelStateProps {
56 inactivePageText: string;
57 isLoginClusterFederation: boolean;
60 type InactivePanelProps = WithStyles<CssRules> & InactivePanelActionProps & InactivePanelStateProps;
63 export const InactivePanelRoot = ({ classes, startLinking, inactivePageText, isLoginClusterFederation }: InactivePanelProps) =>
64 <Grid container justify="center" alignItems="center" direction="column" spacing={24}
65 className={classes.root}
66 style={{ marginTop: 56, height: "100%" }}>
69 <span dangerouslySetInnerHTML={{ __html: inactivePageText }} style={{ margin: "1em" }} />
72 { !isLoginClusterFederation
74 <Typography align="center">
75 If you would like to use this login to access another account click "Link Account".
79 <Button className={classes.ontop} color="primary" variant="contained" onClick={() => startLinking()}>
84 <Typography align="center">
85 If you would like to use this login to access another account, please contact your administrator.
90 export const InactivePanel = connect(mapStateToProps, mapDispatchToProps)(
91 withStyles(styles)(InactivePanelRoot));