15768: standardized naming Arvados-DCO-1.1-Signed-off-by: Lisa Knox <lisa.knox@curii...
[arvados.git] / src / store / process-panel / process-panel-actions.ts
index 9b1e984706af6a487036d2f21ebd868017696e49..d8042ba5ef9942351df2a298635dae0f556bb300 100644 (file)
@@ -12,7 +12,7 @@ import { navigateTo, navigateToWorkflows } from 'store/navigation/navigation-act
 import { snackbarActions } from 'store/snackbar/snackbar-actions';
 import { SnackbarKind } from '../snackbar/snackbar-actions';
 import { showWorkflowDetails } from 'store/workflow-panel/workflow-panel-actions';
-import { loadSubprocessPanel } from "../subprocess-panel/subprocess-panel-actions";
+import { loadSubprocessPanel, subprocessPanelActions } from "../subprocess-panel/subprocess-panel-actions";
 import { initProcessLogsPanel, processLogsPanelActions } from "store/process-logs-panel/process-logs-panel-actions";
 import { CollectionFile } from "models/collection-file";
 import { ContainerRequestResource } from "models/container-request";
@@ -21,8 +21,6 @@ import { CommandInputParameter, getIOParamId, WorkflowInputsData } from 'models/
 import { getIOParamDisplayValue, ProcessIOParameter } from "views/process-panel/process-io-card";
 import { OutputDetails, NodeInstanceType, NodeInfo } from "./process-panel";
 import { AuthState } from "store/auth/auth-reducer";
-import { CommonService } from "services/common-service/common-service";
-import { camelCase } from "lodash";
 
 export const processPanelActions = unionize({
     RESET_PROCESS_PANEL: ofType<{}>(),
@@ -42,7 +40,12 @@ export type ProcessPanelAction = UnionOf<typeof processPanelActions>;
 export const toggleProcessPanelFilter = processPanelActions.TOGGLE_PROCESS_PANEL_FILTER;
 
 export const loadProcessPanel = (uuid: string) =>
-    async (dispatch: Dispatch) => {
+    async (dispatch: Dispatch, getState: () => RootState) => {
+        // Reset subprocess data explorer if navigating to new process
+        //  Avoids resetting pagination when refreshing same process
+        if (getState().processPanel.containerRequestUuid !== uuid) {
+            dispatch(subprocessPanelActions.CLEAR());
+        }
         dispatch(processPanelActions.RESET_PROCESS_PANEL());
         dispatch(processLogsPanelActions.RESET_PROCESS_LOGS_PANEL());
         dispatch<ProcessPanelAction>(processPanelActions.SET_PROCESS_PANEL_CONTAINER_REQUEST_UUID(uuid));
@@ -116,7 +119,7 @@ export const loadNodeJson = (containerRequest: ContainerRequestResource) =>
         try {
             const filesPromise = services.collectionService.files(containerRequest.logUuid);
             const collectionPromise = services.collectionService.get(containerRequest.logUuid);
-            const [files, collection] = await Promise.all([filesPromise, collectionPromise]);
+            const [files] = await Promise.all([filesPromise, collectionPromise]);
 
             // Fetch node.json from keep
             const nodeFile = files.find((file) => file.name === 'node.json') as CollectionFile | undefined;
@@ -167,7 +170,7 @@ export const initProcessPanelFilters = processPanelActions.SET_PROCESS_PANEL_FIL
     ProcessStatus.CANCELLED
 ]);
 
-const formatInputData = (inputs: CommandInputParameter[], auth: AuthState): ProcessIOParameter[] => {
+export const formatInputData = (inputs: CommandInputParameter[], auth: AuthState): ProcessIOParameter[] => {
     return inputs.map(input => {
         return {
             id: getIOParamId(input),
@@ -177,7 +180,7 @@ const formatInputData = (inputs: CommandInputParameter[], auth: AuthState): Proc
     });
 };
 
-const formatOutputData = (definitions: CommandOutputParameter[], values: any, pdh: string | undefined, auth: AuthState): ProcessIOParameter[] => {
+export const formatOutputData = (definitions: CommandOutputParameter[], values: any, pdh: string | undefined, auth: AuthState): ProcessIOParameter[] => {
     return definitions.map(output => {
         return {
             id: getIOParamId(output),