init-modal
[arvados-workbench2.git] / src / views-components / user-dialog / manage-dialog.tsx
1 // Copyright (C) The Arvados Authors. All rights reserved.
2 //
3 // SPDX-License-Identifier: AGPL-3.0
4
5 import * as React from "react";
6 import { Dialog, DialogTitle, DialogContent, DialogActions, Button, Typography } from "@material-ui/core";
7 import { WithDialogProps } from "~/store/dialog/with-dialog";
8 import { withDialog } from '~/store/dialog/with-dialog';
9 import { WithStyles, withStyles } from '@material-ui/core/styles';
10 import { ArvadosTheme } from '~/common/custom-theme';
11 import { compose } from "redux";
12 import { USER_MANAGE_DIALOG } from "~/store/users/users-actions";
13 import { UserResource } from "~/models/user";
14
15 type CssRules = 'spacing';
16
17 const styles = withStyles<CssRules>((theme: ArvadosTheme) => ({
18     spacing: {
19         paddingBottom: theme.spacing.unit * 2,
20         paddingTop: theme.spacing.unit * 2,
21     }
22 }));
23
24 interface UserManageDataProps {
25     data: UserResource;
26 }
27
28 type UserManageProps = UserManageDataProps & WithStyles<CssRules>;
29
30 export const UserManageDialog = compose(
31     withDialog(USER_MANAGE_DIALOG),
32     styles)(
33         (props: WithDialogProps<UserManageProps> & UserManageProps) =>
34             <Dialog open={props.open}
35                 onClose={props.closeDialog}
36                 fullWidth
37                 maxWidth="md">
38                 <DialogTitle>{`Manage - ${props.data.firstName} ${props.data.lastName}`}</DialogTitle>
39                 <DialogContent>
40                     <Typography variant="body2" className={props.classes.spacing}>
41                         As an admin, you can log in as this user. When you’ve finished, you will need to log out and log in again with your own account.
42                     </Typography>
43                     <Button variant="contained" color="primary">
44                         {`LOG IN AS ${props.data.firstName} ${props.data.lastName}`}
45                     </Button>
46                     <Typography variant="body2" className={props.classes.spacing}>
47                         As an admin, you can setup a shell account for this user. The login name is automatically generated from the user's e-mail address.
48                     </Typography>
49                     <Button variant="contained" color="primary">
50                         {`SETUP SHELL ACCOUNT FOR ${props.data.firstName} ${props.data.lastName}`}
51                     </Button>
52                 </DialogContent>
53                 <DialogActions>
54                     <Button
55                         variant='flat'
56                         color='primary'
57                         onClick={props.closeDialog}>
58                         Close
59                 </Button>
60                 </DialogActions>
61             </Dialog>
62     );