X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/e9d30481d8d57a0b906364ee115e136305b7ce79..598e2bcda179324f0457f6e15cdd2f2a8785374d:/src/views/run-process-panel/inputs/int-input.tsx?ds=sidebyside diff --git a/src/views/run-process-panel/inputs/int-input.tsx b/src/views/run-process-panel/inputs/int-input.tsx index 410d2dfebf..cac8a27c7d 100644 --- a/src/views/run-process-panel/inputs/int-input.tsx +++ b/src/views/run-process-panel/inputs/int-input.tsx @@ -3,7 +3,7 @@ // SPDX-License-Identifier: AGPL-3.0 import * as React from 'react'; -import { IntCommandInputParameter, getInputLabel, isRequiredInput } from '~/models/workflow'; +import { IntCommandInputParameter, isRequiredInput } from '~/models/workflow'; import { Field } from 'redux-form'; import { isInteger } from '~/validators/is-integer'; import { GenericInputProps, GenericInput } from '~/views/run-process-panel/inputs/generic-input'; @@ -17,14 +17,18 @@ export const IntInput = ({ input }: IntInputProps) => name={input.id} commandInput={input} component={InputComponent} - parse={value => parseInt(value, 10)} - format={value => isNaN(value) ? '' : JSON.stringify(value)} + parse={parse} + format={format} validate={[ isRequiredInput(input) ? isInteger : () => undefined, ]} />; +const parse = (value: any) => parseInt(value, 10); + +const format = (value: any) => isNaN(value) ? '' : JSON.stringify(value); + const InputComponent = (props: GenericInputProps) => const Input = (props: GenericInputProps) => - ; + ;