4f26a71f78c5b9cc2f690511e832aa5cd47cfe8c
[arvados-workbench2.git] / src / views / process-panel / process-details-attributes.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 { Grid } from "@material-ui/core";
7 import { formatDate } from "common/formatters";
8 import { resourceLabel } from "common/labels";
9 import { DetailsAttribute } from "components/details-attribute/details-attribute";
10 import { ProcessResource } from "models/process";
11 import { ResourceKind } from "models/resource";
12 import { ResourceOwnerWithName } from "views-components/data-explorer/renderers";
13
14 type CssRules = 'label' | 'value';
15
16 export const ProcessDetailsAttributes = (props: { item: ProcessResource, twoCol?: boolean, classes?: Record<CssRules, string> }) => {
17     const item = props.item;
18     const classes = props.classes || { label: '', value: '', button: '' };
19     const mdSize = props.twoCol ? 6 : 12;
20     return <Grid container>
21         <Grid item xs={12} md={mdSize}>
22             <DetailsAttribute label='Type' value={resourceLabel(ResourceKind.PROCESS)} />
23         </Grid>
24         <Grid item xs={12} md={mdSize}>
25             <DetailsAttribute classLabel={classes.label} classValue={classes.value}
26                 label='Owner' linkToUuid={item.ownerUuid}
27                 uuidEnhancer={(uuid: string) => <ResourceOwnerWithName uuid={uuid} />} />
28         </Grid>
29         <Grid item xs={12} md={12}>
30             <DetailsAttribute label='Status' value={item.state} />
31         </Grid>
32         <Grid item xs={12} md={mdSize}>
33             <DetailsAttribute label='Last modified' value={formatDate(item.modifiedAt)} />
34         </Grid>
35         <Grid item xs={12} md={mdSize}>
36             <DetailsAttribute label='Started at' value={formatDate(item.createdAt)} />
37         </Grid>
38         <Grid item xs={12} md={mdSize}>
39             <DetailsAttribute label='Created at' value={formatDate(item.createdAt)} />
40         </Grid>
41         <Grid item xs={12} md={mdSize}>
42             <DetailsAttribute label='Finished at' value={formatDate(item.expiresAt)} />
43         </Grid>
44         <Grid item xs={12} md={mdSize}>
45             <DetailsAttribute label='Outputs' value={item.outputPath} />
46         </Grid>
47         <Grid item xs={12} md={mdSize}>
48             <DetailsAttribute label='UUID' linkToUuid={item.uuid} value={item.uuid} />
49         </Grid>
50         <Grid item xs={12} md={mdSize}>
51             <DetailsAttribute label='Container UUID' value={item.containerUuid} />
52         </Grid>
53         <Grid item xs={12} md={mdSize}>
54             <DetailsAttribute label='Priority' value={item.priority} />
55         </Grid>
56         <Grid item xs={12} md={mdSize}>
57             <DetailsAttribute label='Runtime Constraints'
58             value={JSON.stringify(item.runtimeConstraints)} />
59         </Grid>
60         <Grid item xs={12} md={mdSize}>
61             <DetailsAttribute label='Docker Image locator'
62             linkToUuid={item.containerImage} value={item.containerImage} />
63         </Grid>
64     </Grid>;
65 };