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';
13 import { sanitizeHTML } from 'common/html-sanitize';
15 export type CssRules = 'root' | 'ontop' | 'title';
17 const styles: StyleRulesCallback<CssRules> = (theme: ArvadosTheme) => ({
20 backgroundColor: theme.palette.grey["200"],
21 background: 'url("arvados-logo-big.png") no-repeat center center',
22 backgroundBlendMode: 'soft-light',
28 marginBottom: theme.spacing.unit * 6,
29 color: theme.palette.grey["800"]
33 export interface InactivePanelActionProps {
34 startLinking: () => void;
37 const mapDispatchToProps = (dispatch: Dispatch): InactivePanelActionProps => ({
39 dispatch<any>(navigateToLinkAccount);
43 const mapStateToProps = (state: RootState): InactivePanelStateProps => ({
44 inactivePageText: state.auth.config.clusterConfig.Workbench.InactivePageHTML,
45 isLoginClusterFederation: state.auth.config.clusterConfig.Login.LoginCluster !== '',
48 export interface InactivePanelStateProps {
49 inactivePageText: string;
50 isLoginClusterFederation: boolean;
53 type InactivePanelProps = WithStyles<CssRules> & InactivePanelActionProps & InactivePanelStateProps;
55 export const InactivePanelRoot = ({ classes, startLinking, inactivePageText, isLoginClusterFederation }: InactivePanelProps) =>
56 <Grid container justify="center" alignItems="center" direction="column" spacing={24}
57 className={classes.root}
58 style={{ marginTop: 56, height: "100%" }}>
61 <span dangerouslySetInnerHTML={{ __html: sanitizeHTML(inactivePageText) }} style={{ margin: "1em" }} />
64 { !isLoginClusterFederation
66 <Typography align="center">
67 If you would like to use this login to access another account click "Link Account".
71 <Button className={classes.ontop} color="primary" variant="contained" onClick={() => startLinking()}>
76 <Typography align="center">
77 If you would like to use this login to access another account, please contact your administrator.
82 export const InactivePanel = connect(mapStateToProps, mapDispatchToProps)(
83 withStyles(styles)(InactivePanelRoot));