cr changes
[arvados-workbench2.git] / src / views-components / advanced-tab-dialog / metadataTab.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 { Table, TableHead, TableCell, TableRow, TableBody, StyleRulesCallback, WithStyles, withStyles } from '@material-ui/core';
7
8 type CssRules = 'cell';
9
10 const styles: StyleRulesCallback<CssRules> = theme => ({
11     cell: {
12         paddingRight: theme.spacing.unit * 2
13     }
14 });
15
16 interface MetadataTable {
17     uuid: string;
18     linkClass: string;
19     name: string;
20     tailUuid: string;
21     headUuid: string;
22     properties: any;
23 }
24
25 interface MetadataProps {
26     items: MetadataTable[];
27 }
28
29 export const MetadataTab = withStyles(styles)((props: MetadataProps & WithStyles<CssRules>) =>
30     <Table>
31         <TableHead>
32             <TableRow>
33                 <TableCell>uuid</TableCell>
34                 <TableCell>link_class</TableCell>
35                 <TableCell>name</TableCell>
36                 <TableCell>tail</TableCell>
37                 <TableCell>head</TableCell>
38                 <TableCell>properties</TableCell>
39             </TableRow>
40         </TableHead>
41         <TableBody>
42             {props.items.map((it, index) =>
43                 <TableRow key={index}>
44                     <TableCell className={props.classes.cell}>{it.uuid}</TableCell>
45                     <TableCell className={props.classes.cell}>{it.linkClass}</TableCell>
46                     <TableCell className={props.classes.cell}>{it.name}</TableCell>
47                     <TableCell className={props.classes.cell}>{it.tailUuid}</TableCell>
48                     <TableCell className={props.classes.cell}>{it.headUuid}</TableCell>
49                     <TableCell className={props.classes.cell}>{JSON.stringify(it.properties, null, 2)}</TableCell>
50                 </TableRow>
51             )}
52         </TableBody>
53     </Table>
54 );