Merge branch '21128-toolbar-context-menu'
[arvados-workbench2.git] / src / views / run-process-panel / inputs / generic-input.tsx
index a449c657ffe0adb39594ac61249c96e6d34ef1f2..963998f1e5504b11f4cdb3a38ab20f88f6f161cc 100644 (file)
@@ -2,10 +2,10 @@
 //
 // SPDX-License-Identifier: AGPL-3.0
 
-import * as React from 'react';
+import React from 'react';
 import { WrappedFieldProps } from 'redux-form';
-import { FormGroup, FormLabel, Input, FormHelperText, FormControl } from '@material-ui/core';
-import { GenericCommandInputParameter, getInputLabel, isRequiredInput } from '../../../models/workflow';
+import { FormGroup, FormLabel, FormHelperText } from '@material-ui/core';
+import { GenericCommandInputParameter, getInputLabel, isRequiredInput } from 'models/workflow';
 
 export type GenericInputProps = WrappedFieldProps & {
     commandInput: GenericCommandInputParameter<any, any>;
@@ -13,12 +13,13 @@ export type GenericInputProps = WrappedFieldProps & {
 
 type GenericInputContainerProps = GenericInputProps & {
     component: React.ComponentType<GenericInputProps>;
+    required?: boolean;
 };
 export const GenericInput = ({ component: Component, ...props }: GenericInputContainerProps) => {
     return <FormGroup>
         <FormLabel
             focused={props.meta.active}
-            required={isRequiredInput(props.commandInput)}
+            required={props.required !== undefined ? props.required : isRequiredInput(props.commandInput)}
             error={props.meta.touched && !!props.meta.error}>
             {getInputLabel(props.commandInput)}
         </FormLabel>
@@ -31,4 +32,4 @@ export const GenericInput = ({ component: Component, ...props }: GenericInputCon
             }
         </FormHelperText>
     </FormGroup>;
-};
\ No newline at end of file
+};