Merge branch 'master'
[arvados-workbench2.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 * as 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 { SubprocessesCard } from './subprocesses-card';
12
13 export interface ProcessPanelRootDataProps {
14     process?: Process;
15 }
16
17 export interface ProcessPanelRootActionProps {
18     onContextMenu: (event: React.MouseEvent<HTMLElement>) => void;
19 }
20
21 export type ProcessPanelRootProps = ProcessPanelRootDataProps & ProcessPanelRootActionProps;
22
23 export const ProcessPanelRoot = (props: ProcessPanelRootProps) =>
24     props.process
25         ? <Grid container spacing={16}>
26             <Grid item xs={7}>
27                 <ProcessInformationCard
28                     process={props.process}
29                     onContextMenu={props.onContextMenu} />
30             </Grid>
31             <Grid item xs={5}>
32                 <SubprocessesCard
33                     subprocesses={4}
34                     filters={[
35                         {
36                             key: 'queued',
37                             value: 1,
38                             label: 'Queued',
39                             checked: true
40                         }, {
41                             key: 'active',
42                             value: 2,
43                             label: 'Active',
44                             checked: true
45                         },
46                         {
47                             key: 'completed',
48                             value: 2,
49                             label: 'Completed',
50                             checked: true
51                         },
52                         {
53                             key: 'failed',
54                             value: 2,
55                             label: 'Failed',
56                             checked: true
57                         }
58                     ]}
59                     onToggle={() => { return; }}
60                 />
61             </Grid>
62         </Grid>
63         : <Grid container
64             alignItems='center'
65             justify='center'>
66             <DefaultView
67                 icon={ProcessIcon}
68                 messages={['Process not found']} />
69         </Grid>;