From: Michal Klobukowski Date: Thu, 29 Nov 2018 13:33:00 +0000 (+0100) Subject: Extract IntInput's parse function X-Git-Tag: 1.3.0~1^2~4 X-Git-Url: https://git.arvados.org/arvados-workbench2.git/commitdiff_plain/fa9e1f065eefa7265879869e4b45eb76be64b4ce Extract IntInput's parse function Feature #14524 Arvados-DCO-1.1-Signed-off-by: Michal Klobukowski --- 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) =>