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 496e7d76d7..903554617f 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 @@ -48,22 +48,28 @@ $scope.status = res.results[0].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 (parseInt($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 (parseInt($stateParams.id) === data.unified_job_id){ - $scope.status = data.status; - } - }); - }; + if ($rootScope.removeJobStatusChange) { + $rootScope.removeJobStatusChange(); + } + // 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 + $rootScope.removeJobStatusChange = $rootScope.$on('JobSummaryComplete', function(e, data) { + // discard socket msgs we don't care about in this context + if (parseInt($stateParams.id) === data.unified_job_id){ + init(); + } + }); + + // UnifiedJob.def socketio_emit_status() from /awx/main.models.unified_jobs.py + if ($rootScope.removeJobSummaryComplete) { + $rootScope.removeJobSummaryComplete(); + } + $rootScope.removeJobSummaryComplete = $rootScope.$on('JobStatusChange-jobDetails', function(e, data) { + if (parseInt($stateParams.id) === data.unified_job_id){ + $scope.status = data.status; + } + }); + $scope.buildTooltip = function(n, status){ var grammar = function(n, status){ @@ -136,7 +142,7 @@ }; $scope.get = filter === 'all' ? getAll() : getFailed(); }; - socketListener(); + init(); // calling the init routine twice will size the d3 chart correctly - no idea why // instantiating the graph inside a setTimeout() SHOULD have the same effect, but it doesn't diff --git a/awx/ui/client/src/job-detail/job-detail.route.js b/awx/ui/client/src/job-detail/job-detail.route.js index 926b8f7306..dda2722511 100644 --- a/awx/ui/client/src/job-detail/job-detail.route.js +++ b/awx/ui/client/src/job-detail/job-detail.route.js @@ -27,14 +27,6 @@ export default { } else { return true; } - }], - jobSocket: ['Socket', '$rootScope', function(Socket, $rootScope) { - var job_socket = Socket({ - scope: $rootScope, - endpoint: "jobs" - }); - job_socket.init(); - return job_socket; }] }, templateUrl: templateUrl('job-detail/job-detail'),