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 { 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 { SubprocessPanel } from 'views/subprocess-panel/subprocess-panel';
12 import { SubprocessFilterDataProps } from 'components/subprocess-filter/subprocess-filter';
13 import { MPVContainer, MPVPanelContent, MPVPanelState } from 'components/multi-panel-view/multi-panel-view';
14 import { ArvadosTheme } from 'common/custom-theme';
15 import { ProcessDetailsCard } from './process-details-card';
16 import { getProcessPanelLogs, ProcessLogsPanel } from 'store/process-logs-panel/process-logs-panel';
17 import { ProcessLogsCard } from './process-log-card';
18 import { FilterOption } from 'views/process-panel/process-log-form';
20 type CssRules = 'root';
22 const styles: StyleRulesCallback<CssRules> = (theme: ArvadosTheme) => ({
29 export interface ProcessPanelRootDataProps {
31 subprocesses: Array<Process>;
32 filters: Array<SubprocessFilterDataProps>;
33 processLogsPanel: ProcessLogsPanel;
36 export interface ProcessPanelRootActionProps {
37 onContextMenu: (event: React.MouseEvent<HTMLElement>, process: Process) => void;
38 onToggle: (status: string) => void;
39 openProcessInputDialog: (uuid: string) => void;
40 navigateToOutput: (uuid: string) => void;
41 navigateToWorkflow: (uuid: string) => void;
42 cancelProcess: (uuid: string) => void;
43 onLogFilterChange: (filter: FilterOption) => void;
44 navigateToLog: (uuid: string) => void;
45 onLogCopyToClipboard: (uuid: string) => void;
48 export type ProcessPanelRootProps = ProcessPanelRootDataProps & ProcessPanelRootActionProps & WithStyles<CssRules>;
50 const panelsData: MPVPanelState[] = [
52 {name: "Details", visible: false},
53 {name: "Logs", visible: true},
54 {name: "Subprocesses"},
57 export const ProcessPanelRoot = withStyles(styles)(
58 ({ process, processLogsPanel, ...props }: ProcessPanelRootProps) =>
60 ? <MPVContainer className={props.classes.root} spacing={8} panelStates={panelsData} justify-content="flex-start" direction="column" wrap="nowrap">
61 <MPVPanelContent forwardProps xs="auto">
62 <ProcessInformationCard
64 onContextMenu={event => props.onContextMenu(event, process)}
65 openProcessInputDialog={props.openProcessInputDialog}
66 navigateToOutput={props.navigateToOutput}
67 openWorkflow={props.navigateToWorkflow}
68 cancelProcess={props.cancelProcess}
71 <MPVPanelContent forwardProps xs="auto">
72 <ProcessDetailsCard process={process} />
74 <MPVPanelContent forwardProps xs maxHeight='50%'>
76 onCopy={props.onLogCopyToClipboard}
78 lines={getProcessPanelLogs(processLogsPanel)}
80 label: processLogsPanel.selectedFilter,
81 value: processLogsPanel.selectedFilter
83 filters={processLogsPanel.filters.map(
84 filter => ({ label: filter, value: filter })
86 onLogFilterChange={props.onLogFilterChange}
87 navigateToLog={props.navigateToLog}
90 <MPVPanelContent forwardProps xs maxHeight='50%'>
97 style={{ minHeight: '100%' }}>
100 messages={['Process not found']} />