diff --git a/awx/ui/src/screens/Project/ProjectAdd/ProjectAdd.js b/awx/ui/src/screens/Project/ProjectAdd/ProjectAdd.js
index 9c95052e24..baf052ef09 100644
--- a/awx/ui/src/screens/Project/ProjectAdd/ProjectAdd.js
+++ b/awx/ui/src/screens/Project/ProjectAdd/ProjectAdd.js
@@ -22,15 +22,11 @@ function ProjectAdd() {
} else if (typeof values.credential.id === 'number') {
values.credential = values.credential.id;
}
- if (values.scm_type === 'git') {
- if (!values.signature_validation_credential) {
- values.signature_validation_credential = null;
- } else if (
- typeof values.signature_validation_credential.id === 'number'
- ) {
- values.signature_validation_credential =
- values.signature_validation_credential.id;
- }
+ if (!values.signature_validation_credential) {
+ values.signature_validation_credential = null;
+ } else if (typeof values.signature_validation_credential.id === 'number') {
+ values.signature_validation_credential =
+ values.signature_validation_credential.id;
}
setFormSubmitError(null);
try {
diff --git a/awx/ui/src/screens/Project/ProjectEdit/ProjectEdit.js b/awx/ui/src/screens/Project/ProjectEdit/ProjectEdit.js
index dd3c6b85e0..f2ed08cbe8 100644
--- a/awx/ui/src/screens/Project/ProjectEdit/ProjectEdit.js
+++ b/awx/ui/src/screens/Project/ProjectEdit/ProjectEdit.js
@@ -22,15 +22,11 @@ function ProjectEdit({ project }) {
} else if (typeof values.credential.id === 'number') {
values.credential = values.credential.id;
}
- if (values.scm_type === 'git') {
- if (!values.signature_validation_credential) {
- values.signature_validation_credential = null;
- } else if (
- typeof values.signature_validation_credential.id === 'number'
- ) {
- values.signature_validation_credential =
- values.signature_validation_credential.id;
- }
+ if (!values.signature_validation_credential) {
+ values.signature_validation_credential = null;
+ } else if (typeof values.signature_validation_credential.id === 'number') {
+ values.signature_validation_credential =
+ values.signature_validation_credential.id;
}
try {
diff --git a/awx/ui/src/screens/Project/shared/ProjectForm.js b/awx/ui/src/screens/Project/shared/ProjectForm.js
index c968a7ac5a..66a0aa8cd5 100644
--- a/awx/ui/src/screens/Project/shared/ProjectForm.js
+++ b/awx/ui/src/screens/Project/shared/ProjectForm.js
@@ -9,6 +9,7 @@ import { useConfig } from 'contexts/Config';
import AnsibleSelect from 'components/AnsibleSelect';
import ContentError from 'components/ContentError';
import ContentLoading from 'components/ContentLoading';
+import CredentialLookup from 'components/Lookup/CredentialLookup';
import FormActionGroup from 'components/FormActionGroup/FormActionGroup';
import FormField, { FormSubmitError } from 'components/FormField';
import OrganizationLookup from 'components/Lookup/OrganizationLookup';
@@ -176,6 +177,19 @@ function ProjectFormFields({
[signatureValidationCredentials, setSignatureValidationCredentials]
);
+ const handleSignatureValidationCredentialChange = useCallback(
+ (value) => {
+ handleSignatureValidationCredentialSelection('cryptography', value);
+ setFieldValue('signature_validation_credential', value);
+ setFieldTouched('signature_validation_credential', true, false);
+ },
+ [
+ handleSignatureValidationCredentialSelection,
+ setFieldValue,
+ setFieldTouched,
+ ]
+ );
+
const handleOrganizationUpdate = useCallback(
(value) => {
setFieldValue('organization', value);
@@ -270,6 +284,13 @@ function ProjectFormFields({
}}
/>
+
{formik.values.scm_type !== '' && (
@@ -288,13 +309,7 @@ function ProjectFormFields({
git: (
),
diff --git a/awx/ui/src/screens/Project/shared/ProjectForm.test.js b/awx/ui/src/screens/Project/shared/ProjectForm.test.js
index 342634cf5f..d75047be4f 100644
--- a/awx/ui/src/screens/Project/shared/ProjectForm.test.js
+++ b/awx/ui/src/screens/Project/shared/ProjectForm.test.js
@@ -276,14 +276,22 @@ describe('', () => {
1
);
await act(async () => {
- wrapper.find('CredentialLookup').invoke('onBlur')();
- wrapper.find('CredentialLookup').invoke('onChange')({
+ wrapper
+ .find('CredentialLookup[label="Insights Credential"]')
+ .invoke('onBlur')();
+ wrapper
+ .find('CredentialLookup[label="Insights Credential"]')
+ .invoke('onChange')({
id: 123,
name: 'credential',
});
});
wrapper.update();
- expect(wrapper.find('CredentialLookup').prop('value')).toEqual({
+ expect(
+ wrapper
+ .find('CredentialLookup[label="Insights Credential"]')
+ .prop('value')
+ ).toEqual({
id: 123,
name: 'credential',
});
diff --git a/awx/ui/src/screens/Project/shared/ProjectSubForms/GitSubForm.js b/awx/ui/src/screens/Project/shared/ProjectSubForms/GitSubForm.js
index b1b4f956b6..533aa05aef 100644
--- a/awx/ui/src/screens/Project/shared/ProjectSubForms/GitSubForm.js
+++ b/awx/ui/src/screens/Project/shared/ProjectSubForms/GitSubForm.js
@@ -1,8 +1,6 @@
import 'styled-components/macro';
-import React, { useCallback } from 'react';
+import React from 'react';
import { t } from '@lingui/macro';
-import { useFormikContext } from 'formik';
-import CredentialLookup from 'components/Lookup/CredentialLookup';
import FormField from 'components/FormField';
import getDocsBaseUrl from 'util/getDocsBaseUrl';
import { useConfig } from 'contexts/Config';
@@ -18,22 +16,9 @@ import projectHelpStrings from '../Project.helptext';
const GitSubForm = ({
credential,
- signature_validation_credential,
onCredentialSelection,
- onSignatureValidationCredentialSelection,
scmUpdateOnLaunch,
}) => {
- const { setFieldValue, setFieldTouched } = useFormikContext();
-
- const onCredentialChange = useCallback(
- (value) => {
- onSignatureValidationCredentialSelection('cryptography', value);
- setFieldValue('signature_validation_credential', value);
- setFieldTouched('signature_validation_credential', true, false);
- },
- [onSignatureValidationCredentialSelection, setFieldValue, setFieldTouched]
- );
-
const docsURL = `${getDocsBaseUrl(
useConfig()
)}/html/userguide/projects.html#manage-playbooks-using-source-control`;
@@ -50,13 +35,6 @@ const GitSubForm = ({
tooltipMaxWidth="400px"
tooltip={projectHelpStrings.sourceControlRefspec(docsURL)}
/>
-