X-Git-Url: https://git.arvados.org/arvados-workbench2.git/blobdiff_plain/428d454e2681d66bb14558946cfe2fb77a2c8dce..refs/heads/14433_properties_inside_projects:/src/models/workflow.ts diff --git a/src/models/workflow.ts b/src/models/workflow.ts index 1cb3d46e..3a38348e 100644 --- a/src/models/workflow.ts +++ b/src/models/workflow.ts @@ -41,6 +41,8 @@ export type CommandInputParameter = FileCommandInputParameter | DirectoryCommandInputParameter | StringArrayCommandInputParameter | + IntArrayCommandInputParameter | + FloatArrayCommandInputParameter | FileArrayCommandInputParameter | DirectoryArrayCommandInputParameter | EnumCommandInputParameter; @@ -90,6 +92,8 @@ export interface GenericCommandInputParameter { doc?: string | string[]; default?: Value; type?: Type | Array; + value?: Value; + disabled?: boolean; } export type GenericArrayCommandInputParameter = GenericCommandInputParameter, Value[]>; @@ -104,9 +108,14 @@ export type DirectoryCommandInputParameter = GenericCommandInputParameter; export type StringArrayCommandInputParameter = GenericArrayCommandInputParameter; +export type IntArrayCommandInputParameter = GenericArrayCommandInputParameter; +export type FloatArrayCommandInputParameter = 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; @@ -119,7 +128,7 @@ export const getWorkflowInputs = (workflowDefinition: WorkflowResoruceDefinition : undefined; }; export const getInputLabel = (input: CommandInputParameter) => { - return `${input.label || input.id}${isRequiredInput(input) ? '*' : ''}`; + return `${input.label || input.id}`; }; export const isRequiredInput = ({ type }: CommandInputParameter) => { @@ -132,6 +141,18 @@ export const isRequiredInput = ({ type }: CommandInputParameter) => { } return true; }; + +export const isPrimitiveOfType = (input: GenericCommandInputParameter, type: CWLType) => + input.type instanceof Array + ? input.type.indexOf(type) > -1 + : input.type === type; + +export const isArrayOfType = (input: GenericCommandInputParameter, type: CWLType) => + typeof input.type === 'object' && + input.type.type === 'array' + ? input.type.items === type + : false; + export const stringifyInputType = ({ type }: CommandInputParameter) => { if (typeof type === 'string') { return type;