1
0
mirror of https://github.com/ansible/awx.git synced 2024-11-01 08:21:15 +03:00

Add ability to submit cred form after api validation error

This commit is contained in:
gconsidine 2017-08-01 14:36:45 -04:00
parent 384637fce8
commit 08d3a735ab
3 changed files with 10 additions and 7 deletions

View File

@ -6,6 +6,9 @@ function EditCredentialsController (models, $state, $scope, strings) {
let credentialType = models.credentialType;
let organization = models.organization;
let omit = ['user', 'team', 'inputs'];
let isEditable = credential.isEditable();
vm.mode = 'edit';
vm.strings = strings;
vm.panelTitle = credential.get('name');
@ -35,11 +38,12 @@ function EditCredentialsController (models, $state, $scope, strings) {
// Only exists for permissions compatibility
$scope.credential_obj = credential.get();
vm.form = credential.createFormSchema({
omit: ['user', 'team', 'inputs']
});
vm.form.disabled = !credential.isEditable();
if (isEditable) {
vm.form = credential.createFormSchema('put', { omit });
} else {
vm.form = credential.createFormSchema({ omit });
vm.form.disabled = !isEditable;
}
vm.form.organization._resource = 'organization';
vm.form.organization._model = organization;

View File

@ -149,7 +149,6 @@ function AtFormController (eventService, strings) {
errorMessageSet = true;
component.state._rejected = true;
component.state._isValid = false;
component.state._message = errors[component.state.id].join(' ');
});
}

View File

@ -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 }}
</p>