information card in separate file
authorPawel Kowalczyk <pawel.kowalczyk@contractors.roche.com>
Tue, 28 Aug 2018 13:21:14 +0000 (15:21 +0200)
committerPawel Kowalczyk <pawel.kowalczyk@contractors.roche.com>
Tue, 28 Aug 2018 13:21:14 +0000 (15:21 +0200)
Feature #13858

Arvados-DCO-1.1-Signed-off-by: Pawel Kowalczyk <pawel.kowalczyk@contractors.roche.com>

src/views/process-panel/information-card.tsx [new file with mode: 0644]
src/views/process-panel/process-panel.tsx

diff --git a/src/views/process-panel/information-card.tsx b/src/views/process-panel/information-card.tsx
new file mode 100644 (file)
index 0000000..8350ba9
--- /dev/null
@@ -0,0 +1,132 @@
+// Copyright (C) The Arvados Authors. All rights reserved.
+//
+// SPDX-License-Identifier: AGPL-3.0
+
+import * as React from 'react';
+import {
+    StyleRulesCallback, WithStyles, withStyles, Card,
+    CardHeader, IconButton, CardContent, Grid, Chip
+} from '@material-ui/core';
+import { ArvadosTheme } from '~/common/custom-theme';
+import { ProcessResource } from '~/models/process';
+import { DispatchProp, connect } from 'react-redux';
+import { MoreOptionsIcon, ProcessIcon } from '~/components/icon/icon';
+import { DetailsAttribute } from '~/components/details-attribute/details-attribute';
+import { RootState } from '~/store/store';
+import { ContextMenuKind } from '~/views-components/context-menu/context-menu';
+import { openContextMenu } from '~/store/context-menu/context-menu-actions';
+
+type CssRules = 'card' | 'iconHeader' | 'label' | 'value' | 'content' | 'chip' | 'headerText' | 'link';
+
+const styles: StyleRulesCallback<CssRules> = (theme: ArvadosTheme) => ({
+    card: {
+        marginBottom: theme.spacing.unit * 2,
+    },
+    iconHeader: {
+        fontSize: '1.875rem',
+        color: theme.customs.colors.green700
+    },
+    label: {
+        fontSize: '0.875rem',
+    },
+    value: {
+        textTransform: 'none',
+        fontSize: '0.875rem'
+    },
+    content: {
+        display: 'flex',
+        paddingBottom: '0px ',
+        paddingTop: '0px',
+        '&:last-child': {
+            paddingBottom: '0px ',
+        }
+    },
+    link: {
+        fontSize: '0.875rem',
+        color: theme.palette.primary.main,
+        '&:hover': {
+            cursor: 'pointer'
+        }
+    },
+    chip: {
+        height: theme.spacing.unit * 2.5,
+        width: theme.spacing.unit * 12,
+        backgroundColor: theme.customs.colors.green700,
+        color: theme.palette.common.white,
+        fontSize: '0.875rem',
+        borderRadius: theme.spacing.unit * 0.625
+    },
+    headerText: {
+        fontSize: '0.875rem',
+        position: 'relative',
+        top: -theme.spacing.unit * 4.5,
+        left: theme.spacing.unit * 3,
+    }
+});
+
+interface ProcessInformationCardDataProps {
+    item: ProcessResource;
+}
+
+type InformationCardProps = ProcessInformationCardDataProps & DispatchProp & WithStyles<CssRules>;
+
+export const InformationCard = withStyles(styles)(
+    connect((state: RootState) => ({
+        item: state.collectionPanel.item
+    }))(
+        class extends React.Component<InformationCardProps> {
+            render() {
+                const { classes } = this.props;
+
+                return <div>
+                    <Card className={classes.card}>
+                        <CardHeader
+                            avatar={<ProcessIcon className={classes.iconHeader} />}
+                            action={
+                                <IconButton
+                                    aria-label="More options"
+                                    onClick={this.handleContextMenu}>
+                                    <MoreOptionsIcon />
+                                </IconButton>
+                            }
+                            title="Pipeline template that generates a config file from a template" />
+                        <CardContent className={classes.content}>
+                            <Grid container direction="column">
+                                <Grid item xs={8}>
+                                    <DetailsAttribute classLabel={classes.label} classValue={classes.value}
+                                        label='Status' value={<Chip label="Complete" className={classes.chip} />} />
+                                    <DetailsAttribute classLabel={classes.label} classValue={classes.value}
+                                        label='Started at' value="1:25 PM 3/23/2018" />
+                                    <DetailsAttribute classLabel={classes.label} classValue={classes.value}
+                                        label='Finished at' value='1:25 PM 3/23/2018' />
+                                </Grid>
+                            </Grid>
+                            <Grid container direction="column">
+                                <Grid item xs={8}>
+                                    <DetailsAttribute classLabel={classes.link} classValue={classes.value}
+                                        label='Container output' />
+                                    <DetailsAttribute classLabel={classes.link} classValue={classes.value}
+                                        label='Show inputs' />
+                                    <DetailsAttribute classLabel={classes.link} classValue={classes.value}
+                                        label='Show command' />
+                                </Grid>
+                            </Grid>
+                        </CardContent>
+                        <span className={classes.headerText}>This container request was created from the workflow <span className={classes.link}>FastQC MultiQC</span></span>
+                    </Card>
+                </div>;
+            }
+
+            handleContextMenu = (event: React.MouseEvent<any>) => {
+                // const { uuid, name, description } = this.props.item;
+                const resource = {
+                    uuid: '',
+                    name: '',
+                    description: '',
+                    kind: ContextMenuKind.PROCESS
+                };
+                this.props.dispatch<any>(openContextMenu(event, resource));
+            }
+        }
+    )
+);
\ No newline at end of file
index 3910099c0bbbb8fb420724a6405a2e4bc799d956..a8c92b72ea94ab29c17373c8476b0428180fa083 100644 (file)
 // SPDX-License-Identifier: AGPL-3.0
 
 import * as React from 'react';
