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';
18 import { ProcessCmdCard } from './process-cmd-card';
20 type CssRules = 'root';
22 const styles: StyleRulesCallback<CssRules> = (theme: ArvadosTheme) => ({
28 export interface ProcessPanelRootDataProps {
30 subprocesses: Array<Process>;
31 filters: Array<SubprocessFilterDataProps>;
32 processLogsPanel: ProcessLogsPanel;
35 export interface ProcessPanelRootActionProps {
36 onContextMenu: (event: React.MouseEvent<HTMLElement>, process: Process) => void;
37 onToggle: (status: string) => void;
38 cancelProcess: (uuid: string) => void;
39 onLogFilterChange: (filter: FilterOption) => void;
40 navigateToLog: (uuid: string) => void;
41 onCopyToClipboard: (uuid: string) => void;
44 export type ProcessPanelRootProps = ProcessPanelRootDataProps & ProcessPanelRootActionProps & WithStyles<CssRules>;
46 const panelsData: MPVPanelState[] = [
49 {name: "Logs", visible: true},
50 {name: "Subprocesses"},
53 export const ProcessPanelRoot = withStyles(styles)(
54 ({ process, processLogsPanel, ...props }: ProcessPanelRootProps) =>
56 ? <MPVContainer className={props.classes.root} spacing={8} panelStates={panelsData} justify-content="flex-start" direction="column" wrap="nowrap">
57 <MPVPanelContent forwardProps xs="auto" data-cy="process-details">
60 onContextMenu={event => props.onContextMenu(event, process)}
61 cancelProcess={props.cancelProcess}
64 <MPVPanelContent forwardProps xs="auto" data-cy="process-cmd">
66 onCopy={props.onCopyToClipboard}
69 <MPVPanelContent forwardProps xs maxHeight='50%' data-cy="process-logs">
71 onCopy={props.onCopyToClipboard}
73 lines={getProcessPanelLogs(processLogsPanel)}
75 label: processLogsPanel.selectedFilter,
76 value: processLogsPanel.selectedFilter
78 filters={processLogsPanel.filters.map(
79 filter => ({ label: filter, value: filter })
81 onLogFilterChange={props.onLogFilterChange}
82 navigateToLog={props.navigateToLog}
85 <MPVPanelContent forwardProps xs maxHeight='50%' data-cy="process-children">
92 style={{ minHeight: '100%' }}>
95 messages={['Process not found']} />