refs #14533-copy-to-project-does-not-work-from-side-bar-context-menu
[arvados.git] / src / views-components / ssh-keys-dialog / attributes-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 { compose } from 'redux';
7 import { withStyles, Dialog, DialogTitle, DialogContent, DialogActions, Button, StyleRulesCallback, WithStyles, Typography, Grid } from '@material-ui/core';
8 import { WithDialogProps, withDialog } from "~/store/dialog/with-dialog";
9 import { SSH_KEY_ATTRIBUTES_DIALOG } from '~/store/auth/auth-action';
10 import { ArvadosTheme } from '~/common/custom-theme';
11 import { SshKeyResource } from "~/models/ssh-key";
12
13 type CssRules = 'root';
14
15 const styles: StyleRulesCallback<CssRules> = (theme: ArvadosTheme) => ({
16     root: {
17         fontSize: '0.875rem',
18         '& div:nth-child(odd)': {
19             textAlign: 'right',
20             color: theme.palette.grey["500"]
21         }
22     }
23 });
24
25 interface AttributesSshKeyDialogDataProps {
26     sshKey: SshKeyResource;
27 }
28
29 export const AttributesSshKeyDialog = compose(
30     withDialog(SSH_KEY_ATTRIBUTES_DIALOG),
31     withStyles(styles))(
32         ({ open, closeDialog, data, classes }: WithDialogProps<AttributesSshKeyDialogDataProps> & WithStyles<CssRules>) =>
33             <Dialog open={open}
34                 onClose={closeDialog}
35                 fullWidth
36                 maxWidth='sm'>
37                 <DialogTitle>Attributes</DialogTitle>
38                 <DialogContent>
39                     {data.sshKey && <Grid container direction="row" spacing={16} className={classes.root}>
40                         <Grid item xs={5}>Name</Grid>
41                         <Grid item xs={7}>{data.sshKey.name}</Grid>
42                         <Grid item xs={5}>uuid</Grid>
43                         <Grid item xs={7}>{data.sshKey.uuid}</Grid>
44                         <Grid item xs={5}>Owner uuid</Grid>
45                         <Grid item xs={7}>{data.sshKey.ownerUuid}</Grid>
46                         <Grid item xs={5}>Authorized user uuid</Grid>
47                         <Grid item xs={7}>{data.sshKey.authorizedUserUuid}</Grid>
48                         <Grid item xs={5}>Created at</Grid>
49                         <Grid item xs={7}>{data.sshKey.createdAt}</Grid>
50                         <Grid item xs={5}>Modified at</Grid>
51                         <Grid item xs={7}>{data.sshKey.modifiedAt}</Grid>
52                         <Grid item xs={5}>Expires at</Grid>
53                         <Grid item xs={7}>{data.sshKey.expiresAt}</Grid>
54                         <Grid item xs={5}>Modified by user uuid</Grid>
55                         <Grid item xs={7}>{data.sshKey.modifiedByUserUuid}</Grid>
56                         <Grid item xs={5}>Modified by client uuid</Grid>
57                         <Grid item xs={7}>{data.sshKey.modifiedByClientUuid}</Grid>
58                     </Grid>}
59                 </DialogContent>
60                 <DialogActions>
61                     <Button
62                         variant='flat'
63                         color='primary'
64                         onClick={closeDialog}>
65                         Close
66                     </Button>
67                 </DialogActions>
68             </Dialog>
69     );