initWebSocket(config, services.authService, store);
await store.dispatch(loadWorkbench());
addRouteChangeHandlers(history, store);
-
+ // createEnumCollectorWorkflow(services);
}
};
};
-const createSampleWorkflow = ({workflowService}:ServiceRepository) => {
+const createPrimitivesCollectorWorkflow = ({workflowService}:ServiceRepository) => {
workflowService.create({
name: 'Primitive values collector',
description: 'Workflow for collecting primitive values',
});
};
+const createEnumCollectorWorkflow = ({workflowService}:ServiceRepository) => {
+ workflowService.create({
+ name: 'Enum values collector',
+ description: 'Workflow for collecting enum values',
+ definition: "cwlVersion: v1.0\n$graph:\n- class: CommandLineTool\n requirements:\n - listing:\n - entryname: input_collector.log\n entry: |\n \"enum_type\":\n $(inputs.enum_type)\n\n class: InitialWorkDirRequirement\n inputs:\n - type:\n type: enum\n symbols: ['#input_collector.cwl/enum_type/OTU table', '#input_collector.cwl/enum_type/Pathway\n table', '#input_collector.cwl/enum_type/Function table', '#input_collector.cwl/enum_type/Ortholog\n table']\n id: '#input_collector.cwl/enum_type'\n outputs:\n - type: File\n outputBinding:\n glob: '*'\n id: '#input_collector.cwl/output'\n baseCommand: [echo]\n id: '#input_collector.cwl'\n- class: Workflow\n doc: This is the description of the workflow\n inputs:\n - type:\n type: enum\n symbols: ['#main/enum_type/OTU table', '#main/enum_type/Pathway table', '#main/enum_type/Function\n table', '#main/enum_type/Ortholog table']\n name: '#enum_typef4179c7f-45f9-482d-a5db-1abb86698384'\n label: Enumeration Type\n doc: This should render as a drop-down menu.\n id: '#main/enum_type'\n default: OTU table\n outputs:\n - type: File\n outputSource: '#main/input_collector/output'\n id: '#main/log_file'\n steps:\n - run: '#input_collector.cwl'\n in:\n - source: '#main/enum_type'\n id: '#main/input_collector/enum_type'\n out: ['#main/input_collector/output']\n id: '#main/input_collector'\n id: '#main'\n",
+ });
+};
+
const createSampleProcess = ({ containerRequestService }: ServiceRepository) => {
containerRequestService.create({
ownerUuid: 'c97qk-j7d0g-s3ngc1z0748hsmf',
--- /dev/null
+// Copyright (C) The Arvados Authors. All rights reserved.
+//
+// SPDX-License-Identifier: AGPL-3.0
+
+import * as React from 'react';
+import { EnumCommandInputParameter, CommandInputEnumSchema } from '~/models/workflow';
+import { Field } from 'redux-form';
+import { Select, MenuItem } from '@material-ui/core';
+import { GenericInputProps, GenericInput } from './generic-input';
+
+export interface EnumInputProps {
+ input: EnumCommandInputParameter;
+}
+export const EnumInput = ({ input }: EnumInputProps) =>
+ <Field
+ name={input.id}
+ commandInput={input}
+ component={EnumInputComponent}
+ />;
+
+const EnumInputComponent = (props: GenericInputProps) =>
+ <GenericInput
+ component={Input}
+ {...props} />;
+
+const Input = (props: GenericInputProps) => {
+ const type = props.commandInput.type as CommandInputEnumSchema;
+ return <Select
+ value={props.input.value}
+ onChange={props.input.onChange}>
+ {type.symbols.map(symbol =>
+ <MenuItem key={symbol} value={symbol.split('/').pop()}>
+ {symbol.split('/').pop()}
+ </MenuItem>)}
+ </Select>;
+};
\ No newline at end of file
import { CommandInputParameter, CWLType, IntCommandInputParameter, BooleanCommandInputParameter, FileCommandInputParameter } from '~/models/workflow';
import { IntInput } from '~/views/run-process-panel/inputs/int-input';
import { StringInput } from '~/views/run-process-panel/inputs/string-input';
-import { StringCommandInputParameter, FloatCommandInputParameter, isPrimitiveOfType, File, Directory, WorkflowInputsData } from '../../models/workflow';
+import { StringCommandInputParameter, FloatCommandInputParameter, isPrimitiveOfType, File, Directory, WorkflowInputsData, EnumCommandInputParameter } from '../../models/workflow';
import { FloatInput } from '~/views/run-process-panel/inputs/float-input';
import { BooleanInput } from './inputs/boolean-input';
import { FileInput } from './inputs/file-input';
import { connect } from 'react-redux';
import { compose } from 'redux';
import { Grid, StyleRulesCallback, withStyles, WithStyles } from '@material-ui/core';
+import { EnumInput } from './inputs/enum-input';
export const RUN_PROCESS_INPUTS_FORM = 'runProcessInputsForm';
case isPrimitiveOfType(input, CWLType.FILE):
return <FileInput input={input as FileCommandInputParameter} />;
+ case typeof input.type === 'object' &&
+ !(input.type instanceof Array) &&
+ input.type.type === 'enum':
+ return <EnumInput input={input as EnumCommandInputParameter} />;
+
default:
return null;
}