-const getInputs = (data: any) =>
- data && data.mounts.varLibCwlWorkflowJson ? data.mounts.varLibCwlWorkflowJson.content.graph[1].inputs.map((it: any) => (
- { type: it.type, id: it.id, label: it.label, default: getInputValue(it.id, data.mounts.varLibCwlCwlInputJson.content), doc: it.doc }
- )) : [];
-
-export const openRemoveProcessDialog = (uuid: string) =>
- (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => {
- dispatch(dialogActions.OPEN_DIALOG({
- id: REMOVE_PROCESS_DIALOG,
- data: {
- title: 'Remove process permanently',
- text: 'Are you sure you want to remove this process?',
- confirmButtonLabel: 'Remove',
- uuid
- }
+/*
+ * Fetches raw inputs from containerRequest mounts with fallback to properties
+ * Returns undefined if containerRequest not loaded
+ * Returns {} if inputs not found in mounts or props
+ */
+export const getRawInputs = (data: any): WorkflowInputsData | undefined => {
+ if (!data) {
+ return undefined;
+ }
+ const mountInput = data.mounts?.[MOUNT_PATH_CWL_INPUT]?.content;
+ const propsInput = data.properties?.cwl_input;
+ if (!mountInput && !propsInput) {
+ return {};
+ }
+ return mountInput || propsInput;
+};
+
+export const getInputs = (data: any): CommandInputParameter[] => {
+ // Definitions from mounts are needed so we return early if missing
+ if (!data || !data.mounts || !data.mounts[MOUNT_PATH_CWL_WORKFLOW]) {
+ return [];
+ }
+ const content = getRawInputs(data) as any;
+ // Only escape if content is falsy to allow displaying definitions if no inputs are present
+ // (Don't check raw content length)
+ if (!content) {
+ return [];
+ }
+
+ const inputs = getWorkflowInputs(data.mounts[MOUNT_PATH_CWL_WORKFLOW].content);
+ return inputs
+ ? inputs.map((it: any) => ({
+ type: it.type,
+ id: it.id,
+ label: it.label,
+ default: content[it.id],
+ value: content[it.id.split("/").pop()] || [],
+ doc: it.doc,
+ }))
+ : [];
+};
+
+/*
+ * Fetches raw outputs from containerRequest properties
+ * Assumes containerRequest is loaded
+ */
+export const getRawOutputs = (data: any): CommandInputParameter[] | undefined => {
+ if (!data || !data.properties || !data.properties.cwl_output) {
+ return undefined;
+ }
+ return data.properties.cwl_output;
+};
+
+export type InputCollectionMount = {
+ path: string;
+ pdh: string;
+};
+
+export const getInputCollectionMounts = (data: any): InputCollectionMount[] => {
+ if (!data || !data.mounts) {
+ return [];
+ }
+ return Object.keys(data.mounts)
+ .map(key => ({
+ ...data.mounts[key],
+ path: key,
+ }))
+ .filter(mount => mount.kind === "collection" && mount.portable_data_hash && mount.path)
+ .map(mount => ({
+ path: mount.path,
+ pdh: mount.portable_data_hash,