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, isRequiredInput } from '~/models/workflow';
7 import { Field } from 'redux-form';
8 import { isInteger } from '~/validators/is-integer';
9 import { GenericInputProps, GenericInput } from '~/views/run-process-panel/inputs/generic-input';
10 import { Input as MaterialInput } from '@material-ui/core';
12 export interface IntInputProps {
13 input: IntCommandInputParameter;
15 export const IntInput = ({ input }: IntInputProps) =>
19 component={IntInputComponent}
20 parse={value => parseInt(value, 10)}
21 format={value => isNaN(value) ? '' : JSON.stringify(value)}
23 isRequiredInput(input)
28 const IntInputComponent = (props: GenericInputProps) =>
34 const Input = (props: GenericInputProps) =>
35 <MaterialInput fullWidth type='number' {...props.input} error={props.meta.touched && !!props.meta.error} />;