diff --git a/awx/ui/static/js/app.js b/awx/ui/static/js/app.js index 8a73ae16ba..95d087f556 100644 --- a/awx/ui/static/js/app.js +++ b/awx/ui/static/js/app.js @@ -583,6 +583,10 @@ angular.module('Tower', [ $log.debug('Job ' + data.unified_job_id + ' status changed to ' + data.status); $rootScope.$emit('JobStatusChange', data); }); + sock.on("summary_complete", function(data) { + $log.debug('Job summary_complete ' + data.unified_job_id); + $rootScope.$emit('JobSummaryComplete', data); + }); } openSocket(); diff --git a/awx/ui/static/js/controllers/JobDetail.js b/awx/ui/static/js/controllers/JobDetail.js index 4222fbf5ba..f12c7871fb 100644 --- a/awx/ui/static/js/controllers/JobDetail.js +++ b/awx/ui/static/js/controllers/JobDetail.js @@ -70,6 +70,7 @@ function JobDetailController ($location, $rootScope, $scope, $compile, $routePar scope.host_summary.total = 0; scope.jobData = {}; + scope.jobData.hostSummaries = {}; verbosity_options = [ { value: 0, label: 'Default' }, @@ -140,6 +141,15 @@ function JobDetailController ($location, $rootScope, $scope, $compile, $routePar } }); + if ($rootScope.removeJobSummaryComplete) { + $rootScope.removeJobSummaryComplete(); + } + $rootScope.removeJobSummaryComplete = $rootScope.$on('JobSummaryComplete', function() { + // the job host summary should now be available from the API + $log.debug('Trigging reload of job_host_summaries'); + scope.$emit('LoadHostSummaries'); + }); + if (scope.removeInitialLoadComplete) { scope.removeInitialLoadComplete(); @@ -189,12 +199,14 @@ function JobDetailController ($location, $rootScope, $scope, $compile, $routePar var url = scope.job.related.job_host_summaries + '?'; url += '&page_size=' + scope.hostSummariesMaxRows + '&order=host_name'; - scope.jobData.hostSummaries = {}; - Rest.setUrl(url); Rest.get() .success(function(data) { scope.next_host_summaries = data.next; + if (data.results.length > 0) { + // only dump what's in memory when job_host_summaries is available. + scope.jobData.hostSummaries = {}; + } data.results.forEach(function(event) { var name; if (event.host_name) {