mirror of
https://github.com/ansible/awx.git
synced 2026-05-10 19:07:36 -02:30
Websockets live updating portal mode
fixed issue with websockets not updating view in portal mode
This commit is contained in:
@@ -19,7 +19,7 @@
|
|||||||
|
|
||||||
tooltip_delay: {show: 500, hide: 100}, // Default number of milliseconds to delay displaying/hiding tooltips
|
tooltip_delay: {show: 500, hide: 100}, // Default number of milliseconds to delay displaying/hiding tooltips
|
||||||
|
|
||||||
debug_mode: true, // Enable console logging messages
|
debug_mode: false, // Enable console logging messages
|
||||||
|
|
||||||
password_strength: 45, // User password strength. Integer between 0 and 100, 100 being impossibly strong.
|
password_strength: 45, // User password strength. Integer between 0 and 100, 100 being impossibly strong.
|
||||||
// This value controls progress bar colors:
|
// This value controls progress bar colors:
|
||||||
|
|||||||
@@ -77,10 +77,9 @@ function JobsListController ($rootScope, $log, $scope, $compile, $routeParams, C
|
|||||||
case 'pending':
|
case 'pending':
|
||||||
case 'waiting':
|
case 'waiting':
|
||||||
queued_scope.search('queued_job');
|
queued_scope.search('queued_job');
|
||||||
break;
|
|
||||||
case 'successful':
|
|
||||||
completed_scope.search('completed_job');
|
completed_scope.search('completed_job');
|
||||||
break;
|
break;
|
||||||
|
case 'successful':
|
||||||
case 'failed':
|
case 'failed':
|
||||||
case 'error':
|
case 'error':
|
||||||
case 'canceled':
|
case 'canceled':
|
||||||
|
|||||||
@@ -79,7 +79,6 @@ function PortalController($scope, $compile, $routeParams, $rootScope, $location,
|
|||||||
searchSize: 'col-lg-6 col-md-6'
|
searchSize: 'col-lg-6 col-md-6'
|
||||||
});
|
});
|
||||||
|
|
||||||
$rootScope.flashMessage = null;
|
|
||||||
|
|
||||||
SearchInit({
|
SearchInit({
|
||||||
scope: $scope,
|
scope: $scope,
|
||||||
@@ -120,48 +119,40 @@ function PortalController($scope, $compile, $routeParams, $rootScope, $location,
|
|||||||
$('.list-well:eq(1)').css('margin-top' , '0px');
|
$('.list-well:eq(1)').css('margin-top' , '0px');
|
||||||
});
|
});
|
||||||
|
|
||||||
// function processEvent(event) {
|
function processEvent(event) {
|
||||||
// switch(event.status) {
|
switch(event.status) {
|
||||||
// case 'running':
|
case 'running':
|
||||||
// jobs_scope.search('running_job');
|
jobs_scope.search('portal_job');
|
||||||
// jobs_scope.search('queued_job');
|
// queued_scope.search('queued_job');
|
||||||
|
break;
|
||||||
// break;
|
case 'new':
|
||||||
// case 'new':
|
case 'pending':
|
||||||
// case 'pending':
|
jobs_scope.search('portal_job');
|
||||||
// case 'waiting':
|
break;
|
||||||
// jobs_scope.search('queued_job');
|
case 'waiting':
|
||||||
|
jobs_scope.search('portal_job');
|
||||||
// break;
|
// completed_scope.search('completed_job');
|
||||||
// case 'successful':
|
break;
|
||||||
// jobs_scope.search('completed_job');
|
case 'successful':
|
||||||
// case 'failed':
|
// // console.log('successful');
|
||||||
// case 'error':
|
// running_scope.search('running_job');
|
||||||
// case 'canceled':
|
// completed_scope.search('completed_job');
|
||||||
// jobs_scope.search('completed_job');
|
// break;
|
||||||
// jobs_scope.search('running_job');
|
case 'failed':
|
||||||
// jobs_scope.search('queued_job');
|
case 'error':
|
||||||
// }
|
case 'canceled':
|
||||||
// }
|
jobs_scope.search('portal_job');
|
||||||
|
// running_scope.search('running_job');
|
||||||
|
// queued_scope.search('queued_job');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if ($rootScope.removeJobStatusChange) {
|
if ($rootScope.removeJobStatusChange) {
|
||||||
$rootScope.removeJobStatusChange();
|
$rootScope.removeJobStatusChange();
|
||||||
}
|
}
|
||||||
$rootScope.removeJobStatusChange = $rootScope.$on('JobStatusChange', function() {
|
$rootScope.removeJobStatusChange = $rootScope.$on('JobStatusChange', function(e, event) {
|
||||||
jobs_scope.refreshJobs();
|
// jobs_scope.search('portal_job');
|
||||||
// if(data.status==='pending'){
|
processEvent(event);
|
||||||
// // $scope.refresh();
|
|
||||||
// $('#portal-jobs').empty();
|
|
||||||
// // $rootScope.flashMessage = null;
|
|
||||||
// PortalJobsWidget({
|
|
||||||
// scope: $scope,
|
|
||||||
// target: 'portal-jobs',
|
|
||||||
// searchSize: 'col-lg-6 col-md-6'
|
|
||||||
// });
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
|
||||||
//x`processEvent(data);
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ angular.module('JobSubmissionHelper', [ 'RestServices', 'Utilities', 'Credential
|
|||||||
$('#password-modal').dialog('close');
|
$('#password-modal').dialog('close');
|
||||||
}
|
}
|
||||||
scope.$emit(callback, data);
|
scope.$emit(callback, data);
|
||||||
scope.$destroy();
|
// scope.$destroy();
|
||||||
})
|
})
|
||||||
.error(function(data, status) {
|
.error(function(data, status) {
|
||||||
ProcessErrors(scope, data, status, null, { hdr: 'Error!',
|
ProcessErrors(scope, data, status, null, { hdr: 'Error!',
|
||||||
@@ -764,7 +764,7 @@ function($location, Wait, GetBasePath, LookUpInit, JobTemplateForm, CredentialLi
|
|||||||
}
|
}
|
||||||
scope.removePlaybookLaunchFinished = scope.$on('PlaybookLaunchFinished', function(e, data) {
|
scope.removePlaybookLaunchFinished = scope.$on('PlaybookLaunchFinished', function(e, data) {
|
||||||
//var base = $location.path().replace(/^\//, '').split('/')[0];
|
//var base = $location.path().replace(/^\//, '').split('/')[0];
|
||||||
if(scope.portalMode===false ){
|
if(scope.portalMode===false || scope.$parent.portalMode===false ){
|
||||||
$location.path('/jobs/' + data.job);
|
$location.path('/jobs/' + data.job);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -405,6 +405,9 @@ angular.module('JobsHelper', ['Utilities', 'RestServices', 'FormGenerator', 'Job
|
|||||||
JobsControllerInit({ scope: scope, parent_scope: parent_scope });
|
JobsControllerInit({ scope: scope, parent_scope: parent_scope });
|
||||||
JobsListUpdate({ scope: scope, parent_scope: parent_scope, list: list });
|
JobsListUpdate({ scope: scope, parent_scope: parent_scope, list: list });
|
||||||
parent_scope.$emit('listLoaded');
|
parent_scope.$emit('listLoaded');
|
||||||
|
// setTimeout(function(){
|
||||||
|
// scope.$apply();
|
||||||
|
// }, 300);
|
||||||
});
|
});
|
||||||
|
|
||||||
if (base === 'jobs' && list.name === 'completed_jobs') {
|
if (base === 'jobs' && list.name === 'completed_jobs') {
|
||||||
|
|||||||
@@ -14,8 +14,8 @@
|
|||||||
angular.module('PortalJobsListDefinition', [])
|
angular.module('PortalJobsListDefinition', [])
|
||||||
.value( 'PortalJobsList', {
|
.value( 'PortalJobsList', {
|
||||||
|
|
||||||
name: 'jobs',
|
name: 'portal_jobs',
|
||||||
iterator: 'job',
|
iterator: 'portal_job',
|
||||||
editTitle: 'Jobs',
|
editTitle: 'Jobs',
|
||||||
'class': 'table-condensed',
|
'class': 'table-condensed',
|
||||||
index: false,
|
index: false,
|
||||||
@@ -39,8 +39,8 @@ angular.module('PortalJobsListDefinition', [])
|
|||||||
columnClass: 'col-lg-1 col-md-2 col-sm-2 col-xs-2',
|
columnClass: 'col-lg-1 col-md-2 col-sm-2 col-xs-2',
|
||||||
// awToolTip: "{{ job.status_tip }}",
|
// awToolTip: "{{ job.status_tip }}",
|
||||||
// awTipPlacement: "top",
|
// awTipPlacement: "top",
|
||||||
dataTitle: "{{ job.status_popover_title }}",
|
dataTitle: "{{ portal_job.status_popover_title }}",
|
||||||
icon: 'icon-job-{{ job.status }}',
|
icon: 'icon-job-{{ portal_job.status }}',
|
||||||
iconOnly: true,
|
iconOnly: true,
|
||||||
// ngClick:"viewJobLog(job.id)",
|
// ngClick:"viewJobLog(job.id)",
|
||||||
searchable: true,
|
searchable: true,
|
||||||
@@ -73,7 +73,7 @@ angular.module('PortalJobsListDefinition', [])
|
|||||||
fieldActions: {
|
fieldActions: {
|
||||||
job_details: {
|
job_details: {
|
||||||
mode: 'all',
|
mode: 'all',
|
||||||
ngClick: "viewJobLog(job.id)",
|
ngClick: "viewJobLog(portal_job.id)",
|
||||||
awToolTip: 'View job details',
|
awToolTip: 'View job details',
|
||||||
dataPlacement: 'top'
|
dataPlacement: 'top'
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -76,39 +76,11 @@ angular.module('PortalJobsWidget', ['RestServices', 'Utilities'])
|
|||||||
scope: jobs_scope,
|
scope: jobs_scope,
|
||||||
list: PortalJobsList,
|
list: PortalJobsList,
|
||||||
id: 'active-jobs',
|
id: 'active-jobs',
|
||||||
url: GetBasePath('unified_jobs') + '?status__in=running,completed,failed,successful,error,canceled',
|
url: GetBasePath('jobs'), //+ '?type__in=job' , //&status__in=running,completed,failed,successful,error,canceled',
|
||||||
pageSize: max_rows,
|
pageSize: max_rows,
|
||||||
spinner: true
|
spinner: true
|
||||||
});
|
});
|
||||||
|
|
||||||
// completed_scope.showJobType = true;
|
|
||||||
// LoadJobsScope({
|
|
||||||
// parent_scope: scope,
|
|
||||||
// scope: completed_scope,
|
|
||||||
// list: PortalJobsList,
|
|
||||||
// id: 'active-jobs',
|
|
||||||
// url: GetBasePath('unified_jobs') + '?or__status=successful&or__status=failed&or__status=error&or__status=canceled',
|
|
||||||
// // searchParams: search_params,
|
|
||||||
// pageSize: max_rows
|
|
||||||
// });
|
|
||||||
|
|
||||||
// LoadJobsScope({
|
|
||||||
// parent_scope: scope,
|
|
||||||
// scope: running_scope,
|
|
||||||
// list: PortalJobsList,
|
|
||||||
// id: 'active-jobs',
|
|
||||||
// url: GetBasePath('unified_jobs') + '?status=running',
|
|
||||||
// pageSize: max_rows
|
|
||||||
// });
|
|
||||||
|
|
||||||
// LoadJobsScope({
|
|
||||||
// parent_scope: scope,
|
|
||||||
// scope: queued_scope,
|
|
||||||
// list: PortalJobsList,
|
|
||||||
// id: 'active-jobs',
|
|
||||||
// url: GetBasePath('unified_jobs') + '?or__status=pending&or__status=waiting&or__status=new',
|
|
||||||
// pageSize: max_rows
|
|
||||||
// });
|
|
||||||
|
|
||||||
$(window).resize(_.debounce(function() {
|
$(window).resize(_.debounce(function() {
|
||||||
resizePortalJobsWidget();
|
resizePortalJobsWidget();
|
||||||
|
|||||||
@@ -28,7 +28,6 @@ angular.module('SocketIO', ['AuthService', 'Utilities'])
|
|||||||
endpoint = params.endpoint,
|
endpoint = params.endpoint,
|
||||||
protocol = $location.protocol(),
|
protocol = $location.protocol(),
|
||||||
config, socketPort,
|
config, socketPort,
|
||||||
// handshakeData,
|
|
||||||
url;
|
url;
|
||||||
|
|
||||||
// Since some pages are opened in a new tab, we might get here before AnsibleConfig is available.
|
// Since some pages are opened in a new tab, we might get here before AnsibleConfig is available.
|
||||||
|
|||||||
Reference in New Issue
Block a user