Finally fixed issue with editing a credential. Need to call Owner change after loading data and after resetting form. Also removed default from Owner radio button on create and set to required so that user has to actively make a choice. Started working on Job Template detail changes. Job Template is currently broke.

This commit is contained in:
Chris Houseknecht
2013-11-02 19:37:52 +00:00
committed by Chris Church
parent 413a799829
commit 0466629718
6 changed files with 74 additions and 50 deletions

View File

@@ -116,7 +116,7 @@ function CredentialsAdd ($scope, $rootScope, $compile, $location, $log, $routePa
LookUpInit({
scope: scope,
form: form,
current_item: ($routeParams.user_id) ? $routeParams.user_id : null,
current_item: (!Empty($routeParams.user_id)) ? $routeParams.user_id : null,
list: UserList,
field: 'user'
});
@@ -124,7 +124,7 @@ function CredentialsAdd ($scope, $rootScope, $compile, $location, $log, $routePa
LookUpInit({
scope: scope,
form: form,
current_item: ($routeParams.team_id) ? $routeParams.team_id : null,
current_item: (!Empty($routeParams.team_id)) ? $routeParams.team_id : null,
list: TeamList,
field: 'team'
});
@@ -188,7 +188,7 @@ function CredentialsAdd ($scope, $rootScope, $compile, $location, $log, $routePa
data['kind'] = scope['kind'].value;
if (!Empty(data.team) && Empty(data.user)) {
if (Empty(data.team) && Empty(data.user)) {
Alert('Missing User or Team', 'You must provide either a User or a Team. If this credential will only be accessed by a specific ' +
'user, select a User. To allow a team of users to access this credential, select a Team.', 'alert-danger');
}
@@ -306,7 +306,7 @@ function CredentialsEdit ($scope, $rootScope, $compile, $location, $log, $routeP
LookUpInit({
scope: scope,
form: form,
current_item: ($scope['user_id']) ? scope['user_id'] : null,
current_item: (!Empty($scope['user_id'])) ? scope['user_id'] : null,
list: UserList,
field: 'user'
});
@@ -314,13 +314,14 @@ function CredentialsEdit ($scope, $rootScope, $compile, $location, $log, $routeP
LookUpInit({
scope: scope,
form: form,
current_item: ($scope['team_id']) ? scope['team_id'] : null,
current_item: (!Empty($scope['team_id'])) ? scope['team_id'] : null,
list: TeamList,
field: 'team'
});
setAskCheckboxes();
KindChange({ scope: scope, form: form, reset: false });
OwnerChange({ scope: scope });
});
if (scope.removeChoicesReady) {
@@ -428,6 +429,8 @@ function CredentialsEdit ($scope, $rootScope, $compile, $location, $log, $routeP
scope[fld] = master[fld];
}
setAskCheckboxes();
KindChange({ scope: scope, form: form, reset: false });
OwnerChange({ scope: scope });
};
// Related set: Add button

View File

@@ -124,6 +124,7 @@ function JobTemplatesAdd ($scope, $rootScope, $compile, $location, $log, $routeP
});
LookUpInit({
url: GetBasePath('credentials') + '?cloud=false',
scope: scope,
form: form,
current_item: null,
@@ -131,6 +132,15 @@ function JobTemplatesAdd ($scope, $rootScope, $compile, $location, $log, $routeP
field: 'credential'
});
LookUpInit({
url: GetBasePath('credentials') + '?cloud=true',
scope: scope,
form: form,
current_item: null,
list: CredentialList,
field: 'cloud_credential'
});
// Update playbook select whenever project value changes
var selectPlaybook = function(oldValue, newValue) {
if (oldValue != newValue) {