1 // Copyright (C) The Arvados Authors. All rights reserved.
3 // SPDX-License-Identifier: AGPL-3.0
5 import * as React from 'react';
6 import { IntCommandInputParameter, getInputLabel } from '~/models/workflow';
7 import { Field } from 'redux-form';
8 import { TextField } from '~/components/text-field/text-field';
9 import { isInteger } from '~/validators/is-integer';
11 export interface IntInputProps {
12 input: IntCommandInputParameter;
14 export const IntInput = ({ input }: IntInputProps) =>
17 label={getInputLabel(input)}
19 parse={value => parseInt(value, 10)}
20 format={value => isNaN(value) ? '' : JSON.stringify(value)}
21 validate={[isInteger]} />;