X-Git-Url: https://git.arvados.org/arvados-workbench2.git/blobdiff_plain/c4621fbe523cc60770f4176141b83083f1f3802a..ead22eaffc696e9619d0ba7a71c8d54099200685:/src/views/process-panel/process-panel-root.tsx

diff --git a/src/views/process-panel/process-panel-root.tsx b/src/views/process-panel/process-panel-root.tsx
index 4aa51d8e..52c0f451 100644
--- a/src/views/process-panel/process-panel-root.tsx
+++ b/src/views/process-panel/process-panel-root.tsx
@@ -7,37 +7,41 @@ import { Grid } from '@material-ui/core';
 import { ProcessInformationCard } from './process-information-card';
 import { DefaultView } from '~/components/default-view/default-view';
 import { ProcessIcon } from '~/components/icon/icon';
-import { Process, getProcessStatus } from '~/store/processes/process';
+import { Process } from '~/store/processes/process';
 import { SubprocessesCard } from './subprocesses-card';
-import { SubprocessFilterDataProps } from '~/components/subprocess-filter/subprocess-filter';
-import { groupBy } from 'lodash';
 import { ProcessSubprocesses } from '~/views/process-panel/process-subprocesses';
+import { SubprocessFilterDataProps } from '~/components/subprocess-filter/subprocess-filter';
 
 export interface ProcessPanelRootDataProps {
     process?: Process;
     subprocesses: Array<Process>;
+    filters: Array<SubprocessFilterDataProps>;
+    totalSubprocessesLength: number;
 }
 
 export interface ProcessPanelRootActionProps {
-    onContextMenu: (event: React.MouseEvent<HTMLElement>) => void;
+    onContextMenu: (event: React.MouseEvent<HTMLElement>, process: Process) => void;
+    onToggle: (status: string) => void;
+    openProcessInputDialog: (uuid: string) => void;
 }
 
 export type ProcessPanelRootProps = ProcessPanelRootDataProps & ProcessPanelRootActionProps;
 
-export const ProcessPanelRoot = (props: ProcessPanelRootProps) =>
-    props.process
-        ? <Grid container spacing={16}>
-            <Grid item xs={7}>
+export const ProcessPanelRoot = ({ process, ...props }: ProcessPanelRootProps) =>
+    process
+        ? <Grid container spacing={16} alignItems="stretch">
+            <Grid item sm={12} md={7}>
                 <ProcessInformationCard
-                    process={props.process}
-                    onContextMenu={props.onContextMenu} />
-                {console.log(props.subprocesses)}
+                    process={process}
+                    onContextMenu={event => props.onContextMenu(event, process)}
+                    openProcessInputDialog={props.openProcessInputDialog} />
             </Grid>
-            <Grid item xs={5}>
+            <Grid item sm={12} md={5}>
                 <SubprocessesCard
-                    subprocesses={props.subprocesses}
-                    filters={mapGroupedProcessesToFilters(groupSubprocessesByStatus(props.subprocesses))}
-                    onToggle={() => { return; }} />
+                    subprocessesAmount={props.totalSubprocessesLength}
+                    filters={props.filters}
+                    onToggle={props.onToggle}
+                />
             </Grid>
             <Grid item xs={12}>
                 <ProcessSubprocesses
@@ -54,14 +58,3 @@ export const ProcessPanelRoot = (props: ProcessPanelRootProps) =>
                 messages={['Process not found']} />
         </Grid>;
 
-const groupSubprocessesByStatus = (processes: Process[]) =>
-    groupBy(processes, getProcessStatus);
-
-const mapGroupedProcessesToFilters = (groupedProcesses: { [status: string]: Process[] }): SubprocessFilterDataProps[] =>
-    Object
-        .keys(groupedProcesses)
-        .map(status => ({
-            label: status,
-            key: status,
-            value: groupedProcesses[status].length
-        }));
