mirror of
https://github.com/ansible/awx.git
synced 2026-01-11 18:09:57 -03:30
Merge pull request #8282 from marshmalien/8044-inventory-file-bug
Fix inventory file dropdown placeholder value Reviewed-by: https://github.com/apps/softwarefactory-project-zuul
This commit is contained in:
commit
bd224a75db
@ -47,6 +47,7 @@ const InventorySourceFormFields = ({ source, sourceOptions, i18n }) => {
|
||||
values,
|
||||
initialValues,
|
||||
resetForm,
|
||||
setFieldTouched,
|
||||
setFieldValue,
|
||||
} = useFormikContext();
|
||||
const [sourceField, sourceMeta] = useField({
|
||||
@ -92,6 +93,7 @@ const InventorySourceFormFields = ({ source, sourceOptions, i18n }) => {
|
||||
};
|
||||
Object.keys(defaults).forEach(label => {
|
||||
setFieldValue(label, defaults[label]);
|
||||
setFieldTouched(label, false);
|
||||
});
|
||||
}
|
||||
};
|
||||
@ -255,7 +257,7 @@ const InventorySourceForm = ({
|
||||
overwrite: source?.overwrite || false,
|
||||
overwrite_vars: source?.overwrite_vars || false,
|
||||
source: source?.source || '',
|
||||
source_path: source?.source_path === '' ? '/ (project root)' : '',
|
||||
source_path: source?.source_path || '',
|
||||
source_project: source?.summary_fields?.source_project || null,
|
||||
source_script: source?.summary_fields?.source_script || null,
|
||||
source_vars: source?.source_vars || '---\n',
|
||||
|
||||
@ -21,7 +21,7 @@ import {
|
||||
} from './SharedFields';
|
||||
|
||||
const SCMSubForm = ({ autoPopulateProject, i18n }) => {
|
||||
const { setFieldValue } = useFormikContext();
|
||||
const { setFieldValue, setFieldTouched } = useFormikContext();
|
||||
const [credentialField] = useField('credential');
|
||||
const [projectField, projectMeta, projectHelpers] = useField({
|
||||
name: 'source_project',
|
||||
@ -47,16 +47,20 @@ const SCMSubForm = ({ autoPopulateProject, i18n }) => {
|
||||
useEffect(() => {
|
||||
if (projectMeta.initialValue) {
|
||||
fetchSourcePath(projectMeta.initialValue.id);
|
||||
}
|
||||
if (sourcePathField.value === '') {
|
||||
sourcePathHelpers.setValue('/ (project root)');
|
||||
}
|
||||
} // eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [fetchSourcePath, projectMeta.initialValue]);
|
||||
|
||||
const handleProjectUpdate = useCallback(
|
||||
value => {
|
||||
setFieldValue('source_path', '');
|
||||
setFieldValue('source_project', value);
|
||||
setFieldValue('source_path', '');
|
||||
setFieldTouched('source_path', false);
|
||||
fetchSourcePath(value.id);
|
||||
},
|
||||
[fetchSourcePath, setFieldValue]
|
||||
[fetchSourcePath, setFieldValue, setFieldTouched]
|
||||
);
|
||||
|
||||
const handleCredentialUpdate = useCallback(
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user