diff --git a/awx/ui/static/js/app.js b/awx/ui/static/js/app.js index 9887476c5f..4098ffd895 100644 --- a/awx/ui/static/js/app.js +++ b/awx/ui/static/js/app.js @@ -442,13 +442,23 @@ angular.module('Tower', [ function activateTab() { // Make the correct tab active - var base = $location.path().replace(/^\//, '').split('/')[0]; + var base = $location.path().replace(/^\//, '').split('/')[0], + urlDepth = $location.path().replace(/^\//, '').split('/').length; + if (base === '') { base = 'home'; } else { //base.replace(/\_/g, ' '); base = (base === 'job_events' || base === 'job_host_summaries') ? 'jobs' : base; } + + if (urlDepth === 1 && base !== 'home') { + $('#ansible-list-title').html('' + base.replace(/\_/,' ') + ''); + } + else { + $('#ansible-list-title').empty(); + } + $('#ansible-main-menu li').each(function() { $(this).removeClass('active'); }); diff --git a/awx/ui/static/js/controllers/JobStdout.js b/awx/ui/static/js/controllers/JobStdout.js index 6704998d1c..586bb567dd 100644 --- a/awx/ui/static/js/controllers/JobStdout.js +++ b/awx/ui/static/js/controllers/JobStdout.js @@ -25,44 +25,65 @@ function JobStdoutController ($log, $rootScope, $scope, $compile, $routeParams, page_size = 500, lastScrollTop = 0, st, - direction; + direction, + checkCount = 0;; - status_socket = Socket({ - scope: $scope, - endpoint: "jobs" - }); - status_socket.init(); - status_socket.on("status_changed", function(data) { - if (parseInt(data.unified_job_id, 10) === parseInt(job_id,10) && $scope.job) { - $scope.job.status = data.status; - if (data.status === 'failed' || data.status === 'canceled' || - data.status === 'error' || data.status === 'successful') { - if ($rootScope.jobStdOutInterval) { - window.clearInterval($rootScope.jobStdOutInterval); - } - if (live_event_processing) { - if (loaded_sections.length === 0) { - $scope.$emit('LoadStdout'); + + function openSockets() { + status_socket = Socket({ + scope: $scope, + endpoint: "jobs" + }); + status_socket.init(); + status_socket.on("status_changed", function(data) { + if (parseInt(data.unified_job_id, 10) === parseInt(job_id,10) && $scope.job) { + $scope.job.status = data.status; + if (data.status === 'failed' || data.status === 'canceled' || + data.status === 'error' || data.status === 'successful') { + if ($rootScope.jobStdOutInterval) { + window.clearInterval($rootScope.jobStdOutInterval); } - else { - getNextSection(); + if (live_event_processing) { + if (loaded_sections.length === 0) { + $scope.$emit('LoadStdout'); + } + else { + getNextSection(); + } } + live_event_processing = false; } - live_event_processing = false; } - } - }); + }); + event_socket = Socket({ + scope: $scope, + endpoint: "job_events" + }); + event_socket.init(); + event_socket.on("job_events-" + job_id, function() { + if (api_complete) { + event_queue++; + } + }); + } + openSockets(); - event_socket = Socket({ - scope: $scope, - endpoint: "job_events" - }); - event_socket.init(); - event_socket.on("job_events-" + job_id, function() { - if (api_complete) { - event_queue++; + $rootScope.checkSocketConnectionInterval = setInterval(function() { + if (status_socket.checkStatus() === 'error' || checkCount > 2) { + // there's an error or we're stuck in a 'connecting' state. attempt to reconnect + $log.debug('stdout page: initializing and restarting socket connections'); + status_socket = null; + event_socket = null; + openSockets(); + checkCount = 0; } - }); + else if (status_socket.checkStatus() === 'connecting') { + checkCount++; + } + else { + checkCount = 0; + } + }, 3000); $rootScope.jobStdOutInterval = setInterval( function() { if (event_queue > 0) { diff --git a/awx/ui/static/js/controllers/Jobs.js b/awx/ui/static/js/controllers/Jobs.js index b94018505c..17228ca14b 100644 --- a/awx/ui/static/js/controllers/Jobs.js +++ b/awx/ui/static/js/controllers/Jobs.js @@ -21,7 +21,7 @@ function JobsListController ($rootScope, $log, $scope, $compile, $routeParams, C api_complete = false, schedule_socket, job_socket, - max_rows, checkCount; + max_rows, checkCount=0; function openSockets() { job_socket = Socket({ diff --git a/awx/ui/static/less/main-layout.less b/awx/ui/static/less/main-layout.less index b9ac1512ec..65b8f412ea 100644 --- a/awx/ui/static/less/main-layout.less +++ b/awx/ui/static/less/main-layout.less @@ -16,7 +16,7 @@ html { body { font-family: 'Open Sans', sans-serif; font-weight: 400; - padding-top: 60px; + padding-top: 75px; color: @black; } @@ -46,6 +46,10 @@ body { } } +#ansible-list-title { + display: none; +} + #content-container { margin-top: 40px; } @@ -73,6 +77,14 @@ body { display: block; } } + #ansible-list-title { + display: inline-block; + position: relative; + top: 1px; + left: 10px; + color: @black; + text-transform:capitalize; + } #account-menu { display: none; } diff --git a/awx/ui/templates/ui/index.html b/awx/ui/templates/ui/index.html index 5f9c7284ba..bd78df1d44 100644 --- a/awx/ui/templates/ui/index.html +++ b/awx/ui/templates/ui/index.html @@ -13,7 +13,6 @@ - {% if settings.USE_MINIFIED_JS %} @@ -199,10 +198,11 @@ +