Merge branch '15317-metrics'
[arvados.git] / services / workbench2 / src / views / process-panel / process-panel-root.tsx
index d019d1418fcf0c8841a94989e1211daffaf864b6..2a9b3882e86bec1592764ad46f837938c5eb3aa5 100644 (file)
@@ -3,8 +3,7 @@
 // SPDX-License-Identifier: AGPL-3.0
 
 import React from "react";
-import { Grid, StyleRulesCallback, WithStyles, withStyles } from "@material-ui/core";
-import { DefaultView } from "components/default-view/default-view";
+import { StyleRulesCallback, WithStyles, withStyles } from "@material-ui/core";
 import { ProcessIcon } from "components/icon/icon";
 import { Process } from "store/processes/process";
 import { SubprocessPanel } from "views/subprocess-panel/subprocess-panel";
@@ -24,6 +23,8 @@ import { AuthState } from "store/auth/auth-reducer";
 import { ProcessCmdCard } from "./process-cmd-card";
 import { ContainerRequestResource } from "models/container-request";
 import { OutputDetails, NodeInstanceType } from "store/process-panel/process-panel";
+import { NotFoundView } from 'views/not-found-panel/not-found-panel';
+import { CollectionFile } from 'models/collection-file';
 
 type CssRules = "root";
 
@@ -41,10 +42,11 @@ export interface ProcessPanelRootDataProps {
     auth: AuthState;
     inputRaw: WorkflowInputsData | null;
     inputParams: ProcessIOParameter[] | null;
-    outputRaw: OutputDetails | null;
+    outputData: OutputDetails | null;
     outputDefinitions: CommandOutputParameter[];
     outputParams: ProcessIOParameter[] | null;
     nodeInfo: NodeInstanceType | null;
+    usageReport: string | null;
 }
 
 export interface ProcessPanelRootActionProps {
@@ -68,12 +70,12 @@ export type ProcessPanelRootProps = ProcessPanelRootDataProps & ProcessPanelRoot
 
 const panelsData: MPVPanelState[] = [
     { name: "Details" },
-    { name: "Command" },
     { name: "Logs", visible: true },
-    { name: "Inputs" },
+    { name: "Subprocesses" },
     { name: "Outputs" },
+    { name: "Inputs" },
+    { name: "Command" },
     { name: "Resources" },
-    { name: "Subprocesses" },
 ];
 
 export const ProcessPanelRoot = withStyles(styles)(
@@ -83,10 +85,11 @@ export const ProcessPanelRoot = withStyles(styles)(
         processLogsPanel,
         inputRaw,
         inputParams,
-        outputRaw,
+        outputData,
         outputDefinitions,
         outputParams,
         nodeInfo,
+        usageReport,
         loadInputs,
         loadOutputs,
         loadNodeJson,
@@ -112,10 +115,12 @@ export const ProcessPanelRoot = withStyles(styles)(
             }
         }, [containerRequest, loadInputs, loadOutputs, loadOutputDefinitions, loadNodeJson]);
 
+        const maxHeight = "100%";
+
         // Trigger processing output params when raw or definitions change
         React.useEffect(() => {
             updateOutputParams();
-        }, [outputRaw, outputDefinitions, updateOutputParams]);
+        }, [outputData, outputDefinitions, updateOutputParams]);
 
         return process ? (
             <MPVContainer
@@ -137,19 +142,11 @@ export const ProcessPanelRoot = withStyles(styles)(
                         resumeOnHoldWorkflow={props.resumeOnHoldWorkflow}
                     />
                 </MPVPanelContent>
-                <MPVPanelContent
-                    forwardProps
-                    xs="auto"
-                    data-cy="process-cmd">
-                    <ProcessCmdCard
-                        onCopy={props.onCopyToClipboard}
-                        process={process}
-                    />
-                </MPVPanelContent>
                 <MPVPanelContent
                     forwardProps
                     xs
-                    minHeight="50%"
+                    minHeight={maxHeight}
+                    maxHeight={maxHeight}
                     data-cy="process-logs">
                     <ProcessLogsCard
                         onCopy={props.onCopyToClipboard}
@@ -168,7 +165,27 @@ export const ProcessPanelRoot = withStyles(styles)(
                 <MPVPanelContent
                     forwardProps
                     xs
-                    maxHeight="50%"
+                    maxHeight={maxHeight}
+                    data-cy="process-children">
+                    <SubprocessPanel process={process} />
+                </MPVPanelContent>
+                <MPVPanelContent
+                    forwardProps
+                    xs
+                    maxHeight={maxHeight}
+                    data-cy="process-outputs">
+                    <ProcessIOCard
+                        label={ProcessIOCardType.OUTPUT}
+                        process={process}
+                        params={outputParams}
+                        raw={outputData?.raw}
+                        outputUuid={outputUuid || ""}
+                    />
+                </MPVPanelContent>
+                <MPVPanelContent
+                    forwardProps
+                    xs
+                    maxHeight={maxHeight}
                     data-cy="process-inputs">
                     <ProcessIOCard
                         label={ProcessIOCardType.INPUT}
@@ -180,15 +197,11 @@ export const ProcessPanelRoot = withStyles(styles)(
                 </MPVPanelContent>
                 <MPVPanelContent
                     forwardProps
-                    xs
-                    maxHeight="50%"
-                    data-cy="process-outputs">
-                    <ProcessIOCard
-                        label={ProcessIOCardType.OUTPUT}
+                    xs="auto"
+                    data-cy="process-cmd">
+                    <ProcessCmdCard
+                        onCopy={props.onCopyToClipboard}
                         process={process}
-                        params={outputParams}
-                        raw={outputRaw?.rawOutputs}
-                        outputUuid={outputUuid || ""}
                     />
                 </MPVPanelContent>
                 <MPVPanelContent
@@ -198,27 +211,15 @@ export const ProcessPanelRoot = withStyles(styles)(
                     <ProcessResourceCard
                         process={process}
                         nodeInfo={nodeInfo}
+                        usageReport={usageReport}
                     />
                 </MPVPanelContent>
-                <MPVPanelContent
-                    forwardProps
-                    xs
-                    maxHeight="50%"
-                    data-cy="process-children">
-                    <SubprocessPanel />
-                </MPVPanelContent>
             </MPVContainer>
         ) : (
-            <Grid
-                container
-                alignItems="center"
-                justify="center"
-                style={{ minHeight: "100%" }}>
-                <DefaultView
-                    icon={ProcessIcon}
-                    messages={["Process not found"]}
-                />
-            </Grid>
+            <NotFoundView
+                icon={ProcessIcon}
+                messages={["Process not found"]}
+            />
         );
     }
 );