X-Git-Url: https://git.arvados.org/arvados-workbench2.git/blobdiff_plain/dbca22d752af6473a39e4f67c5fc0be355c80eaf..b321c4ab41ef13dfb43c7e64aee395c4db161872:/src/views/run-process-panel/inputs/int-input.tsx diff --git a/src/views/run-process-panel/inputs/int-input.tsx b/src/views/run-process-panel/inputs/int-input.tsx index 32ebeb75..aa4fe9bb 100644 --- a/src/views/run-process-panel/inputs/int-input.tsx +++ b/src/views/run-process-panel/inputs/int-input.tsx @@ -2,13 +2,13 @@ // // SPDX-License-Identifier: AGPL-3.0 -import * as React from 'react'; +import React from 'react'; import { memoize } from 'lodash/fp'; -import { IntCommandInputParameter, 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'; -import { IntInput as IntInputComponent } from '~/components/int-input/int-input'; +import { isInteger } from 'validators/is-integer'; +import { GenericInputProps, GenericInput } from 'views/run-process-panel/inputs/generic-input'; +import { IntInput as IntInputComponent } from 'components/int-input/int-input'; export interface IntInputProps { input: IntCommandInputParameter; @@ -22,9 +22,9 @@ export const IntInput = ({ input }: IntInputProps) => format={format} validate={getValidation(input)} />; -const parse = (value: any) => parseInt(value, 10); +export const parse = (value: any) => value === '' ? '' : parseInt(value, 10); -const format = (value: any) => isNaN(value) ? '' : JSON.stringify(value); +export const format = (value: any) => isNaN(value) ? '' : JSON.stringify(value); const getValidation = memoize( (input: IntCommandInputParameter) => ([