1 // Copyright (C) The Arvados Authors. All rights reserved.
3 // SPDX-License-Identifier: AGPL-3.0
5 import * as React from 'react';
6 import { memoize } from 'lodash/fp';
7 import { isRequiredInput, StringCommandInputParameter } from '~/models/workflow';
8 import { Field } from 'redux-form';
9 import { require } from '~/validators/require';
10 import { GenericInputProps, GenericInput } from '~/views/run-process-panel/inputs/generic-input';
11 import { Input as MaterialInput } from '@material-ui/core';
13 export interface StringInputProps {
14 input: StringCommandInputParameter;
16 export const StringInput = ({ input }: StringInputProps) =>
20 component={StringInputComponent}
21 validate={getValidation(input)} />;
23 const getValidation = memoize(
24 (input: StringCommandInputParameter) => ([
25 isRequiredInput(input)
30 const StringInputComponent = (props: GenericInputProps) =>
35 const Input = (props: GenericInputProps) =>
38 error={props.meta.touched && !!props.meta.error}
39 disabled={props.commandInput.disabled}