1 // Copyright (C) The Arvados Authors. All rights reserved.
3 // SPDX-License-Identifier: AGPL-3.0
5 import * as React from 'react';
6 import { WrappedFieldProps } from 'redux-form';
7 import { FormGroup, FormLabel, Input, FormHelperText } from '@material-ui/core';
8 import { GenericCommandInputParameter, getInputLabel } from '../../../models/workflow';
10 export type GenericInputProps = WrappedFieldProps & {
11 commandInput: GenericCommandInputParameter<any, any>;
14 type GenericInputContainerProps = GenericInputProps & {
15 component: React.ComponentType<GenericInputProps>;
17 export const GenericInput = ({ component: Component, ...props }: GenericInputContainerProps) => {
19 <FormLabel error={props.meta.touched && props.meta.error}>{getInputLabel(props.commandInput)}</FormLabel>
20 <Component {...props} />
21 <FormHelperText error={props.meta.touched && props.meta.error}>
23 props.meta.touched && props.meta.error
25 : props.commandInput.doc