20300: Merge branch 'main' into 20300-rails7
[arvados.git] / services / workbench2 / src / views-components / keep-services-dialog / attributes-dialog.tsx
1 // Copyright (C) The Arvados Authors. All rights reserved.
2 //
3 // SPDX-License-Identifier: AGPL-3.0
4
5 import React from "react";
6 import { compose } from 'redux';
7 import {
8     withStyles, Dialog, DialogTitle, DialogContent, DialogActions,
9     Button, StyleRulesCallback, WithStyles, Grid
10 } from '@material-ui/core';
11 import { WithDialogProps, withDialog } from "store/dialog/with-dialog";
12 import { KEEP_SERVICE_ATTRIBUTES_DIALOG } from 'store/keep-services/keep-services-actions';
13 import { ArvadosTheme } from 'common/custom-theme';
14 import { KeepServiceResource } from 'models/keep-services';
15
16 type CssRules = 'root';
17
18 const styles: StyleRulesCallback<CssRules> = (theme: ArvadosTheme) => ({
19     root: {
20         fontSize: '0.875rem',
21         '& div:nth-child(odd)': {
22             textAlign: 'right',
23             color: theme.palette.grey["500"]
24         }
25     }
26 });
27
28 interface AttributesKeepServiceDialogDataProps {
29     keepService: KeepServiceResource;
30 }
31
32 export const AttributesKeepServiceDialog = compose(
33     withDialog(KEEP_SERVICE_ATTRIBUTES_DIALOG),
34     withStyles(styles))(
35         ({ open, closeDialog, data, classes }: WithDialogProps<AttributesKeepServiceDialogDataProps> & WithStyles<CssRules>) =>
36             <Dialog open={open} onClose={closeDialog} fullWidth maxWidth='sm'>
37                 <DialogTitle>Attributes</DialogTitle>
38                 <DialogContent>
39                     {data.keepService && <Grid container direction="row" spacing={16} className={classes.root}>
40                         <Grid item xs={5}>UUID</Grid>
41                         <Grid item xs={7}>{data.keepService.uuid}</Grid>
42                         <Grid item xs={5}>Read only</Grid>
43                         <Grid item xs={7}>{JSON.stringify(data.keepService.readOnly)}</Grid>
44                         <Grid item xs={5}>Service host</Grid>
45                         <Grid item xs={7}>{data.keepService.serviceHost}</Grid>
46                         <Grid item xs={5}>Service port</Grid>
47                         <Grid item xs={7}>{data.keepService.servicePort}</Grid>
48                         <Grid item xs={5}>Service SSL flag</Grid>
49                         <Grid item xs={7}>{JSON.stringify(data.keepService.serviceSslFlag)}</Grid>
50                         <Grid item xs={5}>Service type</Grid>
51                         <Grid item xs={7}>{data.keepService.serviceType}</Grid>
52                         <Grid item xs={5}>Owner uuid</Grid>
53                         <Grid item xs={7}>{data.keepService.ownerUuid}</Grid>
54                         <Grid item xs={5}>Created at</Grid>
55                         <Grid item xs={7}>{data.keepService.createdAt}</Grid>
56                         <Grid item xs={5}>Modified at</Grid>
57                         <Grid item xs={7}>{data.keepService.modifiedAt}</Grid>
58                         <Grid item xs={5}>Modified by user uuid</Grid>
59                         <Grid item xs={7}>{data.keepService.modifiedByUserUuid}</Grid>
60                         <Grid item xs={5}>Modified by client uuid</Grid>
61                         <Grid item xs={7}>{data.keepService.modifiedByClientUuid}</Grid>
62                     </Grid>}
63                 </DialogContent>
64                 <DialogActions>
65                     <Button
66                         variant='text'
67                         color='primary'
68                         onClick={closeDialog}>
69                         Close
70                     </Button>
71                 </DialogActions>
72             </Dialog>
73     );