init view log with props
[arvados.git] / src / views / process-log-panel / process-log-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 { Process } from '~/store/processes/process';
8 import { ProcessLogMainCard } from '~/views/process-log-panel/process-log-main-card';
9 import { ProcessLogFormDataProps, ProcessLogFormActionProps } from '~/views/process-log-panel/process-log-form';
10 import { DefaultView } from '~/components/default-view/default-view';
11 import { ProcessIcon } from '~/components/icon/icon';
12
13 export type ProcessLogPanelRootDataProps = {
14     process?: Process;
15 } & ProcessLogFormDataProps;
16
17 export type ProcessLogPanelRootActionProps = {
18     onContextMenu: (event: React.MouseEvent<HTMLElement>) => void;
19 } & ProcessLogFormActionProps;
20
21 export type ProcessLogPanelRootProps = ProcessLogPanelRootDataProps & ProcessLogPanelRootActionProps;
22
23 export const ProcessLogPanelRoot = (props: ProcessLogPanelRootProps) =>
24     props.process
25         ? <Grid container spacing={16}>
26             <ProcessLogMainCard 
27                 process={props.process} 
28                 {...props} />
29         </Grid> 
30         : <Grid container
31             alignItems='center'
32             justify='center'>
33             <DefaultView
34                 icon={ProcessIcon}
35                 messages={['Process Log not found']} />
36         </Grid>;