mirror of
https://github.com/ansible/awx.git
synced 2026-01-17 12:41:19 -03:30
Avoid non-unique field name collisions
Custom credentials can have input fields named 'name', 'organization', 'description', etc. Underscore these variables to make collisions less likely to occur.
This commit is contained in:
parent
ea4b435ea7
commit
05799d9795
@ -53,16 +53,19 @@ function AddEditCredentialsController (
|
||||
vm.form.disabled = !isEditable;
|
||||
}
|
||||
|
||||
vm.form.organization._disabled = !isOrgEditableByUser;
|
||||
vm.form._organization._disabled = !isOrgEditableByUser;
|
||||
// Only exists for permissions compatibility
|
||||
$scope.credential_obj = credential.get();
|
||||
|
||||
vm.form.organization._resource = 'organization';
|
||||
vm.form.organization._model = organization;
|
||||
vm.form.organization._route = 'credentials.edit.organization';
|
||||
vm.form.organization._value = credential.get('summary_fields.organization.id');
|
||||
vm.form.organization._displayValue = credential.get('summary_fields.organization.name');
|
||||
vm.form.organization._placeholder = strings.get('inputs.ORGANIZATION_PLACEHOLDER');
|
||||
// Custom credentials can have input fields named 'name', 'organization',
|
||||
// 'description', etc. Underscore these variables to make collisions
|
||||
// less likely to occur.
|
||||
vm.form._organization._resource = 'organization';
|
||||
vm.form._organization._model = organization;
|
||||
vm.form._organization._route = 'credentials.edit.organization';
|
||||
vm.form._organization._value = credential.get('summary_fields.organization.id');
|
||||
vm.form._organization._displayValue = credential.get('summary_fields.organization.name');
|
||||
vm.form._organization._placeholder = strings.get('inputs.ORGANIZATION_PLACEHOLDER');
|
||||
|
||||
vm.form.credential_type._resource = 'credential_type';
|
||||
vm.form.credential_type._model = credentialType;
|
||||
@ -98,10 +101,10 @@ function AddEditCredentialsController (
|
||||
vm.form._formName = 'credential';
|
||||
vm.form.disabled = !credential.isCreatable();
|
||||
|
||||
vm.form.organization._resource = 'organization';
|
||||
vm.form.organization._route = 'credentials.add.organization';
|
||||
vm.form.organization._model = organization;
|
||||
vm.form.organization._placeholder = strings.get('inputs.ORGANIZATION_PLACEHOLDER');
|
||||
vm.form._organization._resource = 'organization';
|
||||
vm.form._organization._route = 'credentials.add.organization';
|
||||
vm.form._organization._model = organization;
|
||||
vm.form._organization._placeholder = strings.get('inputs.ORGANIZATION_PLACEHOLDER');
|
||||
|
||||
vm.form.credential_type._resource = 'credential_type';
|
||||
vm.form.credential_type._route = 'credentials.add.credentialType';
|
||||
@ -112,7 +115,7 @@ function AddEditCredentialsController (
|
||||
|
||||
$scope.$watch('organization', () => {
|
||||
if ($scope.organization) {
|
||||
vm.form.organization._idFromModal = $scope.organization;
|
||||
vm.form._organization._idFromModal = $scope.organization;
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@ -10,9 +10,9 @@
|
||||
|
||||
<at-panel-body>
|
||||
<at-form state="vm.form" autocomplete="off" id="credential_form">
|
||||
<at-input-text col="4" tab="1" state="vm.form.name" id="credential_name_group"></at-input-text>
|
||||
<at-input-text col="4" tab="2" state="vm.form.description" id="credential_description_group"></at-input-text>
|
||||
<at-input-lookup col="4" tab="3" state="vm.form.organization" id="credential_organization_group"></at-input-lookup>
|
||||
<at-input-text col="4" tab="1" state="vm.form._name" id="credential_name_group"></at-input-text>
|
||||
<at-input-text col="4" tab="2" state="vm.form._description" id="credential_description_group"></at-input-text>
|
||||
<at-input-lookup col="4" tab="3" state="vm.form._organization" id="credential_organization_group"></at-input-lookup>
|
||||
|
||||
<at-divider></at-divider>
|
||||
|
||||
|
||||
@ -27,6 +27,16 @@ function createFormSchema (method, config) {
|
||||
}
|
||||
});
|
||||
|
||||
// Custom credentials can have input fields named 'name', 'organization',
|
||||
// 'description', etc. Underscore these variables to make collisions
|
||||
// less likely to occur.
|
||||
schema._name = schema.name;
|
||||
schema._organization = schema.organization;
|
||||
schema._description = schema.description;
|
||||
delete schema.name;
|
||||
delete schema.organization;
|
||||
delete schema.description;
|
||||
|
||||
return schema;
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user