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 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;

View File

@@ -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(' ');
}); });
} }

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 }} {{ state._message }}
</p> </p>