diff --git a/awx/ui_next/src/screens/Credential/CredentialEdit/CredentialEdit.jsx b/awx/ui_next/src/screens/Credential/CredentialEdit/CredentialEdit.jsx
index 9ffc29f39b..ded0a30120 100644
--- a/awx/ui_next/src/screens/Credential/CredentialEdit/CredentialEdit.jsx
+++ b/awx/ui_next/src/screens/Credential/CredentialEdit/CredentialEdit.jsx
@@ -116,7 +116,7 @@ function CredentialEdit({ credential, me }) {
},
] = await Promise.all([
CredentialTypesAPI.read({ page_size: 200 }),
- CredentialsAPI.readInputSources(credId, { page_size: 200 }),
+ CredentialsAPI.readInputSources(credId),
]);
const credTypes = data.results;
if (data.next && data.next.includes('page=2')) {
diff --git a/awx/ui_next/src/screens/Credential/CredentialEdit/CredentialEdit.test.jsx b/awx/ui_next/src/screens/Credential/CredentialEdit/CredentialEdit.test.jsx
index 17ab9d3ed4..75cdeb2589 100644
--- a/awx/ui_next/src/screens/Credential/CredentialEdit/CredentialEdit.test.jsx
+++ b/awx/ui_next/src/screens/Credential/CredentialEdit/CredentialEdit.test.jsx
@@ -197,6 +197,58 @@ CredentialTypesAPI.read.mockResolvedValue({
},
injectors: {},
},
+ {
+ id: 9,
+ type: 'credential_type',
+ url: '/api/v2/credential_types/9/',
+ related: {
+ credentials: '/api/v2/credential_types/9/credentials/',
+ activity_stream: '/api/v2/credential_types/9/activity_stream/',
+ },
+ summary_fields: {
+ user_capabilities: {
+ edit: true,
+ delete: true,
+ },
+ },
+ created: '2021-02-12T19:13:22.352791Z',
+ modified: '2021-02-12T19:14:15.578773Z',
+ name: 'Google Compute Engine',
+ description: '',
+ kind: 'cloud',
+ namespace: 'gce',
+ managed_by_tower: true,
+ inputs: {
+ fields: [
+ {
+ id: 'username',
+ label: 'Service Account Email Address',
+ type: 'string',
+ help_text:
+ 'The email address assigned to the Google Compute Engine service account.',
+ },
+ {
+ id: 'project',
+ label: 'Project',
+ type: 'string',
+ help_text:
+ 'The Project ID is the GCE assigned identification. It is often constructed as three words or two words followed by a three-digit number. Examples: project-id-000 and another-project-id',
+ },
+ {
+ id: 'ssh_key_data',
+ label: 'RSA Private Key',
+ type: 'string',
+ format: 'ssh_private_key',
+ secret: true,
+ multiline: true,
+ help_text:
+ 'Paste the contents of the PEM file associated with the service account email.',
+ },
+ ],
+ required: ['username', 'ssh_key_data'],
+ },
+ injectors: {},
+ },
],
},
});
@@ -354,6 +406,38 @@ describe('', () => {
expect(CredentialInputSourcesAPI.destroy).toHaveBeenCalledWith(34);
expect(history.location.pathname).toBe('/credentials/3/details');
});
+ test('inputs are properly rendered', async () => {
+ history = createMemoryHistory({ initialEntries: ['/credentials'] });
+ await act(async () => {
+ wrapper = mountWithContexts(
+ ,
+ {
+ context: { router: { history } },
+ }
+ );
+ });
+ wrapper.update();
+ expect(wrapper.find('input#credential-username').prop('value')).toBe(
+ 'foo@ansible.com'
+ );
+ expect(wrapper.find('input#credential-project').prop('value')).toBe(
+ 'foo'
+ );
+ expect(
+ wrapper.find('textarea#credential-ssh_key_data').prop('value')
+ ).toBe('$encrypted$');
+ });
});
describe('Initial GET request fails', () => {
test('shows error when initial GET request fails', async () => {
diff --git a/awx/ui_next/src/screens/Credential/shared/CredentialForm.jsx b/awx/ui_next/src/screens/Credential/shared/CredentialForm.jsx
index b46ddf8573..a1e717bf24 100644
--- a/awx/ui_next/src/screens/Credential/shared/CredentialForm.jsx
+++ b/awx/ui_next/src/screens/Credential/shared/CredentialForm.jsx
@@ -197,7 +197,7 @@ function CredentialForm({
description: credential.description || '',
organization: credential?.summary_fields?.organization || null,
credential_type: credential?.credential_type || '',
- inputs: {},
+ inputs: credential?.inputs || {},
passwordPrompts: {},
};