diff --git a/awx/ui/client/src/helpers/JobDetail.js b/awx/ui/client/src/helpers/JobDetail.js index 562b73d0eb..90c68cc943 100644 --- a/awx/ui/client/src/helpers/JobDetail.js +++ b/awx/ui/client/src/helpers/JobDetail.js @@ -42,7 +42,7 @@ export default .factory('DigestEvent', ['$rootScope', '$log', 'UpdatePlayStatus', 'UpdateHostStatus', 'AddHostResult', 'GetElapsed', 'UpdateTaskStatus', 'JobIsFinished', 'AddNewTask', 'AddNewPlay', function($rootScope, $log, UpdatePlayStatus, UpdateHostStatus, AddHostResult, GetElapsed, - UpdateTaskStatus, JobIsFinished, AddNewTask, AddNewPlay, longDateFilter) { + UpdateTaskStatus, JobIsFinished, AddNewTask, AddNewPlay) { return function(params) { var scope = params.scope, @@ -485,8 +485,7 @@ export default created = params.created, msg = params.message, item = params.item, - counter = params.counter, - h, host; + counter = params.counter; if (scope.jobData.hostSummaries[host_id] !== undefined) { scope.jobData.hostSummaries[host_id].ok += (status === 'successful') ? 1 : 0; @@ -920,7 +919,7 @@ export default order: 'host_name,counter', }; JobDetailService.getRelatedJobEvents(scope.job.id, params).success(function(res){ - scope.hostResults = JobDetailService.processHostEvents(res.results) + scope.hostResults = JobDetailService.processHostEvents(res.results); scope.hostResultsLoading = false; }); }; diff --git a/awx/ui/client/src/job-detail/host-events/host-events.controller.js b/awx/ui/client/src/job-detail/host-events/host-events.controller.js index 15ab24d4ca..8869248a04 100644 --- a/awx/ui/client/src/job-detail/host-events/host-events.controller.js +++ b/awx/ui/client/src/job-detail/host-events/host-events.controller.js @@ -110,7 +110,6 @@ var init = function(){ $scope.hostName = $stateParams.hostName; // create filter dropdown - console.log($stateParams) CreateSelect2({ element: '.HostEvents-select', multiple: false diff --git a/awx/ui/client/src/job-detail/host-summary/host-summary.controller.js b/awx/ui/client/src/job-detail/host-summary/host-summary.controller.js index e06ee53611..692d10bd5d 100644 --- a/awx/ui/client/src/job-detail/host-summary/host-summary.controller.js +++ b/awx/ui/client/src/job-detail/host-summary/host-summary.controller.js @@ -8,14 +8,13 @@ ['$scope', '$rootScope', '$stateParams', 'Wait', 'JobDetailService', 'jobSocket', 'DrawGraph', function($scope, $rootScope, $stateParams, Wait, JobDetailService, jobSocket, DrawGraph){ var page_size = 200; - $scope.loading = $scope.hosts.length > 0 ? false : true; $scope.filter = 'all'; $scope.search = null; - var buildTooltips = function(hosts){ + var buildGraph = function(hosts){ // status waterfall: unreachable > failed > changed > ok > skipped - var count, grammar, text = {}; + var count; count = { ok : _.filter(hosts, function(o){ return o.failures === 0 && o.changed === 0 && o.ok > 0; @@ -33,6 +32,25 @@ return o.changed > 0; }) }; + return count; + }; + var socketListener = function(){ + // emitted by the API in the same function used to persist host summary data + // JobEvent.update_host_summary_from_stats() from /awx/main.models.jobs.py + jobSocket.on('summary_complete', function(data) { + // discard socket msgs we don't care about in this context + if ($stateParams.id == data['unified_job_id']){ + init(); + } + }); + // UnifiedJob.def socketio_emit_status() from /awx/main.models.unified_jobs.py + jobSocket.on('status_changed', function(data) { + if ($stateParams.id == data['unified_job_id']){ + $scope.status = data['status']; + } + }); + }; + $scope.buildTooltip = function(n, status){ var grammar = function(n, status){ var dict = { 0: 'No host events were ', @@ -46,28 +64,13 @@ return n !== 0 ? n + dict[n] + status : dict[n] + status; } }; + /* _.forIn(count, function(value, key){ text[key] = grammar(value.length, key); }); - return {count, text} + */ + return grammar(n, status) }; - var socketListener = function(){ - // emitted by the API in the same function used to persist host summary data - // JobEvent.update_host_summary_from_stats() from /awx/main.models.jobs.py - jobSocket.on('summary_complete', function(data) { - // discard socket msgs we don't care about in this context - if ($stateParams.id == data['unified_job_id']){ - init() - } - }); - // UnifiedJob.def socketio_emit_status() from /awx/main.models.unified_jobs.py - jobSocket.on('status_changed', function(data) { - if ($stateParams.id == data['unified_job_id']){ - $scope.status = data['status']; - } - }); - }; - $scope.getNextPage = function(){ if ($scope.next){ JobDetailService.getNextPage($scope.next).success(function(res){ @@ -80,14 +83,14 @@ } }; $scope.search = function(){ - Wait('start') + Wait('start'); JobDetailService.getJobHostSummaries($stateParams.id, { page_size: page_size, host_name__icontains: $scope.searchTerm, }).success(function(res){ $scope.hosts = res.results; $scope.next = res.next; - Wait('stop') + Wait('stop'); }) }; $scope.setFilter = function(filter){ @@ -113,12 +116,12 @@ $scope.next = res.next; }); } - var get = filter == 'all' ? getAll() : getFailed() + var get = filter == 'all' ? getAll() : getFailed(); }; $scope.$watchCollection('hosts', function(curr, prev){ - $scope.tooltips = buildTooltips(curr); - DrawGraph({count: $scope.tooltips.count, resize:true}); + $scope.count = buildGraph(curr); + DrawGraph({count: $scope.count, resize:true}); }); var init = function(){ @@ -129,9 +132,9 @@ $scope.next = res.next; Wait('stop'); }); - JobDetailService.getJob($stateParams.id) + JobDetailService.getJob({id: $stateParams.id}) .success(function(res){ - $scope.status = status; + $scope.status = res.results[0].status; }); }; socketListener(); diff --git a/awx/ui/client/src/job-detail/host-summary/host-summary.partial.html b/awx/ui/client/src/job-detail/host-summary/host-summary.partial.html index 0011d4a97d..84d3b3aba5 100644 --- a/awx/ui/client/src/job-detail/host-summary/host-summary.partial.html +++ b/awx/ui/client/src/job-detail/host-summary/host-summary.partial.html @@ -14,9 +14,9 @@