X-Git-Url: https://git.arvados.org/arvados-workbench2.git/blobdiff_plain/576cd73ae073187557df3239ca301c16eaca7ae9..b5b75b89e923864389f814af97974a55b69a343f:/src/store/process-panel/process-panel-actions.ts diff --git a/src/store/process-panel/process-panel-actions.ts b/src/store/process-panel/process-panel-actions.ts index 64fc493f..b361f7ac 100644 --- a/src/store/process-panel/process-panel-actions.ts +++ b/src/store/process-panel/process-panel-actions.ts @@ -17,9 +17,9 @@ import { initProcessLogsPanel, processLogsPanelActions } from "store/process-log import { CollectionFile } from "models/collection-file"; import { ContainerRequestResource } from "models/container-request"; import { CommandOutputParameter } from 'cwlts/mappings/v1.0/CommandOutputParameter'; -import { CommandInputParameter, getIOParamId } from 'models/workflow'; +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({ @@ -27,11 +27,12 @@ export const processPanelActions = unionize({ SET_PROCESS_PANEL_CONTAINER_REQUEST_UUID: ofType(), SET_PROCESS_PANEL_FILTERS: ofType(), TOGGLE_PROCESS_PANEL_FILTER: ofType(), - SET_INPUT_RAW: ofType(), + SET_INPUT_RAW: ofType(), SET_INPUT_PARAMS: ofType(), SET_OUTPUT_RAW: ofType(), SET_OUTPUT_DEFINITIONS: ofType(), SET_OUTPUT_PARAMS: ofType(), + SET_NODE_INFO: ofType(), }); export type ProcessPanelAction = UnionOf; @@ -67,7 +68,7 @@ export const loadInputs = (containerRequest: ContainerRequestResource) => export const loadOutputs = (containerRequest: ContainerRequestResource) => async (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => { - const noOutputs = {rawOutputs: {}}; + const noOutputs = { rawOutputs: {} }; if (!containerRequest.outputUuid) { dispatch(processPanelActions.SET_OUTPUT_RAW(noOutputs)); return; @@ -102,6 +103,34 @@ export const loadOutputs = (containerRequest: ContainerRequestResource) => } }; + +export const loadNodeJson = (containerRequest: ContainerRequestResource) => + async (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => { + const noLog = { nodeInfo: null }; + if (!containerRequest.logUuid) { + dispatch(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(processPanelActions.SET_NODE_INFO({ + nodeInfo: nodeData as NodeInstanceType + })); + } else { + dispatch(processPanelActions.SET_NODE_INFO(noLog)); + } + } catch { + dispatch(processPanelActions.SET_NODE_INFO(noLog)); + } + }; + export const loadOutputDefinitions = (containerRequest: ContainerRequestResource) => async (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => { if (containerRequest && containerRequest.mounts) {