From fa9e1f065eefa7265879869e4b45eb76be64b4ce Mon Sep 17 00:00:00 2001 From: Michal Klobukowski Date: Thu, 29 Nov 2018 14:33:00 +0100 Subject: [PATCH] Extract IntInput's parse function Feature #14524 Arvados-DCO-1.1-Signed-off-by: Michal Klobukowski --- src/views/run-process-panel/inputs/int-input.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/views/run-process-panel/inputs/int-input.tsx b/src/views/run-process-panel/inputs/int-input.tsx index 413ee49c..6758bae6 100644 --- a/src/views/run-process-panel/inputs/int-input.tsx +++ b/src/views/run-process-panel/inputs/int-input.tsx @@ -17,7 +17,7 @@ export const IntInput = ({ input }: IntInputProps) => name={input.id} commandInput={input} component={InputComponent} - parse={value => parseInt(value, 10)} + parse={parse} format={value => isNaN(value) ? '' : JSON.stringify(value)} validate={[ isRequiredInput(input) @@ -25,6 +25,8 @@ export const IntInput = ({ input }: IntInputProps) => : () => undefined, ]} />; +const parse = (value: any) => parseInt(value, 10); + const InputComponent = (props: GenericInputProps) =>