X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/6acebd8c63b066f86aa81fce3b8937609778031f..428d454e2681d66bb14558946cfe2fb77a2c8dce:/src/views/workflow-panel/workflow-description-card.tsx

diff --git a/src/views/workflow-panel/workflow-description-card.tsx b/src/views/workflow-panel/workflow-description-card.tsx
index e2b0f295e8..c297276e7b 100644
--- a/src/views/workflow-panel/workflow-description-card.tsx
+++ b/src/views/workflow-panel/workflow-description-card.tsx
@@ -3,35 +3,73 @@
 // SPDX-License-Identifier: AGPL-3.0
 
 import * as React from 'react';
-import { StyleRulesCallback, WithStyles, withStyles, Card, CardHeader, Typography, CardContent } from '@material-ui/core';
+import { StyleRulesCallback, WithStyles, withStyles, CardContent, Tab, Tabs, Paper } from '@material-ui/core';
 import { ArvadosTheme } from '~/common/custom-theme';
 import { WorkflowIcon } from '~/components/icon/icon';
 import { DataTableDefaultView } from '~/components/data-table-default-view/data-table-default-view';
+import { WorkflowResource, parseWorkflowDefinition, getWorkflowInputs } from '~/models/workflow';
+import { WorkflowInput } from '~/components/workflow-inputs-form/workflow-input';
+import { RunProcessInputsForm } from '../run-process-panel/run-process-inputs-form';
 
-export type CssRules = 'card';
+export type CssRules = 'root' | 'tab';
 
 const styles: StyleRulesCallback<CssRules> = (theme: ArvadosTheme) => ({
-    card: {
-        height: '100%'
+    root: {
+        height: '100%',
+    },
+    tab: {
+        minWidth: '50%'
     }
 });
 
-interface WorkflowDescriptionCardDataProps {
+interface WorkflowDetailsCardDataProps {
+    workflow?: WorkflowResource;
 }
 
-type WorkflowDescriptionCardProps = WorkflowDescriptionCardDataProps & WithStyles<CssRules>;
-
-export const WorkflowDescriptionCard = withStyles(styles)(
-    ({ classes }: WorkflowDescriptionCardProps) => {
-        return <Card className={classes.card}>
-            <CardHeader
-                title={<Typography noWrap variant="body2">
-                    Workflow description:
-                </Typography>} />
-            <CardContent>
-                <DataTableDefaultView
-                    icon={WorkflowIcon}
-                    messages={['Please select a workflow to see its description.']} />
-            </CardContent>
-        </Card>;
+type WorkflowDetailsCardProps = WorkflowDetailsCardDataProps & WithStyles<CssRules>;
+
+export const WorkflowDetailsCard = withStyles(styles)(
+    class extends React.Component<WorkflowDetailsCardProps> {
+        state = {
+            value: 0,
+        };
+
+        handleChange = (event: React.MouseEvent<HTMLElement>, value: number) => {
+            this.setState({ value });
+        }
+
+        render() {
+            const { classes, workflow } = this.props;
+            const { value } = this.state;
+            return <Paper className={classes.root}>
+                <Tabs value={value} onChange={this.handleChange} centered={true}>
+                    <Tab className={classes.tab} label="Description" />
+                    <Tab className={classes.tab} label="Inputs" />
+                </Tabs>
+                {value === 0 && <CardContent>
+                    {workflow
+                        ? workflow.description
+                        : <DataTableDefaultView
+                            icon={WorkflowIcon}
+                            messages={['Please select a workflow to see its description.']} />}
+                </CardContent>}
+                {value === 1 && <CardContent>
+                    {workflow && this.inputs
+                        ? <RunProcessInputsForm inputs={this.inputs} />
+                        : <DataTableDefaultView
+                            icon={WorkflowIcon}
+                            messages={['Please select a workflow to see its description.']} />}
+                </CardContent>}
+            </Paper>;
+        }
+
+        get inputs() {
+            if (this.props.workflow) {
+                const definition = parseWorkflowDefinition(this.props.workflow);
+                if (definition) {
+                    return getWorkflowInputs(definition);
+                }
+            }
+            return;
+        }
     });
\ No newline at end of file
