Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima <ldipentima@veritasgenetics.com>
description: string;
definition: string;
}
-export interface WorkflowResoruceDefinition {
+export interface WorkflowResourceDefinition {
cwlVersion: string;
- graph?: Array<Workflow | CommandLineTool>;
$graph?: Array<Workflow | CommandLineTool>;
}
export interface Workflow {
export type WorkflowInputsData = {
[key: string]: boolean | number | string | File | Directory;
};
-export const parseWorkflowDefinition = (workflow: WorkflowResource): WorkflowResoruceDefinition => {
+export const parseWorkflowDefinition = (workflow: WorkflowResource): WorkflowResourceDefinition => {
const definition = safeLoad(workflow.definition);
return definition;
};
-export const getWorkflowInputs = (workflowDefinition: WorkflowResoruceDefinition) => {
- if (workflowDefinition.graph) {
- const mainWorkflow = workflowDefinition.graph.find(item => item.class === 'Workflow' && item.id === '#main');
- return mainWorkflow
- ? mainWorkflow.inputs
- : undefined;
- } else {
- const mainWorkflow = workflowDefinition.$graph!.find(item => item.class === 'Workflow' && item.id === '#main');
- return mainWorkflow
- ? mainWorkflow.inputs
- : undefined;
- }
+export const getWorkflowInputs = (workflowDefinition: WorkflowResourceDefinition) => {
+ const mainWorkflow = workflowDefinition.$graph!.find(item => item.class === 'Workflow' && item.id === '#main');
+ return mainWorkflow
+ ? mainWorkflow.inputs
+ : undefined;
};
export const getInputLabel = (input: CommandInputParameter) => {
const process = getProcess(processUuid)(getState().resources);
if (process) {
const data: any = process;
- if (data && data.containerRequest.mounts.varLibCwlWorkflowJson && data.containerRequest.mounts.varLibCwlWorkflowJson.content.graph.filter((a: any) => a.class === 'Workflow')[0] && data.containerRequest.mounts.varLibCwlWorkflowJson.content.graph.filter((a: any) => a.class === 'Workflow')[0].inputs.length > 0) {
+ if (data && data.containerRequest.mounts["/var/lib/cwl/workflow.json"] && data.containerRequest.mounts["/var/lib/cwl/workflow.json"].content.$graph.find((a: any) => a.class === 'Workflow' && a.id === '#main') && data.containerRequest.mounts["/var/lib/cwl/workflow.json"].content.$graph.find((a: any) => a.class === 'Workflow' && a.id === '#main').inputs.length > 0) {
dispatch(dialogActions.OPEN_DIALOG({ id: PROCESS_INPUT_DIALOG_NAME, data }));
} else {
dispatch(snackbarActions.OPEN_SNACKBAR({ message: 'There are no inputs in this process!', kind: SnackbarKind.ERROR }));
}
}
- };
\ No newline at end of file
+ };
\ No newline at end of file
import { navigateToRunProcess } from '~/store/navigation/navigation-action';
import { goToStep, runProcessPanelActions } from '~/store/run-process-panel/run-process-panel-actions';
import { getResource } from '~/store/resources/resources';
-import { getInputValue } from "~/views-components/process-input-dialog/process-input-dialog";
import { initialize } from "redux-form";
import { RUN_PROCESS_BASIC_FORM, RunProcessBasicFormData } from "~/views/run-process-panel/run-process-basic-form";
import { RunProcessAdvancedFormData, RUN_PROCESS_ADVANCED_FORM } from "~/views/run-process-panel/run-process-advanced-form";
const workflow = workflows.find(workflow => workflow.uuid === workflowUuid);
if (workflow && process) {
const newValues = getInputs(process);
- process.mounts.varLibCwlWorkflowJson.content.graph[1].inputs = newValues;
- const stringifiedDefinition = JSON.stringify(process.mounts.varLibCwlWorkflowJson.content);
+ process.mounts["/var/lib/cwl/workflow.json"].content.$graph.find(
+ (a: any) => a.id === '#main').inputs = newValues;
+ const stringifiedDefinition = JSON.stringify(process.mounts["/var/lib/cwl/workflow.json"].content);
const newWorkflow = { ...workflow, definition: stringifiedDefinition };
const basicInitialData: RunProcessBasicFormData = { name: `Copy of: ${process.name}`, description: process.description };
};
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 }
- )) : [];
+ data && data.mounts["/var/lib/cwl/workflow.json"] ? data.mounts["/var/lib/cwl/workflow.json"].content.$graph.find(
+ (a: any) => a.id === '#main').inputs.map(
+ (it: any) => (
+ {
+ type: it.type,
+ id: it.id,
+ label: it.label,
+ default: data.mounts["/var/lib/cwl/cwl.input.json"].content[it.id],
+ doc: it.doc
+ }
+ )
+ ) : [];
export const openRemoveProcessDialog = (uuid: string) =>
(dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => {
);
const getInputs = (data: any) =>
- data && data.mounts.varLibCwlWorkflowJson ? data.mounts.varLibCwlWorkflowJson.content.graph.filter((a: any) => a.class === 'Workflow')[0].inputs.map((it: any) => (
- { type: it.type, id: it.id, label: it.label, value: getInputValue(it.id, data.mounts.varLibCwlCwlInputJson.content), disabled: true }
- )) : [];
-
-const snakeToCamel = (s: string) => {
- const a = s.split('/');
- return a[1].replace(/(\_\w)/g, (m: string) => m[1].toUpperCase());
-};
-
-export const getInputValue = (id: string, data: any) => {
- const a = snakeToCamel(id);
- return data[a];
-};
\ No newline at end of file
+ data && data.mounts["/var/lib/cwl/workflow.json"] ? data.mounts["/var/lib/cwl/workflow.json"].content.$graph.find(
+ (a: any) => a.id === '#main').inputs.map(
+ (it: any) => (
+ {
+ type: it.type,
+ id: it.id,
+ label: it.label,
+ value: data.mounts["/var/lib/cwl/cwl.input.json"].content[it.id],
+ disabled: true
+ }
+ )
+ ) : [];