+export const loadProcessPanel = (uuid: string) => 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));
+ await dispatch<any>(loadProcess(uuid));
+ dispatch(initProcessPanelFilters);
+ dispatch<any>(initProcessLogsPanel(uuid));
+ dispatch<any>(loadSubprocessPanel());
+};
+
+export const navigateToOutput = (uuid: string) => async (dispatch: Dispatch<any>, getState: () => RootState, services: ServiceRepository) => {
+ try {
+ await services.collectionService.get(uuid);
+ dispatch<any>(navigateTo(uuid));
+ } catch {
+ dispatch(snackbarActions.OPEN_SNACKBAR({ message: "Output collection was trashed or deleted.", hideDuration: 4000, kind: SnackbarKind.WARNING }));
+ }
+};
+
+export const loadInputs =
+ (containerRequest: ContainerRequestResource) => async (dispatch: Dispatch<any>, getState: () => RootState, services: ServiceRepository) => {
+ dispatch<ProcessPanelAction>(processPanelActions.SET_INPUT_RAW(getRawInputs(containerRequest)));
+ dispatch<ProcessPanelAction>(processPanelActions.SET_INPUT_PARAMS(formatInputData(getInputs(containerRequest), getState().auth)));
+ };
+
+export const loadOutputs =
+ (containerRequest: ContainerRequestResource) => async (dispatch: Dispatch<any>, getState: () => RootState, services: ServiceRepository) => {
+ const noOutputs = { rawOutputs: {} };
+
+ if (!containerRequest.outputUuid) {
+ dispatch<ProcessPanelAction>(processPanelActions.SET_OUTPUT_RAW({ uuid: containerRequest.uuid, outputRaw: noOutputs }));
+ return;
+ }
+ try {
+ const propsOutputs = getRawOutputs(containerRequest);
+ const filesPromise = services.collectionService.files(containerRequest.outputUuid);
+ const collectionPromise = services.collectionService.get(containerRequest.outputUuid);
+ const [files, collection] = await Promise.all([filesPromise, collectionPromise]);
+
+ // If has propsOutput, skip fetching cwl.output.json
+ if (propsOutputs !== undefined) {
+ dispatch<ProcessPanelAction>(
+ processPanelActions.SET_OUTPUT_RAW({
+ rawOutputs: propsOutputs,
+ pdh: collection.portableDataHash,
+ })
+ );
+ } else {
+ // Fetch outputs from keep
+ const outputFile = files.find(file => file.name === "cwl.output.json") as CollectionFile | undefined;
+ let outputData = outputFile ? await services.collectionService.getFileContents(outputFile) : undefined;
+ if (outputData && (outputData = JSON.parse(outputData)) && collection.portableDataHash) {
+ dispatch<ProcessPanelAction>(
+ processPanelActions.SET_OUTPUT_RAW({
+ uuid: containerRequest.uuid,
+ outputRaw: { rawOutputs: outputData, pdh: collection.portableDataHash },
+ })
+ );
+ } else {
+ dispatch<ProcessPanelAction>(processPanelActions.SET_OUTPUT_RAW({ uuid: containerRequest.uuid, outputRaw: noOutputs }));
+ }
+ }
+ } catch {
+ dispatch<ProcessPanelAction>(processPanelActions.SET_OUTPUT_RAW({ uuid: containerRequest.uuid, outputRaw: noOutputs }));
+ }