From 5a461a5471fa0b8d4bb7b63bdeeeea1281b67d9b Mon Sep 17 00:00:00 2001 From: Chris Houseknecht Date: Thu, 19 Jun 2014 00:17:05 -0400 Subject: [PATCH] Job detail page refactor Endless scrolling queries appear to no longer be firing when programmatically scrolling to the end of list. --- awx/ui/static/js/controllers/JobDetail.js | 37 ++++++++++++----------- awx/ui/static/js/helpers/JobDetail.js | 1 + 2 files changed, 21 insertions(+), 17 deletions(-) diff --git a/awx/ui/static/js/controllers/JobDetail.js b/awx/ui/static/js/controllers/JobDetail.js index 7586660d43..ea166a2dad 100644 --- a/awx/ui/static/js/controllers/JobDetail.js +++ b/awx/ui/static/js/controllers/JobDetail.js @@ -377,9 +377,10 @@ function JobDetailController ($rootScope, $scope, $compile, $routeParams, $log, scope.removeFixPlaysScroll(); } scope.removeFixPlaysScroll = scope.$on('FixPlaysScroll', function() { - scope.auto_scroll = true; + scope.auto_scroll_plays = true; $('#plays-table-detail').mCustomScrollbar("update"); setTimeout( function() { + scope.auto_scroll_plays = true; $('#plays-table-detail').mCustomScrollbar("scrollTo", "bottom"); }, 500); }); @@ -388,26 +389,26 @@ function JobDetailController ($rootScope, $scope, $compile, $routeParams, $log, scope.removeFixTasksScroll(); } scope.removeFixTasksScroll = scope.$on('FixTasksScroll', function() { - scope.auto_scroll = true; + scope.auto_scroll_tasks = true; $('#tasks-table-detail').mCustomScrollbar("update"); setTimeout( function() { + scope.auto_scroll_tasks = true; $('#tasks-table-detail').mCustomScrollbar("scrollTo", "bottom"); }, 500); }); - if (scope.removeFixHostResultsScroll) { scope.removeFixHostResultsScroll(); } scope.removeFixHostResultsScroll = scope.$on('FixHostResultsScroll', function() { - scope.auto_scroll = true; + scope.auto_scroll_results = true; $('#hosts-table-detail').mCustomScrollbar("update"); setTimeout( function() { + scope.auto_scroll_results = true; $('#hosts-table-detail').mCustomScrollbar("scrollTo", "bottom"); }, 500); }); - scope.adjustSize = function() { var height, ww = $(window).width(); if (ww < 1240) { @@ -481,6 +482,7 @@ function JobDetailController ($rootScope, $scope, $compile, $routeParams, $log, }; scope.selectPlay = function(id) { + scope.auto_scroll_plays = false; SelectPlay({ scope: scope, id: id @@ -488,6 +490,7 @@ function JobDetailController ($rootScope, $scope, $compile, $routeParams, $log, }; scope.selectTask = function(id) { + scope.auto_scroll_tasks = false; SelectTask({ scope: scope, id: id @@ -566,7 +569,7 @@ function JobDetailController ($rootScope, $scope, $compile, $routeParams, $log, // Called when user scrolls down (or forward in time) var url, mcs = arguments[0]; scope.$apply(function() { - if ((!scope.auto_scroll) && scope.activeTask && scope.hostResults.length) { + if ((!scope.auto_scroll_results) && scope.activeTask && scope.hostResults.length) { scope.auto_scroll = true; url = GetBasePath('jobs') + job_id + '/job_events/?parent=' + scope.activeTask + '&'; url += (scope.search_all_hosts_name) ? 'host__name__icontains=' + scope.search_all_hosts_name + '&' : ''; @@ -604,7 +607,7 @@ function JobDetailController ($rootScope, $scope, $compile, $routeParams, $log, }); } else { - scope.auto_scroll = false; + scope.auto_scroll_results = false; } }); }, 300); @@ -613,7 +616,7 @@ function JobDetailController ($rootScope, $scope, $compile, $routeParams, $log, // Called when user scrolls up (or back in time) var url, mcs = arguments[0]; scope.$apply(function() { - if ((!scope.auto_scroll) && scope.activeTask && scope.hostResults.length) { + if ((!scope.auto_scroll_results) && scope.activeTask && scope.hostResults.length) { scope.auto_scroll = true; url = GetBasePath('jobs') + job_id + '/job_events/?parent=' + scope.activeTask + '&'; url += (scope.search_all_hosts_name) ? 'host__name__icontains=' + scope.search_all_hosts_name + '&' : ''; @@ -651,7 +654,7 @@ function JobDetailController ($rootScope, $scope, $compile, $routeParams, $log, }); } else { - scope.auto_scroll = false; + scope.auto_scroll_results = false; } }); }, 300); @@ -660,7 +663,7 @@ function JobDetailController ($rootScope, $scope, $compile, $routeParams, $log, // Called when user scrolls down (or forward in time) var url, mcs = arguments[0]; scope.$apply(function() { - if ((!scope.auto_scroll) && scope.activePlay && scope.tasks.length) { + if ((!scope.auto_scroll_tasks) && scope.activePlay && scope.tasks.length) { scope.auto_scroll = true; url = scope.job.url + 'job_tasks/?event_id=' + scope.activePlay; url += (scope.search_all_tasks.length > 0) ? '&id__in=' + scope.search_all_tasks.join() : ''; @@ -729,7 +732,7 @@ function JobDetailController ($rootScope, $scope, $compile, $routeParams, $log, }); } else { - scope.auto_scroll = false; + scope.auto_scroll_tasks = false; } }); }, 300); @@ -738,7 +741,7 @@ function JobDetailController ($rootScope, $scope, $compile, $routeParams, $log, // Called when user scrolls up (or back in time) var url, mcs = arguments[0]; scope.$apply(function() { - if ((!scope.auto_scroll) && scope.activePlay && scope.tasks.length) { + if ((!scope.auto_scroll_tasks) && scope.activePlay && scope.tasks.length) { scope.auto_scroll = true; url = scope.job.url + 'job_tasks/?event_id=' + scope.activePlay; url += (scope.search_all_tasks.length > 0) ? '&id__in=' + scope.search_all_tasks.join() : ''; @@ -807,14 +810,14 @@ function JobDetailController ($rootScope, $scope, $compile, $routeParams, $log, }); } else { - scope.auto_scroll = false; + scope.auto_scroll_tasks = false; } }); }, 300); scope.HostSummaryOnTotalScroll = function(mcs) { var url; - if ((!scope.auto_scroll) && scope.hosts) { + if ((!scope.auto_scroll_summary) && scope.hosts) { url = GetBasePath('jobs') + job_id + '/job_host_summaries/?'; url += (scope.search_all_hosts_name) ? 'host__name__icontains=' + scope.search_all_hosts_name + '&' : ''; url += (scope.searchAllStatus === 'failed') ? 'failed=true&' : ''; @@ -852,13 +855,13 @@ function JobDetailController ($rootScope, $scope, $compile, $routeParams, $log, }); } else { - scope.auto_scroll = false; + scope.auto_scroll_summary = false; } }; scope.HostSummaryOnTotalScrollBack = function(mcs) { var url; - if ((!scope.auto_scroll) && scope.hosts) { + if ((!scope.auto_scroll_summary) && scope.hosts) { url = GetBasePath('jobs') + job_id + '/job_host_summaries/?'; url += (scope.search_all_hosts_name) ? 'host__name__icontains=' + scope.search_all_hosts_name + '&' : ''; url += (scope.searchAllStatus === 'failed') ? 'failed=true&' : ''; @@ -896,7 +899,7 @@ function JobDetailController ($rootScope, $scope, $compile, $routeParams, $log, }); } else { - scope.auto_scroll = false; + scope.auto_scroll_summary = false; } }; diff --git a/awx/ui/static/js/helpers/JobDetail.js b/awx/ui/static/js/helpers/JobDetail.js index 9af481396e..adc6838566 100644 --- a/awx/ui/static/js/helpers/JobDetail.js +++ b/awx/ui/static/js/helpers/JobDetail.js @@ -516,6 +516,7 @@ function($rootScope, $log, UpdatePlayStatus, UpdateHostStatus, AddHostResult, Ge scope.hostResults.forEach(function(result, idx) { scope.hostResultsMap[result.id] = idx; }); + scope.$emit('FixHostResultsScroll'); } // update the task status bar