X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/6653b7a7edbac351f5b3734114d6b5904dda1acc..00ddf216e1a5046a858b1c8b49f0e967404474ca:/src/models/workflow.ts diff --git a/src/models/workflow.ts b/src/models/workflow.ts index 95cc926fbd..d7d97c4c96 100644 --- a/src/models/workflow.ts +++ b/src/models/workflow.ts @@ -107,6 +107,9 @@ export type StringArrayCommandInputParameter = GenericArrayCommandInputParameter export type FileArrayCommandInputParameter = GenericArrayCommandInputParameter; export type DirectoryArrayCommandInputParameter = GenericArrayCommandInputParameter; +export type WorkflowInputsData = { + [key: string]: boolean | number | string | File | Directory; +}; export const parseWorkflowDefinition = (workflow: WorkflowResource): WorkflowResoruceDefinition => { const definition = safeLoad(workflow.definition); return definition; @@ -118,6 +121,25 @@ export const getWorkflowInputs = (workflowDefinition: WorkflowResoruceDefinition ? mainWorkflow.inputs : undefined; }; +export const getInputLabel = (input: CommandInputParameter) => { + return `${input.label || input.id}`; +}; + +export const isRequiredInput = ({ type }: CommandInputParameter) => { + if (type instanceof Array) { + for (const t of type) { + if (t === CWLType.NULL) { + return false; + } + } + } + return true; +}; + +export const isPrimitiveOfType = (input: GenericCommandInputParameter, type: CWLType) => + input.type instanceof Array + ? input.type.indexOf(type) > -1 + : input.type === type; export const stringifyInputType = ({ type }: CommandInputParameter) => { if (typeof type === 'string') {