[ARVADOS-WORKBENCH2] updated: 1.2.0-502-gf0553f7
Git user
git at public.curoverse.com
Mon Oct 1 05:27:11 EDT 2018
Summary of changes:
.../run-process-panel/run-process-inputs-form.tsx | 53 ++++++++++++----------
1 file changed, 30 insertions(+), 23 deletions(-)
via f0553f71caddcf44371c616e7177c2716b6bcb88 (commit)
from 81eb1ca6ea7faa2b8f2646f61cc00885d4cfcb83 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
commit f0553f71caddcf44371c616e7177c2716b6bcb88
Author: Michal Klobukowski <michal.klobukowski at contractors.roche.com>
Date: Mon Oct 1 11:26:53 2018 +0200
Populate form with default values
Feature #13863
Arvados-DCO-1.1-Signed-off-by: Michal Klobukowski <michal.klobukowski at contractors.roche.com>
diff --git a/src/views/run-process-panel/run-process-inputs-form.tsx b/src/views/run-process-panel/run-process-inputs-form.tsx
index 0e53320..90bb8c2 100644
--- a/src/views/run-process-panel/run-process-inputs-form.tsx
+++ b/src/views/run-process-panel/run-process-inputs-form.tsx
@@ -11,6 +11,7 @@ import { StringCommandInputParameter, FloatCommandInputParameter, File } from '.
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';
const RUN_PROCESS_INPUTS_FORM = 'runProcessInputsForm';
@@ -18,26 +19,32 @@ export interface RunProcessInputFormProps {
inputs: CommandInputParameter[];
}
-export const RunProcessInputsForm = reduxForm<any, RunProcessInputFormProps>({
- form: RUN_PROCESS_INPUTS_FORM
-})((props: InjectedFormProps & RunProcessInputFormProps) =>
- <form>
- {props.inputs.map(input => {
- switch (true) {
- case input.type === CWLType.BOOLEAN:
- return <BooleanInput key={input.id} input={input as BooleanCommandInputParameter} />;
- case input.type === CWLType.INT:
- case input.type === CWLType.LONG:
- return <IntInput key={input.id} input={input as IntCommandInputParameter} />;
- case input.type === CWLType.FLOAT:
- case input.type === CWLType.DOUBLE:
- return <FloatInput key={input.id} input={input as FloatCommandInputParameter} />;
- case input.type === CWLType.STRING:
- return <StringInput key={input.id} input={input as StringCommandInputParameter} />;
- case input.type === CWLType.FILE:
- return <FileInput key={input.id} input={input as FileCommandInputParameter} />;
- default:
- return null;
- }
- })}
- </form>);
\ No newline at end of file
+export const RunProcessInputsForm = connect(
+ (_: any, props: RunProcessInputFormProps) => ({
+ initialValues: props.inputs.reduce(
+ (values, input) => ({ ...values, [input.id]: input.default }),
+ {}),
+ }))(
+ reduxForm<any, RunProcessInputFormProps>({
+ form: RUN_PROCESS_INPUTS_FORM
+ })((props: InjectedFormProps & RunProcessInputFormProps) =>
+ <form>
+ {props.inputs.map(input => {
+ switch (true) {
+ case input.type === CWLType.BOOLEAN:
+ return <BooleanInput key={input.id} input={input as BooleanCommandInputParameter} />;
+ case input.type === CWLType.INT:
+ case input.type === CWLType.LONG:
+ return <IntInput key={input.id} input={input as IntCommandInputParameter} />;
+ case input.type === CWLType.FLOAT:
+ case input.type === CWLType.DOUBLE:
+ return <FloatInput key={input.id} input={input as FloatCommandInputParameter} />;
+ case input.type === CWLType.STRING:
+ return <StringInput key={input.id} input={input as StringCommandInputParameter} />;
+ case input.type === CWLType.FILE:
+ return <FileInput key={input.id} input={input as FileCommandInputParameter} />;
+ default:
+ return null;
+ }
+ })}
+ </form>));
\ No newline at end of file
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list