1 // Copyright (C) The Arvados Authors. All rights reserved.
3 // SPDX-License-Identifier: AGPL-3.0
5 import React from 'react';
6 import { Grid, StyleRulesCallback, WithStyles, withStyles } from '@material-ui/core';
7 import { DefaultView } from 'components/default-view/default-view';
8 import { ProcessIcon } from 'components/icon/icon';
9 import { Process } from 'store/processes/process';
10 import { SubprocessPanel } from 'views/subprocess-panel/subprocess-panel';
11 import { SubprocessFilterDataProps } from 'components/subprocess-filter/subprocess-filter';
12 import { MPVContainer, MPVPanelContent, MPVPanelState } from 'components/multi-panel-view/multi-panel-view';
13 import { ArvadosTheme } from 'common/custom-theme';
14 import { ProcessDetailsCard } from './process-details-card';
15 import { getProcessPanelLogs, ProcessLogsPanel } from 'store/process-logs-panel/process-logs-panel';
16 import { ProcessLogsCard } from './process-log-card';
17 import { FilterOption } from 'views/process-panel/process-log-form';
19 type CssRules = 'root';
21 const styles: StyleRulesCallback<CssRules> = (theme: ArvadosTheme) => ({
27 export interface ProcessPanelRootDataProps {
29 subprocesses: Array<Process>;
30 filters: Array<SubprocessFilterDataProps>;
31 processLogsPanel: ProcessLogsPanel;
34 export interface ProcessPanelRootActionProps {
35 onContextMenu: (event: React.MouseEvent<HTMLElement>, process: Process) => void;
36 onToggle: (status: string) => void;
37 cancelProcess: (uuid: string) => void;
38 onLogFilterChange: (filter: FilterOption) => void;
39 navigateToLog: (uuid: string) => void;
40 onLogCopyToClipboard: (uuid: string) => void;
43 export type ProcessPanelRootProps = ProcessPanelRootDataProps & ProcessPanelRootActionProps & WithStyles<CssRules>;
45 const panelsData: MPVPanelState[] = [
47 {name: "Logs", visible: true},
48 {name: "Subprocesses"},
51 export const ProcessPanelRoot = withStyles(styles)(
52 ({ process, processLogsPanel, ...props }: ProcessPanelRootProps) =>
54 ? <MPVContainer className={props.classes.root} spacing={8} panelStates={panelsData} justify-content="flex-start" direction="column" wrap="nowrap">
55 <MPVPanelContent forwardProps xs="auto" data-cy="process-details">
58 onContextMenu={event => props.onContextMenu(event, process)}
59 cancelProcess={props.cancelProcess}
62 <MPVPanelContent forwardProps xs maxHeight='50%' data-cy="process-logs">
64 onCopy={props.onLogCopyToClipboard}
66 lines={getProcessPanelLogs(processLogsPanel)}
68 label: processLogsPanel.selectedFilter,
69 value: processLogsPanel.selectedFilter
71 filters={processLogsPanel.filters.map(
72 filter => ({ label: filter, value: filter })
74 onLogFilterChange={props.onLogFilterChange}
75 navigateToLog={props.navigateToLog}
78 <MPVPanelContent forwardProps xs maxHeight='50%' data-cy="process-children">
85 style={{ minHeight: '100%' }}>
88 messages={['Process not found']} />