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 "@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 { GroupResource } from "models/group";
13 import { GROUP_ATTRIBUTES_DIALOG } from "store/groups-panel/groups-panel-actions";
15 type CssRules = 'rightContainer' | 'leftContainer' | 'spacing';
17 const styles = withStyles<CssRules>((theme: ArvadosTheme) => ({
20 paddingRight: theme.spacing.unit * 2,
21 color: theme.palette.grey["500"]
25 paddingLeft: theme.spacing.unit * 2
28 paddingTop: theme.spacing.unit * 2
32 interface GroupAttributesDataProps {
36 type GroupAttributesProps = GroupAttributesDataProps & WithStyles<CssRules>;
38 export const GroupAttributesDialog = compose(
39 withDialog(GROUP_ATTRIBUTES_DIALOG),
41 (props: WithDialogProps<GroupAttributesProps> & GroupAttributesProps) =>
42 <Dialog open={props.open}
43 onClose={props.closeDialog}
46 <DialogTitle>Attributes</DialogTitle>
48 <Typography variant='body1' className={props.classes.spacing}>
49 {props.data && attributes(props.data, props.classes)}
56 onClick={props.closeDialog}>
63 const attributes = (group: GroupResource, classes: any) => {
64 const { uuid, ownerUuid, createdAt, modifiedAt, modifiedByClientUuid, modifiedByUserUuid, name, deleteAt, description, etag, href, isTrashed, trashAt} = group;
67 <Grid container direction="row">
68 <Grid item xs={5} className={classes.rightContainer}>
69 {name && <Grid item>Name</Grid>}
70 {ownerUuid && <Grid item>Owner uuid</Grid>}
71 {createdAt && <Grid item>Created at</Grid>}
72 {modifiedAt && <Grid item>Modified at</Grid>}
73 {modifiedByUserUuid && <Grid item>Modified by user uuid</Grid>}
74 {modifiedByClientUuid && <Grid item>Modified by client uuid</Grid>}
75 {uuid && <Grid item>uuid</Grid>}
76 {deleteAt && <Grid item>Delete at</Grid>}
77 {description && <Grid item>Description</Grid>}
78 {etag && <Grid item>Etag</Grid>}
79 {href && <Grid item>Href</Grid>}
80 {isTrashed && <Grid item>Is trashed</Grid>}
81 {trashAt && <Grid item>Trashed at</Grid>}
83 <Grid item xs={7} className={classes.leftContainer}>
84 <Grid item>{name}</Grid>
85 <Grid item>{ownerUuid}</Grid>
86 <Grid item>{createdAt}</Grid>
87 <Grid item>{modifiedAt}</Grid>
88 <Grid item>{modifiedByUserUuid}</Grid>
89 <Grid item>{modifiedByClientUuid}</Grid>
90 <Grid item>{uuid}</Grid>
91 <Grid item>{deleteAt}</Grid>
92 <Grid item>{description}</Grid>
93 <Grid item>{etag}</Grid>
94 <Grid item>{href}</Grid>
95 <Grid item>{isTrashed}</Grid>
96 <Grid item>{trashAt}</Grid>