mirror of
https://github.com/ansible/awx.git
synced 2024-10-31 23:51:09 +03:00
Merge pull request #2771 from jaredevantabor/socket-removal
removing unnecessary "jobs" websocket init
This commit is contained in:
commit
a2f0f7a6dc
@ -5,7 +5,7 @@
|
|||||||
*************************************************/
|
*************************************************/
|
||||||
|
|
||||||
export default
|
export default
|
||||||
['$scope', '$rootScope', '$stateParams', 'Wait', 'JobDetailService', 'jobSocket', 'DrawGraph', function($scope, $rootScope, $stateParams, Wait, JobDetailService, jobSocket, DrawGraph){
|
['$scope', '$rootScope', '$stateParams', 'Wait', 'JobDetailService', 'DrawGraph', function($scope, $rootScope, $stateParams, Wait, JobDetailService, DrawGraph){
|
||||||
|
|
||||||
var page_size = 200;
|
var page_size = 200;
|
||||||
$scope.loading = $scope.hosts.length > 0 ? false : true;
|
$scope.loading = $scope.hosts.length > 0 ? false : true;
|
||||||
@ -48,22 +48,28 @@
|
|||||||
$scope.status = res.results[0].status;
|
$scope.status = res.results[0].status;
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
var socketListener = function(){
|
if ($rootScope.removeJobStatusChange) {
|
||||||
|
$rootScope.removeJobStatusChange();
|
||||||
|
}
|
||||||
// emitted by the API in the same function used to persist host summary data
|
// 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
|
// JobEvent.update_host_summary_from_stats() from /awx/main.models.jobs.py
|
||||||
jobSocket.on('summary_complete', function(data) {
|
$rootScope.removeJobStatusChange = $rootScope.$on('JobSummaryComplete', function(e, data) {
|
||||||
// discard socket msgs we don't care about in this context
|
// discard socket msgs we don't care about in this context
|
||||||
if (parseInt($stateParams.id) === data.unified_job_id){
|
if (parseInt($stateParams.id) === data.unified_job_id){
|
||||||
init();
|
init();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// UnifiedJob.def socketio_emit_status() from /awx/main.models.unified_jobs.py
|
// UnifiedJob.def socketio_emit_status() from /awx/main.models.unified_jobs.py
|
||||||
jobSocket.on('status_changed', function(data) {
|
if ($rootScope.removeJobSummaryComplete) {
|
||||||
|
$rootScope.removeJobSummaryComplete();
|
||||||
|
}
|
||||||
|
$rootScope.removeJobSummaryComplete = $rootScope.$on('JobStatusChange-jobDetails', function(e, data) {
|
||||||
if (parseInt($stateParams.id) === data.unified_job_id){
|
if (parseInt($stateParams.id) === data.unified_job_id){
|
||||||
$scope.status = data.status;
|
$scope.status = data.status;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
|
||||||
|
|
||||||
$scope.buildTooltip = function(n, status){
|
$scope.buildTooltip = function(n, status){
|
||||||
var grammar = function(n, status){
|
var grammar = function(n, status){
|
||||||
@ -136,7 +142,7 @@
|
|||||||
};
|
};
|
||||||
$scope.get = filter === 'all' ? getAll() : getFailed();
|
$scope.get = filter === 'all' ? getAll() : getFailed();
|
||||||
};
|
};
|
||||||
socketListener();
|
|
||||||
init();
|
init();
|
||||||
// calling the init routine twice will size the d3 chart correctly - no idea why
|
// 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
|
// instantiating the graph inside a setTimeout() SHOULD have the same effect, but it doesn't
|
||||||
|
@ -27,14 +27,6 @@ export default {
|
|||||||
} else {
|
} else {
|
||||||
return true;
|
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'),
|
templateUrl: templateUrl('job-detail/job-detail'),
|
||||||
|
Loading…
Reference in New Issue
Block a user