House fixed issue on job template form when project was deleted, changed, or reloaded from a previous saved form

This commit is contained in:
Jared Tabor 2014-08-12 16:58:16 -04:00
parent c2b3d815da
commit 88c1b05f50

View File

@ -467,14 +467,18 @@ function JobTemplatesEdit($scope, $rootScope, $compile, $location, $log, $routeP
if ($scope.watchProjectUnregister) {
$scope.watchProjectUnregister();
}
$scope.watchProjectUnregister = $scope.$watch('project_name', function (newValue, oldValue) {
if (oldValue !== newValue && newValue !== '' && newValue !== null && newValue !== undefined) {
$scope.playbook = null;
$scope.watchProjectUnregister = $scope.$watch('project', function (newValue, oldValue) {
if (newValue !== oldValue) {
if (!Empty(oldValue)) {
$scope.playbook = null;
}
getPlaybooks($scope.project);
checkSCMStatus();
}
});
// Turn off 'Wait' after both cloud credential and playbook list come back
if ($scope.removeJobTemplateLoadFinished) {
$scope.removeJobTemplateLoadFinished();