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 { MoreOptionsIcon, ProcessIcon } from '~/components/icon/icon';
14 import { DetailsAttribute } from '~/components/details-attribute/details-attribute';
15 import { RootState } from '~/store/store';
16 import { ContextMenuKind } from '~/views-components/context-menu/context-menu';
17 import { openContextMenu } from '~/store/context-menu/context-menu-actions';
19 type CssRules = 'card' | 'iconHeader' | 'label' | 'value' | 'chip' | 'headerText' | 'link';
21 const styles: StyleRulesCallback<CssRules> = (theme: ArvadosTheme) => ({
23 marginBottom: theme.spacing.unit * 2,
24 paddingBottom: theme.spacing.unit * 3,
29 color: theme.customs.colors.green700
33 justifyContent: 'flex-end',
35 marginRight: theme.spacing.unit * 3
38 textTransform: 'none',
43 color: theme.palette.primary.main,
49 height: theme.spacing.unit * 3,
50 width: theme.spacing.unit * 12,
51 backgroundColor: theme.customs.colors.green700,
52 color: theme.palette.common.white,
54 borderRadius: theme.spacing.unit * 0.625,
56 top: theme.spacing.unit * 2.5,
57 right: theme.spacing.unit * 8,
61 marginLeft: theme.spacing.unit * 3,
65 interface ProcessInformationCardDataProps {
66 item: ProcessResource;
69 type InformationCardProps = ProcessInformationCardDataProps & DispatchProp & WithStyles<CssRules>;
71 export const InformationCard = withStyles(styles)(
72 connect((state: RootState) => ({
73 item: state.collectionPanel.item
75 class extends React.Component<InformationCardProps> {
77 const { classes } = this.props;
80 <Card className={classes.card}>
82 avatar={<ProcessIcon className={classes.iconHeader} />}
85 aria-label="More options"
86 onClick={this.handleContextMenu}>
89 title="Pipeline template that generates a config file from a template"
90 subheader="(no description)" />
91 <Chip label="Complete" className={classes.chip} />
95 <DetailsAttribute classLabel={classes.label} classValue={classes.value}
96 label='From' value="1:25 PM 3/23/2018" />
97 <DetailsAttribute classLabel={classes.label} classValue={classes.value}
98 label='To' value='1:25 PM 3/23/2018' />
99 <DetailsAttribute classLabel={classes.label} classValue={classes.link}
100 label='Workflow' value='FastQC MultiQC' />
103 <DetailsAttribute classLabel={classes.link} classValue={classes.value}
105 <DetailsAttribute classLabel={classes.link} classValue={classes.value}
114 handleContextMenu = (event: React.MouseEvent<any>) => {
119 kind: ContextMenuKind.PROCESS
121 this.props.dispatch<any>(openContextMenu(event, resource));