X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/4bc7ca180691fc56bee6f4e69288945313ab40d1..392a0a3992e48d0544523869b850b925d6d7f4c8:/src/views/process-panel/process-details-card.tsx

diff --git a/src/views/process-panel/process-details-card.tsx b/src/views/process-panel/process-details-card.tsx
index d3349c3ae8..da6438a1b8 100644
--- a/src/views/process-panel/process-details-card.tsx
+++ b/src/views/process-panel/process-details-card.tsx
@@ -12,14 +12,17 @@ import {
     IconButton,
     CardContent,
     Tooltip,
+    Typography,
 } from '@material-ui/core';
 import { ArvadosTheme } from 'common/custom-theme';
-import { CloseIcon } from 'components/icon/icon';
+import { CloseIcon, MoreOptionsIcon, ProcessIcon } from 'components/icon/icon';
 import { Process } from 'store/processes/process';
 import { MPVPanelProps } from 'components/multi-panel-view/multi-panel-view';
 import { ProcessDetailsAttributes } from './process-details-attributes';
+import { ProcessStatus } from 'views-components/data-explorer/renderers';
+import { ContainerState } from 'models/container';
 
-type CssRules = 'card' | 'content' | 'title' | 'header';
+type CssRules = 'card' | 'content' | 'title' | 'header' | 'cancelButton' | 'avatar' | 'iconHeader';
 
 const styles: StyleRulesCallback<CssRules> = (theme: ArvadosTheme) => ({
     card: {
@@ -29,40 +32,90 @@ const styles: StyleRulesCallback<CssRules> = (theme: ArvadosTheme) => ({
         paddingTop: theme.spacing.unit,
         paddingBottom: theme.spacing.unit,
     },
+    iconHeader: {
+        fontSize: '1.875rem',
+        color: theme.customs.colors.green700,
+    },
+    avatar: {
+        alignSelf: 'flex-start',
+        paddingTop: theme.spacing.unit * 0.5
+    },
     content: {
+        padding: theme.spacing.unit * 1.0,
+        paddingTop: theme.spacing.unit * 0.5,
         '&:last-child': {
-            paddingBottom: theme.spacing.unit * 2,
+            paddingBottom: theme.spacing.unit * 1,
         }
     },
     title: {
         overflow: 'hidden',
         paddingTop: theme.spacing.unit * 0.5
     },
+    cancelButton: {
+        paddingRight: theme.spacing.unit * 2,
+        fontSize: '14px',
+        color: theme.customs.colors.red900,
+        "&:hover": {
+            cursor: 'pointer'
+        }
+    },
 });
 
 export interface ProcessDetailsCardDataProps {
     process: Process;
+    cancelProcess: (uuid: string) => void;
+    onContextMenu: (event: React.MouseEvent<HTMLElement>) => void;
 }
 
 type ProcessDetailsCardProps = ProcessDetailsCardDataProps & WithStyles<CssRules> & MPVPanelProps;
 
 export const ProcessDetailsCard = withStyles(styles)(
-    ({ classes, process, doHidePanel, panelName }: ProcessDetailsCardProps) => {
+    ({ cancelProcess, onContextMenu, classes, process, doHidePanel, panelName }: ProcessDetailsCardProps) => {
         return <Card className={classes.card}>
             <CardHeader
                 className={classes.header}
                 classes={{
                     content: classes.title,
+                    avatar: classes.avatar,
                 }}
-                title='Details'
-                action={ doHidePanel &&
+                avatar={<ProcessIcon className={classes.iconHeader} />}
+                title={
+                    <Tooltip title={process.containerRequest.name} placement="bottom-start">
+                        <Typography noWrap variant='h6' color='inherit'>
+                            {process.containerRequest.name}
+                        </Typography>
+                    </Tooltip>
+                }
+                subheader={
+                    <Tooltip title={getDescription(process)} placement="bottom-start">
+                        <Typography noWrap variant='body1' color='inherit'>
+                            {getDescription(process)}
+                        </Typography>
+                    </Tooltip>}
+                action={
+                    <div>
+                        {process.container && process.container.state === ContainerState.RUNNING &&
+                            <span className={classes.cancelButton} onClick={() => cancelProcess(process.containerRequest.uuid)}>Cancel</span>}
+                        <ProcessStatus uuid={process.containerRequest.uuid} />
+                        <Tooltip title="More options" disableFocusListener>
+                            <IconButton
+                                aria-label="More options"
+                                onClick={event => onContextMenu(event)}>
+                                <MoreOptionsIcon />
+                            </IconButton>
+                        </Tooltip>
+                        { doHidePanel &&
                         <Tooltip title={`Close ${panelName || 'panel'}`} disableFocusListener>
                             <IconButton onClick={doHidePanel}><CloseIcon /></IconButton>
-                        </Tooltip> } />
+                        </Tooltip> }
+                    </div>
+                } />
             <CardContent className={classes.content}>
-                <ProcessDetailsAttributes item={process.containerRequest} twoCol />
+                <ProcessDetailsAttributes request={process.containerRequest} twoCol hideProcessPanelRedundantFields />
             </CardContent>
         </Card>;
     }
 );
 
+const getDescription = (process: Process) =>
+    process.containerRequest.description || '(no-description)';
