From f44cc5f72940f13b2eb4c13dcf95b0c67e7a3904 Mon Sep 17 00:00:00 2001 From: John Mitchell Date: Wed, 26 Aug 2015 20:00:51 -0400 Subject: [PATCH] fixed playbooks from not displaying on type-completed project --- awx/ui/client/src/controllers/JobTemplates.js | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/awx/ui/client/src/controllers/JobTemplates.js b/awx/ui/client/src/controllers/JobTemplates.js index 93fbc9175a..6921b51e9e 100644 --- a/awx/ui/client/src/controllers/JobTemplates.js +++ b/awx/ui/client/src/controllers/JobTemplates.js @@ -478,13 +478,24 @@ export function JobTemplatesAdd($filter, $scope, $rootScope, $compile, $location } }; + + // $scope.selectPlaybookUnregister = $scope.$watch('project_name', function (newval, oldval) { + // selectPlaybook(oldval, newval); + // checkSCMStatus(oldval, newval); + // }); + // Register a watcher on project_name if ($scope.selectPlaybookUnregister) { $scope.selectPlaybookUnregister(); } - $scope.selectPlaybookUnregister = $scope.$watch('project_name', function (newval, oldval) { - selectPlaybook(oldval, newval); - checkSCMStatus(oldval, newval); + $scope.selectPlaybookUnregister = $scope.$watch('project', function (newValue, oldValue) { + if (newValue !== oldValue) { + if (!Empty(oldValue)) { + $scope.playbook = null; + } + selectPlaybook(oldValue, newValue); + checkSCMStatus(); + } }); LookUpInit({