1 // Copyright (C) The Arvados Authors. All rights reserved.
3 // SPDX-License-Identifier: AGPL-3.0
5 import * as React from 'react';
7 StyleRulesCallback, WithStyles, withStyles, Card,
8 CardHeader, IconButton, CardContent, Grid, Chip
9 } from '@material-ui/core';
10 import { ArvadosTheme } from '~/common/custom-theme';
11 import { ProcessResource } from '~/models/process';
12 import { DispatchProp, connect } from 'react-redux';
13 import { RouteComponentProps } from 'react-router';
14 import { MoreOptionsIcon, ProcessIcon } from '~/components/icon/icon';
15 import { DetailsAttribute } from '~/components/details-attribute/details-attribute';
16 import { RootState } from '~/store/store';
17 import { ContextMenuKind } from '~/views-components/context-menu/context-menu';
18 import { openContextMenu } from '~/store/context-menu/context-menu-actions';
19 import { SubprocessesCard } from '~/views/process-panel/subprocesses-card';
21 type CssRules = 'card' | 'iconHeader' | 'label' | 'value' | 'content' | 'chip' | 'headerText' | 'link';
23 const styles: StyleRulesCallback<CssRules> = (theme: ArvadosTheme) => ({
25 marginBottom: theme.spacing.unit * 2,
30 color: theme.customs.colors.green700
36 textTransform: 'none',
41 paddingBottom: '0px ',
44 paddingBottom: '0px ',
50 color: theme.palette.primary.main,
55 height: theme.spacing.unit * 2.5,
56 width: theme.spacing.unit * 12,
57 backgroundColor: theme.customs.colors.green700,
58 color: theme.palette.common.white,
60 borderRadius: theme.spacing.unit * 0.625
66 justifyContent: 'flex-start',
67 top: -theme.spacing.unit * 4.5,
68 left: theme.spacing.unit * 3,
72 interface ProcessPanelDataProps {
73 item: ProcessResource;
76 interface ProcessPanelActionProps {
77 onContextMenu: (event: React.MouseEvent<HTMLElement>, item: ProcessResource) => void;
80 type ProcessPanelProps = ProcessPanelDataProps & ProcessPanelActionProps & DispatchProp & WithStyles<CssRules> & RouteComponentProps<{ id: string }>;
82 export const ProcessPanel = withStyles(styles)(
83 connect((state: RootState) => ({
84 item: state.collectionPanel.item,
85 tags: state.collectionPanel.tags
87 class extends React.Component<ProcessPanelProps> {
89 const { classes } = this.props;
92 <Card className={classes.card}>
94 avatar={<ProcessIcon className={classes.iconHeader} />}
97 aria-label="More options"
98 onClick={this.handleContextMenu}>
102 title="Pipeline template that generates a config file from a template" />
103 <CardContent className={classes.content}>
104 <Grid container direction="column">
106 <DetailsAttribute classLabel={classes.label} classValue={classes.value}
107 label='Status' value={<Chip label="Complete" className={classes.chip} />} />
108 <DetailsAttribute classLabel={classes.label} classValue={classes.value}
109 label='Started at' value="1:25 PM 3/23/2018" />
110 <DetailsAttribute classLabel={classes.label} classValue={classes.value}
111 label='Finished at' value='1:25 PM 3/23/2018' />
114 <Grid container direction="column">
116 <DetailsAttribute classLabel={classes.link} classValue={classes.value}
117 label='Container output' />
118 <DetailsAttribute classLabel={classes.link} classValue={classes.value}
119 label='Show inputs' />
120 <DetailsAttribute classLabel={classes.link} classValue={classes.value}
121 label='Show command' />
125 <span className={classes.headerText}>This container request was created from the workflow FastQC MultiQC</span>
131 handleContextMenu = (event: React.MouseEvent<any>) => {
132 // const { uuid, name, description } = this.props.item;
137 kind: ContextMenuKind.PROCESS
139 this.props.dispatch<any>(openContextMenu(event, resource));