[arvados-workbench2] created: 2.5.0-102-g8e54bebd

git repository hosting git at public.arvados.org
Mon Mar 20 17:55:55 UTC 2023


        at  8e54bebd8a2e59318e50d7dd26ba1b71e1fe20ab (commit)


commit 8e54bebd8a2e59318e50d7dd26ba1b71e1fe20ab
Author: Stephen Smith <stephen at curii.com>
Date:   Mon Mar 20 13:54:30 2023 -0400

    19969: Pass required prop to generic input to allow disabling required asterisk on non-required fields
    
    Arvados-DCO-1.1-Signed-off-by: Stephen Smith <stephen at curii.com>

diff --git a/src/views-components/form-fields/search-bar-form-fields.tsx b/src/views-components/form-fields/search-bar-form-fields.tsx
index be28ba2a..47633a0b 100644
--- a/src/views-components/form-fields/search-bar-form-fields.tsx
+++ b/src/views-components/form-fields/search-bar-form-fields.tsx
@@ -47,7 +47,7 @@ export const SearchBarClusterField = connect(
     );
 
 export const SearchBarProjectField = () =>
-    <ProjectInput input={{
+    <ProjectInput required={false} input={{
         id: "projectObject",
         label: "Limit search to Project"
     } as ProjectCommandInputParameter}
diff --git a/src/views/run-process-panel/inputs/generic-input.tsx b/src/views/run-process-panel/inputs/generic-input.tsx
index 8ca4ec89..963998f1 100644
--- a/src/views/run-process-panel/inputs/generic-input.tsx
+++ b/src/views/run-process-panel/inputs/generic-input.tsx
@@ -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
+};
diff --git a/src/views/run-process-panel/inputs/project-input.tsx b/src/views/run-process-panel/inputs/project-input.tsx
index 97028fc9..279e399c 100644
--- a/src/views/run-process-panel/inputs/project-input.tsx
+++ b/src/views/run-process-panel/inputs/project-input.tsx
@@ -37,9 +37,10 @@ export const ProjectInput = ({ required, input, options }: ProjectInputProps) =>
         commandInput={input}
         component={ProjectInputComponent as any}
         format={format}
-        validate={required ? require : undefined}
+        validate={required !== undefined ? require : undefined}
         {...{
-            options
+            options,
+            required
         }} />;
 
 const format = (value?: ProjectResource) => value ? value.name : '';
@@ -58,6 +59,7 @@ const mapStateToProps = (state: RootState) => ({ userUuid: getUserUuid(state) })
 export const ProjectInputComponent = connect(mapStateToProps)(
     class ProjectInputComponent extends React.Component<GenericInputProps & DispatchProp & HasUserUuid & {
         options?: { showOnlyOwned: boolean, showOnlyWritable: boolean };
+        required?: boolean;
     }, ProjectInputComponentState> {
         state: ProjectInputComponentState = {
             open: false,

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list