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";
import { CommandOutputParameter } from 'cwlts/mappings/v1.0/CommandOutputParameter';
import { CommandInputParameter, getIOParamId, WorkflowInputsData } from 'models/workflow';
import { getIOParamDisplayValue, ProcessIOParameter } from "views/process-panel/process-io-card";
-import { OutputDetails } from "./process-panel";
+import { OutputDetails, NodeInstanceType, NodeInfo } from "./process-panel";
import { AuthState } from "store/auth/auth-reducer";
export const processPanelActions = unionize({
SET_OUTPUT_RAW: ofType<OutputDetails | null>(),
SET_OUTPUT_DEFINITIONS: ofType<CommandOutputParameter[]>(),
SET_OUTPUT_PARAMS: ofType<ProcessIOParameter[] | null>(),
+ SET_NODE_INFO: ofType<NodeInfo>(),
});
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));
export const loadOutputs = (containerRequest: ContainerRequestResource) =>
async (dispatch: Dispatch<any>, getState: () => RootState, services: ServiceRepository) => {
- const noOutputs = {rawOutputs: {}};
+ const noOutputs = { rawOutputs: {} };
if (!containerRequest.outputUuid) {
dispatch<ProcessPanelAction>(processPanelActions.SET_OUTPUT_RAW(noOutputs));
return;
}
};
+
+export const loadNodeJson = (containerRequest: ContainerRequestResource) =>
+ async (dispatch: Dispatch<any>, getState: () => RootState, services: ServiceRepository) => {
+ const noLog = { nodeInfo: null };
+ if (!containerRequest.logUuid) {
+ dispatch<ProcessPanelAction>(processPanelActions.SET_NODE_INFO(noLog));
+ return;
+ };
+ try {
+ const filesPromise = services.collectionService.files(containerRequest.logUuid);
+ const collectionPromise = services.collectionService.get(containerRequest.logUuid);
+ const [files] = await Promise.all([filesPromise, collectionPromise]);
+
+ // Fetch node.json from keep
+ const nodeFile = files.find((file) => file.name === 'node.json') as CollectionFile | undefined;
+ let nodeData = nodeFile ? await services.collectionService.getFileContents(nodeFile) : undefined;
+ if (nodeData && (nodeData = JSON.parse(nodeData))) {
+ dispatch<ProcessPanelAction>(processPanelActions.SET_NODE_INFO({
+ nodeInfo: nodeData as NodeInstanceType
+ }));
+ } else {
+ dispatch<ProcessPanelAction>(processPanelActions.SET_NODE_INFO(noLog));
+ }
+ } catch {
+ dispatch<ProcessPanelAction>(processPanelActions.SET_NODE_INFO(noLog));
+ }
+ };
+
export const loadOutputDefinitions = (containerRequest: ContainerRequestResource) =>
async (dispatch: Dispatch<any>, getState: () => RootState, services: ServiceRepository) => {
if (containerRequest && containerRequest.mounts) {
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),
});
};
-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),