From 8e54bebd8a2e59318e50d7dd26ba1b71e1fe20ab Mon Sep 17 00:00:00 2001 From: Stephen Smith Date: Mon, 20 Mar 2023 13:54:30 -0400 Subject: [PATCH] 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 --- src/views-components/form-fields/search-bar-form-fields.tsx | 2 +- src/views/run-process-panel/inputs/generic-input.tsx | 5 +++-- src/views/run-process-panel/inputs/project-input.tsx | 6 ++++-- 3 files changed, 8 insertions(+), 5 deletions(-) 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 = () => - ; + required?: boolean; }; export const GenericInput = ({ component: Component, ...props }: GenericInputContainerProps) => { return {getInputLabel(props.commandInput)} @@ -31,4 +32,4 @@ export const GenericInput = ({ component: Component, ...props }: GenericInputCon } ; -}; \ 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 { state: ProjectInputComponentState = { open: false, -- 2.30.2