add process log code snippet, change default snippet,
[arvados-workbench2.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 import { CodeSnippetDataProps } from '~/components/code-snippet/code-snippet';
13
14 export type ProcessLogPanelRootDataProps = {
15     process?: Process;
16 } & ProcessLogFormDataProps & CodeSnippetDataProps;
17
18 export type ProcessLogPanelRootActionProps = {
19     onContextMenu: (event: React.MouseEvent<HTMLElement>) => void;
20 } & ProcessLogFormActionProps;
21
22 export type ProcessLogPanelRootProps = ProcessLogPanelRootDataProps & ProcessLogPanelRootActionProps;
23
24 export const ProcessLogPanelRoot = (props: ProcessLogPanelRootProps) =>
25     props.process
26         ? <Grid container spacing={16}>
27             <ProcessLogMainCard 
28                 process={props.process} 
29                 {...props} />
30         </Grid> 
31         : <Grid container
32             alignItems='center'
33             justify='center'>
34             <DefaultView
35                 icon={ProcessIcon}
36                 messages={['Process Log not found']} />
37         </Grid>;