-import {
-    StyleRulesCallback, WithStyles, withStyles, Card,
-    CardHeader, IconButton, CardContent, Grid, Chip
-} from '@material-ui/core';
-import { ArvadosTheme } from '~/common/custom-theme';
-import { ProcessResource } from '~/models/process';
-import { DispatchProp, connect } from 'react-redux';
-import { RouteComponentProps } from 'react-router';
-import { MoreOptionsIcon, ProcessIcon } from '~/components/icon/icon';
-import { DetailsAttribute } from '~/components/details-attribute/details-attribute';
-import { RootState } from '~/store/store';
-import { ContextMenuKind } from '~/views-components/context-menu/context-menu';
-import { openContextMenu } from '~/store/context-menu/context-menu-actions';
-
-type CssRules = 'card' | 'iconHeader' | 'label' | 'value' | 'content' | 'chip' | 'headerText' | 'link';
-
-const styles: StyleRulesCallback<CssRules> = (theme: ArvadosTheme) => ({
-    card: {
-        marginBottom: theme.spacing.unit * 2,
-        width: '60%'
-    },
-    iconHeader: {
-        fontSize: '1.875rem',
-        color: theme.customs.colors.green700
-    },
-    label: {
-        fontSize: '0.875rem',
-    },
-    value: {
-        textTransform: 'none',
-        fontSize: '0.875rem'
-    },
-    content: {
-        display: 'flex',
-        paddingBottom: '0px ',
-        paddingTop: '0px',
-        '&:last-child': {
-            paddingBottom: '0px ',
-        }
-    },
-    link: {
-        fontSize: '0.875rem',
-        color: theme.palette.primary.main,
-        '&:hover': {
-            cursor: 'pointer'
-        }
-    },
-    chip: {
-        height: theme.spacing.unit * 2.5,
-        width: theme.spacing.unit * 12,
-        backgroundColor: theme.customs.colors.green700,
-        color: theme.palette.common.white,
-        fontSize: '0.875rem',
-        borderRadius: theme.spacing.unit * 0.625
-    },
-    headerText: {
-        fontSize: '0.875rem',
-        position: 'relative',
-        top: -theme.spacing.unit * 4.5,
-        left: theme.spacing.unit * 3,
+import { InformationCard } from '~/views/process-panel/information-card';
+import { Grid } from '@material-ui/core';
+
+export class ProcessPanel extends React.Component {
+    render() {
+        return <div>
+            <Grid container>
+                <Grid item xs={7}>
+                    <InformationCard />
+                </Grid>
+            </Grid>
+        </div>;
     }
-});
-
-interface ProcessPanelDataProps {
-    item: ProcessResource;
-}
-
-interface ProcessPanelActionProps {
-    onContextMenu: (event: React.MouseEvent<HTMLElement>, item: ProcessResource) => void;
-}
-
-type ProcessPanelProps = ProcessPanelDataProps & ProcessPanelActionProps & DispatchProp & WithStyles<CssRules> & RouteComponentProps<{ id: string }>;
-
-export const ProcessPanel = withStyles(styles)(
-    connect((state: RootState) => ({
-        item: state.collectionPanel.item,
-        tags: state.collectionPanel.tags
-    }))(
-        class extends React.Component<ProcessPanelProps> {
-            render() {
-                const { classes } = this.props;
-
-                return <div>
-                    <Card className={classes.card}>
-                        <CardHeader
-                            avatar={<ProcessIcon className={classes.iconHeader} />}
-                            action={
-                                <IconButton
-                                    aria-label="More options"
-                                    onClick={this.handleContextMenu}>
-                                    <MoreOptionsIcon />
-                                </IconButton>
-                            }
-                            title="Pipeline template that generates a config file from a template" />
-                        <CardContent className={classes.content}>
-                            <Grid container direction="column">
-                                <Grid item xs={8}>
-                                    <DetailsAttribute classLabel={classes.label} classValue={classes.value}
-                                        label='Status' value={<Chip label="Complete" className={classes.chip} />} />
-                                    <DetailsAttribute classLabel={classes.label} classValue={classes.value}
-                                        label='Started at' value="1:25 PM 3/23/2018" />
-                                    <DetailsAttribute classLabel={classes.label} classValue={classes.value}
-                                        label='Finished at' value='1:25 PM 3/23/2018' />
-                                </Grid>
-                            </Grid>
-                            <Grid container direction="column">
-                                <Grid item xs={8}>
-                                    <DetailsAttribute classLabel={classes.link} classValue={classes.value}
-                                        label='Container output' />
-                                    <DetailsAttribute classLabel={classes.link} classValue={classes.value}
-                                        label='Show inputs' />
-                                    <DetailsAttribute classLabel={classes.link} classValue={classes.value}
-                                        label='Show command' />
-                                </Grid>
-                            </Grid>
-                        </CardContent>
-                        <span className={classes.headerText}>This container request was created from the workflow <span className={classes.link}>FastQC MultiQC</span></span>
-                    </Card>
-                </div>;
-            }
-
-            handleContextMenu = (event: React.MouseEvent<any>) => {
-                // const { uuid, name, description } = this.props.item;
-                const resource = {
-                    uuid: '',
-                    name: '',
-                    description: '',
-                    kind: ContextMenuKind.PROCESS
-                };
-                this.props.dispatch<any>(openContextMenu(event, resource));
-            }
-        }
-    )
-);
\ No newline at end of file
+}
\ No newline at end of file