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 '@mui/material';
9 import { CustomStyleRulesCallback } from 'common/custom-theme';
10 import { WithStyles } from '@mui/styles';
11 import withStyles from '@mui/styles/withStyles';
12 import { ArvadosTheme } from 'common/custom-theme';
13 import { navigateToLinkAccount } from 'store/navigation/navigation-action';
14 import { RootState } from 'store/store';
15 import { sanitizeHTML } from 'common/html-sanitize';
17 export type CssRules = 'root' | 'ontop' | 'title';
19 const styles: CustomStyleRulesCallback<CssRules> = (theme: ArvadosTheme) => ({
22 backgroundColor: theme.palette.grey["200"],
23 background: 'url("arvados-logo-big.png") no-repeat center center',
24 backgroundBlendMode: 'soft-light',
30 marginBottom: theme.spacing(6),
31 color: theme.palette.grey["800"]
35 export interface InactivePanelActionProps {
36 startLinking: () => void;
39 const mapDispatchToProps = (dispatch: Dispatch): InactivePanelActionProps => ({
41 dispatch<any>(navigateToLinkAccount);
45 const mapStateToProps = (state: RootState): InactivePanelStateProps => ({
46 inactivePageText: state.auth.config.clusterConfig.Workbench.InactivePageHTML,
47 isLoginClusterFederation: state.auth.config.clusterConfig.Login.LoginCluster !== '',
50 export interface InactivePanelStateProps {
51 inactivePageText: string;
52 isLoginClusterFederation: boolean;
55 type InactivePanelProps = WithStyles<CssRules> & InactivePanelActionProps & InactivePanelStateProps;
57 export const InactivePanelRoot = ({ classes, startLinking, inactivePageText, isLoginClusterFederation }: InactivePanelProps) =>
58 <Grid container justifyContent="center" alignItems="center" direction="column" spacing={3}
59 className={classes.root}
60 style={{ marginTop: 56, height: "100%" }}>
63 <span dangerouslySetInnerHTML={{ __html: sanitizeHTML(inactivePageText) }} style={{ margin: "1em" }} />
66 { !isLoginClusterFederation
68 <Typography align="center">
69 If you would like to use this login to access another account click "Link Account".
73 <Button className={classes.ontop} color="primary" variant="contained" onClick={() => startLinking()}>
78 <Typography align="center">
79 If you would like to use this login to access another account, please contact your administrator.
84 export const InactivePanel = connect(mapStateToProps, mapDispatchToProps)(
85 withStyles(styles)(InactivePanelRoot));