mirror of
https://github.com/ansible/awx.git
synced 2026-05-17 22:37:41 -02:30
changing naming scheme for event listeners to "ws-<group_name>"
instead of ws-<state name>-<group_name>
This commit is contained in:
@@ -28,7 +28,7 @@ export function Home($scope, $compile, $stateParams, $rootScope, $location, $log
|
|||||||
|
|
||||||
var dataCount = 0;
|
var dataCount = 0;
|
||||||
|
|
||||||
$rootScope.$on('ws-dashboard-jobs', function () {
|
$rootScope.$on('ws-jobs', function () {
|
||||||
Rest.setUrl(GetBasePath('dashboard'));
|
Rest.setUrl(GetBasePath('dashboard'));
|
||||||
Rest.get()
|
Rest.get()
|
||||||
.success(function (data) {
|
.success(function (data) {
|
||||||
|
|||||||
@@ -113,14 +113,14 @@ export function JobsListController ($rootScope, $log, $scope, $compile, $statePa
|
|||||||
if ($rootScope.removeJobStatusChange) {
|
if ($rootScope.removeJobStatusChange) {
|
||||||
$rootScope.removeJobStatusChange();
|
$rootScope.removeJobStatusChange();
|
||||||
}
|
}
|
||||||
$rootScope.removeJobStatusChange = $rootScope.$on('ws-jobs-jobs', function() {
|
$rootScope.removeJobStatusChange = $rootScope.$on('ws-jobs', function() {
|
||||||
$scope.refreshJobs();
|
$scope.refreshJobs();
|
||||||
});
|
});
|
||||||
|
|
||||||
if ($rootScope.removeScheduleStatusChange) {
|
if ($rootScope.removeScheduleStatusChange) {
|
||||||
$rootScope.removeScheduleStatusChange();
|
$rootScope.removeScheduleStatusChange();
|
||||||
}
|
}
|
||||||
$rootScope.removeScheduleStatusChange = $rootScope.$on('ws-jobs-schedules', function() {
|
$rootScope.removeScheduleStatusChange = $rootScope.$on('ws-schedules', function() {
|
||||||
if (api_complete) {
|
if (api_complete) {
|
||||||
scheduled_scope.search('schedule');
|
scheduled_scope.search('schedule');
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -90,7 +90,7 @@ export function ProjectsList ($scope, $rootScope, $location, $log, $stateParams,
|
|||||||
if ($rootScope.removeJobStatusChange) {
|
if ($rootScope.removeJobStatusChange) {
|
||||||
$rootScope.removeJobStatusChange();
|
$rootScope.removeJobStatusChange();
|
||||||
}
|
}
|
||||||
$rootScope.removeJobStatusChange = $rootScope.$on(`ws-${$state.current.name}-jobs`, function(e, data) {
|
$rootScope.removeJobStatusChange = $rootScope.$on(`ws-jobs`, function(e, data) {
|
||||||
var project;
|
var project;
|
||||||
$log.debug(data);
|
$log.debug(data);
|
||||||
if ($scope.projects) {
|
if ($scope.projects) {
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ function JobStatusGraphData(Rest, getBasePath, processErrors, $rootScope, $q) {
|
|||||||
destroyWatcher: angular.noop,
|
destroyWatcher: angular.noop,
|
||||||
setupWatcher: function(period, jobType) {
|
setupWatcher: function(period, jobType) {
|
||||||
this.destroyWatcher =
|
this.destroyWatcher =
|
||||||
$rootScope.$on('ws-dashboard-jobs', function() {
|
$rootScope.$on('ws-jobs', function() {
|
||||||
getData(period, jobType).then(function(result) {
|
getData(period, jobType).then(function(result) {
|
||||||
$rootScope.
|
$rootScope.
|
||||||
$broadcast('DataReceived:JobStatusGraph',
|
$broadcast('DataReceived:JobStatusGraph',
|
||||||
|
|||||||
@@ -104,7 +104,7 @@
|
|||||||
if ($rootScope.inventoryManageStatus) {
|
if ($rootScope.inventoryManageStatus) {
|
||||||
$rootScope.inventoryManageStatus();
|
$rootScope.inventoryManageStatus();
|
||||||
}
|
}
|
||||||
$rootScope.inventoryManageStatus = $rootScope.$on(`ws-${$state.current.name}-jobs`, function(e, data){
|
$rootScope.inventoryManageStatus = $rootScope.$on(`ws-jobs`, function(e, data){
|
||||||
var group = Find({ list: $scope.groups, key: 'id', val: data.group_id });
|
var group = Find({ list: $scope.groups, key: 'id', val: data.group_id });
|
||||||
if(data.status === 'failed' || data.status === 'successful'){
|
if(data.status === 'failed' || data.status === 'successful'){
|
||||||
$state.reload();
|
$state.reload();
|
||||||
|
|||||||
@@ -48,22 +48,22 @@
|
|||||||
$scope.status = res.results[0].status;
|
$scope.status = res.results[0].status;
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
if ($rootScope.removeJobStatusChange) {
|
if ($rootScope.removeJobSummaryComplete) {
|
||||||
$rootScope.removeJobStatusChange();
|
$rootScope.removeJobSummaryComplete();
|
||||||
}
|
}
|
||||||
// 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
|
||||||
$rootScope.removeJobStatusChange = $rootScope.$on('ws-JobSummaryComplete', function(e, data) {
|
$rootScope.removeJobSummaryComplete = $rootScope.$on('ws-jobs-summary', 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();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
if ($rootScope.removeJobSummaryComplete) {
|
if ($rootScope.removeJobStatusChange) {
|
||||||
$rootScope.removeJobSummaryComplete();
|
$rootScope.removeJobStatusChange();
|
||||||
}
|
}
|
||||||
$rootScope.removeJobSummaryComplete = $rootScope.$on('ws-jobDetail-jobs', function(e, data) {
|
$rootScope.removeJobStatusChange = $rootScope.$on('ws-jobs', 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;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -201,7 +201,7 @@ export default
|
|||||||
if ($rootScope.removeJobEventChange) {
|
if ($rootScope.removeJobEventChange) {
|
||||||
$rootScope.removeJobEventChange();
|
$rootScope.removeJobEventChange();
|
||||||
}
|
}
|
||||||
$rootScope.removeJobEventChange = $rootScope.$on(`ws-${$state.current.name}-job_events-${job_id}`, function(e, data) {
|
$rootScope.removeJobEventChange = $rootScope.$on(`ws-job_events-${job_id}`, function(e, data) {
|
||||||
// update elapsed time on each event received
|
// update elapsed time on each event received
|
||||||
scope.job_status.elapsed = GetElapsed({
|
scope.job_status.elapsed = GetElapsed({
|
||||||
start: scope.job.created,
|
start: scope.job.created,
|
||||||
@@ -225,7 +225,7 @@ export default
|
|||||||
if ($rootScope.removeJobStatusChange) {
|
if ($rootScope.removeJobStatusChange) {
|
||||||
$rootScope.removeJobStatusChange();
|
$rootScope.removeJobStatusChange();
|
||||||
}
|
}
|
||||||
$rootScope.removeJobStatusChange = $rootScope.$on(`ws-${$state.current.name}-jobs`, function(e, data) {
|
$rootScope.removeJobStatusChange = $rootScope.$on(`ws-jobs`, function(e, data) {
|
||||||
// if we receive a status change event for the current job indicating the job
|
// if we receive a status change event for the current job indicating the job
|
||||||
// is finished, stop event queue processing and reload
|
// is finished, stop event queue processing and reload
|
||||||
if (parseInt(data.unified_job_id, 10) === parseInt(job_id,10)) {
|
if (parseInt(data.unified_job_id, 10) === parseInt(job_id,10)) {
|
||||||
@@ -242,7 +242,7 @@ export default
|
|||||||
if ($rootScope.removeJobSummaryComplete) {
|
if ($rootScope.removeJobSummaryComplete) {
|
||||||
$rootScope.removeJobSummaryComplete();
|
$rootScope.removeJobSummaryComplete();
|
||||||
}
|
}
|
||||||
$rootScope.removeJobSummaryComplete = $rootScope.$on('ws-JobSummaryComplete', function() {
|
$rootScope.removeJobSummaryComplete = $rootScope.$on('ws-jobs-summary', function() {
|
||||||
// the job host summary should now be available from the API
|
// the job host summary should now be available from the API
|
||||||
$log.debug('Trigging reload of job_host_summaries');
|
$log.debug('Trigging reload of job_host_summaries');
|
||||||
scope.$emit('InitialLoadComplete');
|
scope.$emit('InitialLoadComplete');
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ export default
|
|||||||
if ($rootScope.JobStatusChange) {
|
if ($rootScope.JobStatusChange) {
|
||||||
$rootScope.JobStatusChange();
|
$rootScope.JobStatusChange();
|
||||||
}
|
}
|
||||||
$rootScope.JobStatusChange = $rootScope.$on(`ws-${$state.current.name}-jobs`, function (e, data) {
|
$rootScope.JobStatusChange = $rootScope.$on(`ws-jobs`, function (e, data) {
|
||||||
$scope.search(list.iterator);
|
$scope.search(list.iterator);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ export default ['$scope', '$rootScope', '$location', '$log',
|
|||||||
if ($rootScope.JobStatusChange) {
|
if ($rootScope.JobStatusChange) {
|
||||||
$rootScope.JobStatusChange();
|
$rootScope.JobStatusChange();
|
||||||
}
|
}
|
||||||
$rootScope.JobStatusChange = $rootScope.$on(`ws-${$state.current.name}-jobs`, function (e, data) {
|
$rootScope.JobStatusChange = $rootScope.$on(`ws-jobs`, function (e, data) {
|
||||||
$scope.search(list.iterator);
|
$scope.search(list.iterator);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -90,7 +90,7 @@ export default ['$scope', '$rootScope', '$location', '$log',
|
|||||||
if ($rootScope.removeJobStatusChange) {
|
if ($rootScope.removeJobStatusChange) {
|
||||||
$rootScope.removeJobStatusChange();
|
$rootScope.removeJobStatusChange();
|
||||||
}
|
}
|
||||||
$rootScope.removeJobStatusChange = $rootScope.$on(`ws-${$state.current.name}-jobs`, function(e, data) {
|
$rootScope.removeJobStatusChange = $rootScope.$on(`ws-jobs`, function(e, data) {
|
||||||
var project;
|
var project;
|
||||||
$log.debug(data);
|
$log.debug(data);
|
||||||
if ($scope.projects) {
|
if ($scope.projects) {
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ export function PortalModeJobsController($scope, $rootScope, GetBasePath, Genera
|
|||||||
if ($rootScope.removeJobStatusChange) {
|
if ($rootScope.removeJobStatusChange) {
|
||||||
$rootScope.removeJobStatusChange();
|
$rootScope.removeJobStatusChange();
|
||||||
}
|
}
|
||||||
$rootScope.removeJobStatusChange = $rootScope.$on('ws-portalMode-jobs', function() {
|
$rootScope.removeJobStatusChange = $rootScope.$on('ws-jobs', function() {
|
||||||
$scope.search('job');
|
$scope.search('job');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ export default
|
|||||||
$log.debug('Error Logged: ' + error); //log errors
|
$log.debug('Error Logged: ' + error); //log errors
|
||||||
};
|
};
|
||||||
|
|
||||||
self.socket.onclose = function (error) {
|
self.socket.onclose = function () {
|
||||||
$log.debug('Websocket Disconnected.');
|
$log.debug('Websocket Disconnected.');
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -41,13 +41,13 @@ export default
|
|||||||
// we know that this must have been a
|
// we know that this must have been a
|
||||||
// summary complete message
|
// summary complete message
|
||||||
$log.debug('Job summary_complete ' + data.unified_job_id);
|
$log.debug('Job summary_complete ' + data.unified_job_id);
|
||||||
$rootScope.$emit('ws-JobSummaryComplete', data);
|
$rootScope.$emit('ws-jobs-summary', data);
|
||||||
}
|
}
|
||||||
else if(data.group_name==="job_events"){
|
else if(data.group_name==="job_events"){
|
||||||
str = `ws-${$state.current.name}-${data.group_name}-${data.job}`;
|
str = `ws-${data.group_name}-${data.job}`;
|
||||||
}
|
}
|
||||||
else if(data.group_name==="ad_hoc_command_events"){
|
else if(data.group_name==="ad_hoc_command_events"){
|
||||||
str = `ws-${$state.current.name}-${data.group_name}-${data.ad_hoc_command}`;
|
str = `ws-${data.group_name}-${data.ad_hoc_command}`;
|
||||||
}
|
}
|
||||||
else if(data.group_name==="control"){
|
else if(data.group_name==="control"){
|
||||||
$log.debug(data.reason);
|
$log.debug(data.reason);
|
||||||
@@ -55,11 +55,10 @@ export default
|
|||||||
$state.go('signOut');
|
$state.go('signOut');
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// The naming scheme for emitting socket messages to the
|
// The naming scheme is "ws" then a
|
||||||
// correct route is the route name followed by a
|
|
||||||
// dash (-) and the group_name.
|
// dash (-) and the group_name.
|
||||||
// ex: 'jobDetail-job_events'
|
// ex: 'ws-jobs'
|
||||||
str = `ws-${$state.current.name}-${data.group_name}`;
|
str = `ws-${data.group_name}`;
|
||||||
}
|
}
|
||||||
$rootScope.$emit(str, data);
|
$rootScope.$emit(str, data);
|
||||||
return self.socket;
|
return self.socket;
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ export default ['$log', '$rootScope', '$scope', '$state', '$stateParams', 'Proce
|
|||||||
function openSockets() {
|
function openSockets() {
|
||||||
if ($state.current.name === 'jobDetail') {
|
if ($state.current.name === 'jobDetail') {
|
||||||
$log.debug("socket watching on job_events-" + job_id);
|
$log.debug("socket watching on job_events-" + job_id);
|
||||||
$rootScope.$on(`ws-${$state.current.name}-job_events-${job_id}`, function() {
|
$rootScope.$on(`ws-job_events-${job_id}`, function() {
|
||||||
$log.debug("socket fired on job_events-" + job_id);
|
$log.debug("socket fired on job_events-" + job_id);
|
||||||
if (api_complete) {
|
if (api_complete) {
|
||||||
event_queue++;
|
event_queue++;
|
||||||
@@ -36,7 +36,7 @@ export default ['$log', '$rootScope', '$scope', '$state', '$stateParams', 'Proce
|
|||||||
}
|
}
|
||||||
if ($state.current.name === 'adHocJobStdout') {
|
if ($state.current.name === 'adHocJobStdout') {
|
||||||
$log.debug("socket watching on ad_hoc_command_events-" + job_id);
|
$log.debug("socket watching on ad_hoc_command_events-" + job_id);
|
||||||
$rootScope.$on(`ws-${$state.current.name}-ad_hoc_command_events-${job_id}`, function() {
|
$rootScope.$on(`ws-ad_hoc_command_events-${job_id}`, function() {
|
||||||
$log.debug("socket fired on ad_hoc_command_events-" + job_id);
|
$log.debug("socket fired on ad_hoc_command_events-" + job_id);
|
||||||
if (api_complete) {
|
if (api_complete) {
|
||||||
event_queue++;
|
event_queue++;
|
||||||
@@ -192,7 +192,7 @@ export default ['$log', '$rootScope', '$scope', '$state', '$stateParams', 'Proce
|
|||||||
if ($scope.removeJobStatusChange) {
|
if ($scope.removeJobStatusChange) {
|
||||||
$scope.removeJobStatusChange();
|
$scope.removeJobStatusChange();
|
||||||
}
|
}
|
||||||
$scope.removeJobStatusChange = $rootScope.$on(`ws-${$state.current.name}-jobs`, function(e, data) {
|
$scope.removeJobStatusChange = $rootScope.$on(`ws-jobs`, function(e, data) {
|
||||||
if (parseInt(data.unified_job_id, 10) === parseInt(job_id,10)) {
|
if (parseInt(data.unified_job_id, 10) === parseInt(job_id,10)) {
|
||||||
if (data.status === 'failed' || data.status === 'canceled' ||
|
if (data.status === 'failed' || data.status === 'canceled' ||
|
||||||
data.status === 'error' || data.status === 'successful') {
|
data.status === 'error' || data.status === 'successful') {
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ export function JobStdoutController ($rootScope, $scope, $state, $stateParams,
|
|||||||
if ($scope.removeJobStatusChange) {
|
if ($scope.removeJobStatusChange) {
|
||||||
$scope.removeJobStatusChange();
|
$scope.removeJobStatusChange();
|
||||||
}
|
}
|
||||||
$scope.removeJobStatusChange = $rootScope.$on(`ws-${$state.current.name}-jobs`, function(e, data) {
|
$scope.removeJobStatusChange = $rootScope.$on(`ws-jobs`, function(e, data) {
|
||||||
if (parseInt(data.unified_job_id, 10) === parseInt(job_id,10) && $scope.job) {
|
if (parseInt(data.unified_job_id, 10) === parseInt(job_id,10) && $scope.job) {
|
||||||
$scope.job.status = data.status;
|
$scope.job.status = data.status;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user