From a8187ba6c1780cef4de40729cbd3875a9d3dafc4 Mon Sep 17 00:00:00 2001 From: Michal Klobukowski Date: Thu, 29 Nov 2018 14:29:22 +0100 Subject: [PATCH] Extract FloatInput's format function Feature #14524 Arvados-DCO-1.1-Signed-off-by: Michal Klobukowski --- src/views/run-process-panel/inputs/float-input.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/views/run-process-panel/inputs/float-input.tsx b/src/views/run-process-panel/inputs/float-input.tsx index 56a58012b2..fae8f605e4 100644 --- a/src/views/run-process-panel/inputs/float-input.tsx +++ b/src/views/run-process-panel/inputs/float-input.tsx @@ -17,12 +17,14 @@ export const FloatInput = ({ input }: FloatInputProps) => commandInput={input} component={Input} parse={parseFloat} - format={value => isNaN(value) ? '' : JSON.stringify(value)} + format={format} validate={[ isRequiredInput(input) ? isNumber : () => undefined,]} />; +const format = (value: any) => isNaN(value) ? '' : JSON.stringify(value); + const Input = (props: GenericInputProps) =>