mirror of
https://github.com/ansible/awx.git
synced 2026-05-15 13:27:40 -02:30
Add ability to submit cred form after api validation error
This commit is contained in:
@@ -6,6 +6,9 @@ function EditCredentialsController (models, $state, $scope, strings) {
|
|||||||
let credentialType = models.credentialType;
|
let credentialType = models.credentialType;
|
||||||
let organization = models.organization;
|
let organization = models.organization;
|
||||||
|
|
||||||
|
let omit = ['user', 'team', 'inputs'];
|
||||||
|
let isEditable = credential.isEditable();
|
||||||
|
|
||||||
vm.mode = 'edit';
|
vm.mode = 'edit';
|
||||||
vm.strings = strings;
|
vm.strings = strings;
|
||||||
vm.panelTitle = credential.get('name');
|
vm.panelTitle = credential.get('name');
|
||||||
@@ -35,11 +38,12 @@ function EditCredentialsController (models, $state, $scope, strings) {
|
|||||||
// Only exists for permissions compatibility
|
// Only exists for permissions compatibility
|
||||||
$scope.credential_obj = credential.get();
|
$scope.credential_obj = credential.get();
|
||||||
|
|
||||||
vm.form = credential.createFormSchema({
|
if (isEditable) {
|
||||||
omit: ['user', 'team', 'inputs']
|
vm.form = credential.createFormSchema('put', { omit });
|
||||||
});
|
} else {
|
||||||
|
vm.form = credential.createFormSchema({ omit });
|
||||||
vm.form.disabled = !credential.isEditable();
|
vm.form.disabled = !isEditable;
|
||||||
|
}
|
||||||
|
|
||||||
vm.form.organization._resource = 'organization';
|
vm.form.organization._resource = 'organization';
|
||||||
vm.form.organization._model = organization;
|
vm.form.organization._model = organization;
|
||||||
|
|||||||
@@ -149,7 +149,6 @@ function AtFormController (eventService, strings) {
|
|||||||
errorMessageSet = true;
|
errorMessageSet = true;
|
||||||
|
|
||||||
component.state._rejected = true;
|
component.state._rejected = true;
|
||||||
component.state._isValid = false;
|
|
||||||
component.state._message = errors[component.state.id].join(' ');
|
component.state._message = errors[component.state.id].join(' ');
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
<p ng-if="state._rejected && !state._isValid" class="at-InputMessage--rejected">
|
<p ng-if="state._rejected || !state._isValid" class="at-InputMessage--rejected">
|
||||||
{{ state._message }}
|
{{ state._message }}
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user