18128: Show [X] close button on individual panels.
[arvados.git] / src / views / process-panel / process-panel-root.tsx
1 // Copyright (C) The Arvados Authors. All rights reserved.
2 //
3 // SPDX-License-Identifier: AGPL-3.0
4
5 import React from 'react';
6 import { Grid } from '@material-ui/core';
7 import { ProcessInformationCard } from './process-information-card';
8 import { DefaultView } from 'components/default-view/default-view';
9 import { ProcessIcon } from 'components/icon/icon';
10 import { Process } from 'store/processes/process';
11 import { SubprocessPanel } from 'views/subprocess-panel/subprocess-panel';
12 import { SubprocessFilterDataProps } from 'components/subprocess-filter/subprocess-filter';
13 import { MPVContainer, MPVPanelContent } from 'components/multi-panel-view/multi-panel-view';
14
15 export interface ProcessPanelRootDataProps {
16     process?: Process;
17     subprocesses: Array<Process>;
18     filters: Array<SubprocessFilterDataProps>;
19 }
20
21 export interface ProcessPanelRootActionProps {
22     onContextMenu: (event: React.MouseEvent<HTMLElement>, process: Process) => void;
23     onToggle: (status: string) => void;
24     openProcessInputDialog: (uuid: string) => void;
25     navigateToOutput: (uuid: string) => void;
26     navigateToWorkflow: (uuid: string) => void;
27     cancelProcess: (uuid: string) => void;
28 }
29
30 export type ProcessPanelRootProps = ProcessPanelRootDataProps & ProcessPanelRootActionProps;
31
32 export const ProcessPanelRoot = ({ process, ...props }: ProcessPanelRootProps) =>
33     process
34         ? <MPVContainer spacing={8} panelNames={["Info", "Subprocesses"]} alignItems="stretch">
35             <MPVPanelContent sm={12} md={12}>
36                 <ProcessInformationCard
37                     process={process}
38                     onContextMenu={event => props.onContextMenu(event, process)}
39                     openProcessInputDialog={props.openProcessInputDialog}
40                     navigateToOutput={props.navigateToOutput}
41                     openWorkflow={props.navigateToWorkflow}
42                     cancelProcess={props.cancelProcess}
43                 />
44             </MPVPanelContent>
45             <MPVPanelContent sm={12} md={12}>
46                 <SubprocessPanel />
47             </MPVPanelContent>
48         </MPVContainer>
49         : <Grid container
50             alignItems='center'
51             justify='center'
52             style={{ minHeight: '100%' }}>
53             <DefaultView
54                 icon={ProcessIcon}
55                 messages={['Process not found']} />
56         </Grid>;
57