From 9fbd64805f62573340dfa856ed78193d9cf7618a Mon Sep 17 00:00:00 2001 From: Jared Tabor Date: Mon, 16 Feb 2015 13:42:38 -0500 Subject: [PATCH] Job Detail checks to prevent error messages If the job run completes before the JS can complete running, error messages are output to the js console. Ajusting checks to prevent errors happening. --- awx/ui/static/js/controllers/JobDetail.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/awx/ui/static/js/controllers/JobDetail.js b/awx/ui/static/js/controllers/JobDetail.js index b8e0a9a194..d4c3942a4f 100644 --- a/awx/ui/static/js/controllers/JobDetail.js +++ b/awx/ui/static/js/controllers/JobDetail.js @@ -200,7 +200,7 @@ export function JobDetailController ($location, $rootScope, $scope, $compile, $r scope.removeLoadHostSummaries(); } scope.removeHostSummaries = scope.$on('LoadHostSummaries', function() { - if(scope.job.related){ + if(scope.job){ var url = scope.job.related.job_host_summaries + '?'; url += '&page_size=' + scope.hostSummariesMaxRows + '&order=host_name'; @@ -247,9 +247,11 @@ export function JobDetailController ($location, $rootScope, $scope, $compile, $r if (scope.activeTask) { var play = scope.jobData.plays[scope.activePlay], - task = play.tasks[scope.activeTask], + task, // = play.tasks[scope.activeTask], url; - + if(play){ + task = play.tasks[scope.activeTask]; + } if (play && task) { url = scope.job.related.job_events + '?parent=' + task.id + '&'; url += 'event__startswith=runner&page_size=' + scope.hostResultsMaxRows + '&order=host_name,counter';