diff --git a/awx/ui_next/src/screens/Inventory/shared/InventorySourceSubForms/SCMSubForm.jsx b/awx/ui_next/src/screens/Inventory/shared/InventorySourceSubForms/SCMSubForm.jsx index 9b6fbb7ba5..dbc36f19ca 100644 --- a/awx/ui_next/src/screens/Inventory/shared/InventorySourceSubForms/SCMSubForm.jsx +++ b/awx/ui_next/src/screens/Inventory/shared/InventorySourceSubForms/SCMSubForm.jsx @@ -38,9 +38,9 @@ const SCMSubForm = ({ i18n }) => { const handleProjectUpdate = useCallback( value => { + sourcePathHelpers.setValue(''); projectHelpers.setValue(value); fetchSourcePath(value.id); - sourcePathHelpers.setValue(''); }, [] // eslint-disable-line react-hooks/exhaustive-deps ); @@ -67,9 +67,8 @@ const SCMSubForm = ({ i18n }) => { fieldId="source_path" helperTextInvalid={sourcePathError?.message || sourcePathMeta.error} isValid={ - !sourcePathError?.message || - !sourcePathMeta.error || - !sourcePathMeta.touched + (!sourcePathMeta.error || !sourcePathMeta.touched) && + !sourcePathError?.message } isRequired label={i18n._(t`Inventory file`)} @@ -82,7 +81,10 @@ const SCMSubForm = ({ i18n }) => { { label={i18n._(t`Verbosity`)} > { export const OptionsField = withI18n()(({ i18n }) => { const [updateOnLaunchField] = useField('update_on_launch'); + const [, , updateCacheTimeoutHelper] = useField('update_cache_timeout'); + + useEffect(() => { + if (!updateOnLaunchField.value) { + updateCacheTimeoutHelper.setValue(0); + } + }, [updateOnLaunchField.value]); // eslint-disable-line react-hooks/exhaustive-deps + return ( <> @@ -123,6 +132,8 @@ export const OptionsField = withI18n()(({ i18n }) => { name="update_cache_timeout" type="number" min="0" + max="2147483647" + validate={minMaxValue(0, 2147483647, i18n)} label={i18n._(t`Cache timeout (seconds)`)} tooltip={i18n._(t`Time in seconds to consider an inventory sync to be current. During job runs and callbacks the task system will