mirror of
https://github.com/ansible/awx.git
synced 2026-03-01 16:58:46 -03:30
Merge pull request #6161 from jakemcdermott/6151-missing-cred-types
Fix potentially missing credential type options in multicredential select Reviewed-by: https://github.com/apps/softwarefactory-project-zuul
This commit is contained in:
@@ -18,9 +18,24 @@ const QS_CONFIG = getQSConfig('credentials', {
|
|||||||
});
|
});
|
||||||
|
|
||||||
async function loadCredentialTypes() {
|
async function loadCredentialTypes() {
|
||||||
const { data } = await CredentialTypesAPI.read();
|
const pageSize = 200;
|
||||||
const acceptableTypes = ['machine', 'cloud', 'net', 'ssh', 'vault'];
|
const acceptableKinds = ['machine', 'cloud', 'net', 'ssh', 'vault'];
|
||||||
return data.results.filter(type => acceptableTypes.includes(type.kind));
|
// The number of credential types a user can have is unlimited. In practice, it is unlikely for
|
||||||
|
// users to have more than a page at the maximum request size.
|
||||||
|
const {
|
||||||
|
data: { next, results },
|
||||||
|
} = await CredentialTypesAPI.read({ page_size: pageSize });
|
||||||
|
let nextResults = [];
|
||||||
|
if (next) {
|
||||||
|
const { data } = await CredentialTypesAPI.read({
|
||||||
|
page_size: pageSize,
|
||||||
|
page: 2,
|
||||||
|
});
|
||||||
|
nextResults = data.results;
|
||||||
|
}
|
||||||
|
return results
|
||||||
|
.concat(nextResults)
|
||||||
|
.filter(type => acceptableKinds.includes(type.kind));
|
||||||
}
|
}
|
||||||
|
|
||||||
async function loadCredentials(params, selectedCredentialTypeId) {
|
async function loadCredentials(params, selectedCredentialTypeId) {
|
||||||
|
|||||||
@@ -368,9 +368,11 @@ class JobTemplateForm extends Component {
|
|||||||
label={i18n._(t`Credentials`)}
|
label={i18n._(t`Credentials`)}
|
||||||
promptId="template-ask-credential-on-launch"
|
promptId="template-ask-credential-on-launch"
|
||||||
promptName="ask_credential_on_launch"
|
promptName="ask_credential_on_launch"
|
||||||
tooltip={i18n._(
|
tooltip={i18n._(t`Select credentials that allow Tower to access the nodes this job will be ran
|
||||||
t`Select credentials that allow Tower to access the nodes this job will be ran against. You can only select one credential of each type. For machine credentials (SSH), checking "Prompt on launch" without selecting credentials will require you to select a machine credential at run time. If you select credentials and check "Prompt on launch", the selected credential(s) become the defaults that can be updated at run time.`
|
against. You can only select one credential of each type. For machine credentials (SSH),
|
||||||
)}
|
checking "Prompt on launch" without selecting credentials will require you to select a machine
|
||||||
|
credential at run time. If you select credentials and check "Prompt on launch", the selected
|
||||||
|
credential(s) become the defaults that can be updated at run time.`)}
|
||||||
>
|
>
|
||||||
<Field name="credentials" fieldId="template-credentials">
|
<Field name="credentials" fieldId="template-credentials">
|
||||||
{({ field }) => {
|
{({ field }) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user