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;