16073: Hide label column when no params have label
authorStephen Smith <stephen@curii.com>
Tue, 20 Sep 2022 17:28:02 +0000 (13:28 -0400)
committerStephen Smith <stephen@curii.com>
Tue, 20 Sep 2022 17:41:12 +0000 (13:41 -0400)
Arvados-DCO-1.1-Signed-off-by: Stephen Smith <stephen@curii.com>

src/views/process-panel/process-io-card.tsx

index f54fac85d4b2e0aa473325e27f92500a56749d29..b1cfdb3e91d2cfd00937c2c270a4f0296b66522f 100644 (file)
@@ -293,12 +293,13 @@ interface ProcessIOPreviewDataProps {
 type ProcessIOPreviewProps = ProcessIOPreviewDataProps & WithStyles<CssRules>;
 
 const ProcessIOPreview = withStyles(styles)(
-    ({ classes, data, showImagePreview }: ProcessIOPreviewProps) =>
-        <Table className={classes.tableRoot} aria-label="Process IO Preview">
+    ({ classes, data, showImagePreview }: ProcessIOPreviewProps) => {
+        const showLabel = data.some((param: ProcessIOParameter) => param.label);
+        return <Table className={classes.tableRoot} aria-label="Process IO Preview">
             <TableHead>
                 <TableRow>
                     <TableCell>Name</TableCell>
-                    <TableCell>Label</TableCell>
+                    {showLabel && <TableCell>Label</TableCell>}
                     <TableCell>Value</TableCell>
                     <TableCell>Collection</TableCell>
                 </TableRow>
@@ -314,7 +315,7 @@ const ProcessIOPreview = withStyles(styles)(
                             <TableCell>
                                 {param.id}
                             </TableCell>
-                            <TableCell >{param.label}</TableCell>
+                            {showLabel && <TableCell >{param.label}</TableCell>}
                             <TableCell>
                                 {firstVal && <ProcessValuePreview value={firstVal} showImagePreview={showImagePreview} />}
                             </TableCell>
@@ -327,7 +328,7 @@ const ProcessIOPreview = withStyles(styles)(
                         {rest.map((val, i) => (
                             <TableRow className={(i < rest.length-1) ? rowClass : undefined}>
                                 <TableCell />
-                                <TableCell />
+                                {showLabel && <TableCell />}
                                 <TableCell>
                                     <ProcessValuePreview value={val} showImagePreview={showImagePreview} />
                                 </TableCell>
@@ -341,8 +342,8 @@ const ProcessIOPreview = withStyles(styles)(
                     </>;
                 })}
             </TableBody>
-        </Table>
-);
+        </Table>;
+});
 
 interface ProcessValuePreviewProps {
     value: ProcessIOValue;