X-Git-Url: https://git.arvados.org/arvados-workbench2.git/blobdiff_plain/80c74e54f7f176e9809a049b241a90765699713f..f4e410a5984226818301332c25ac178403c2e0e9:/src/views/process-log-panel/process-log-main-card.tsx?ds=sidebyside

diff --git a/src/views/process-log-panel/process-log-main-card.tsx b/src/views/process-log-panel/process-log-main-card.tsx
index f32291ac..42df2d92 100644
--- a/src/views/process-log-panel/process-log-main-card.tsx
+++ b/src/views/process-log-panel/process-log-main-card.tsx
@@ -15,6 +15,7 @@ import { MoreOptionsIcon, ProcessIcon } from '~/components/icon/icon';
 import { ArvadosTheme } from '~/common/custom-theme';
 import { CodeSnippetDataProps } from '~/components/code-snippet/code-snippet';
 import { BackIcon } from '~/components/icon/icon';
+import { DefaultView } from '~/components/default-view/default-view';
 
 type CssRules = 'backLink' | 'backIcon' | 'card' | 'title' | 'iconHeader' | 'link';
 
@@ -52,47 +53,63 @@ interface ProcessLogMainCardDataProps {
     process: Process;
 }
 
-export type ProcessLogMainCardProps = ProcessLogMainCardDataProps & CodeSnippetDataProps & ProcessLogFormDataProps & ProcessLogFormActionProps;
+export interface ProcessLogMainCardActionProps {
+    onContextMenu: (event: React.MouseEvent<any>, process: Process) => void;
+}
+
+export type ProcessLogMainCardProps = ProcessLogMainCardDataProps
+    & ProcessLogMainCardActionProps
+    & CodeSnippetDataProps
+    & ProcessLogFormDataProps
+    & ProcessLogFormActionProps;
 
 export const ProcessLogMainCard = withStyles(styles)(
-    ({ classes, process, selectedFilter, filters, onChange, lines }: ProcessLogMainCardProps & WithStyles<CssRules>) => 
+    ({ classes, process, selectedFilter, filters, onChange, lines, onContextMenu }: ProcessLogMainCardProps & WithStyles<CssRules>) =>
         <Grid item xs={12}>
             <Link to={`/processes/${process.containerRequest.uuid}`} className={classes.backLink}>
-                <BackIcon className={classes.backIcon}/> Back
+                <BackIcon className={classes.backIcon} /> Back
             </Link>
             <Card className={classes.card}>
                 <CardHeader
                     avatar={<ProcessIcon className={classes.iconHeader} />}
                     action={
-                        <div>
-                            <IconButton aria-label="More options">
+                        <Tooltip title="More options" disableFocusListener>
+                            <IconButton onClick={event => onContextMenu(event, process)} aria-label="More options">
                                 <MoreOptionsIcon />
                             </IconButton>
-                        </div>
-                    }
+                        </Tooltip>}
                     title={
                         <Tooltip title={process.containerRequest.name} placement="bottom-start">
                             <Typography noWrap variant="title" className={classes.title}>
                                 {process.containerRequest.name}
                             </Typography>
-                        </Tooltip>
-                    }
+                        </Tooltip>}
                     subheader={process.containerRequest.description} />
                 <CardContent>
-                    <Grid container spacing={24} alignItems='center'>
-                        <Grid item xs={6}>
-                            <ProcessLogForm selectedFilter={selectedFilter} filters={filters} onChange={onChange} />
+                    {lines.length > 0
+                        ? < Grid
+                            container
+                            spacing={24}
+                            direction='column'>
+                            <Grid container item>
+                                <Grid item xs={6}>
+                                    <ProcessLogForm selectedFilter={selectedFilter} filters={filters} onChange={onChange} />
+                                </Grid>
+                                <Grid item xs={6} className={classes.link}>
+                                    <Typography component='div'>
+                                        Go to Log collection
+                                </Typography>
+                                </Grid>
+                            </Grid>
+                            <Grid item xs>
+                                <ProcessLogCodeSnippet lines={lines} />
+                            </Grid>
                         </Grid>
-                        <Grid item xs={6} className={classes.link}>
-                            <Typography component='div'>
-                                Go to Log collection
-                            </Typography>
-                        </Grid>
-                        <Grid item xs={12}>
-                            <ProcessLogCodeSnippet lines={lines}/>
-                        </Grid>
-                    </Grid>
+                        : <DefaultView
+                            icon={ProcessIcon}
+                            messages={['No logs yet']} />
+                    }
                 </CardContent>
             </Card>
-        </Grid>
+        </Grid >
 );
\ No newline at end of file
