1 // Copyright (C) The Arvados Authors. All rights reserved.
3 // SPDX-License-Identifier: AGPL-3.0
5 import React from "react";
6 import { Dialog, DialogTitle, DialogContent, DialogActions, Button, Typography, Grid } from "@mui/material";
7 import { WithDialogProps } from "store/dialog/with-dialog";
8 import { withDialog } from 'store/dialog/with-dialog';
9 import { WithStyles } from '@mui/styles';
10 import { CustomStyleRulesCallback } from 'common/custom-theme';
11 import withStyles from '@mui/styles/withStyles';
12 import { ArvadosTheme } from 'common/custom-theme';
13 import { compose } from "redux";
14 import { USER_ATTRIBUTES_DIALOG } from "store/users/users-actions";
15 import { UserResource } from "models/user";
17 type CssRules = 'rightContainer' | 'leftContainer' | 'spacing';
19 const styles: CustomStyleRulesCallback<CssRules> = (theme: ArvadosTheme) => ({
22 paddingRight: theme.spacing(2),
23 color: theme.palette.grey["500"]
27 paddingLeft: theme.spacing(2)
30 paddingTop: theme.spacing(2)
34 interface UserAttributesDataProps {
38 type UserAttributesProps = UserAttributesDataProps & WithStyles<CssRules>;
40 export const UserAttributesDialog = compose(
41 withDialog(USER_ATTRIBUTES_DIALOG),
43 (props: WithDialogProps<UserAttributesProps> & UserAttributesProps) =>
44 <Dialog open={props.open}
45 onClose={props.closeDialog}
48 <DialogTitle>Attributes</DialogTitle>
50 <Typography variant='body1' className={props.classes.spacing}>
51 {props.data && attributes(props.data, props.classes)}
58 onClick={props.closeDialog}>
65 const attributes = (user: UserResource, classes: any) => {
66 const { uuid, ownerUuid, createdAt, modifiedAt, modifiedByClientUuid, modifiedByUserUuid,
67 firstName, lastName, username, email, isActive, isAdmin } = user;
70 <Grid container direction="row">
71 <Grid item xs={5} className={classes.rightContainer}>
72 {uuid && <Grid item>Uuid</Grid>}
73 {firstName && <Grid item>First name</Grid>}
74 {lastName && <Grid item>Last name</Grid>}
75 {email && <Grid item>Email</Grid>}
76 {username && <Grid item>Username</Grid>}
77 {isActive && <Grid item>Is active</Grid>}
78 {isAdmin && <Grid item>Is admin</Grid>}
79 {createdAt && <Grid item>Created at</Grid>}
80 {modifiedAt && <Grid item>Modified at</Grid>}
81 {ownerUuid && <Grid item>Owner uuid</Grid>}
82 {modifiedByUserUuid && <Grid item>Modified by user uuid</Grid>}
83 {modifiedByClientUuid && <Grid item>Modified by client uuid</Grid>}
85 <Grid item xs={7} className={classes.leftContainer}>
86 <Grid item>{uuid}</Grid>
87 <Grid item>{firstName}</Grid>
88 <Grid item>{lastName}</Grid>
89 <Grid item>{email}</Grid>
90 <Grid item>{username}</Grid>
91 <Grid item>{isActive}</Grid>
92 <Grid item>{isAdmin}</Grid>
93 <Grid item>{createdAt}</Grid>
94 <Grid item>{modifiedAt}</Grid>
95 <Grid item>{ownerUuid}</Grid>
96 <Grid item>{modifiedByUserUuid}</Grid>
97 <Grid item>{modifiedByClientUuid}</Grid>