From 9747f7597bf01148b660c824e528e2cd94ba0b17 Mon Sep 17 00:00:00 2001 From: John Mitchell Date: Thu, 16 Feb 2017 16:24:18 -0500 Subject: [PATCH] fix performance for the last time of 3.1.0? --- .../src/job-results/job-results.controller.js | 36 ++++++++++++------- 1 file changed, 24 insertions(+), 12 deletions(-) diff --git a/awx/ui/client/src/job-results/job-results.controller.js b/awx/ui/client/src/job-results/job-results.controller.js index 1e57f7bf4c..9f3235cd89 100644 --- a/awx/ui/client/src/job-results/job-results.controller.js +++ b/awx/ui/client/src/job-results/job-results.controller.js @@ -298,6 +298,14 @@ function(jobData, jobDataOptions, jobLabels, jobFinished, count, $scope, ParseTy $scope.job.finished = mungedEvent.finishedTime; $scope.jobFinished = true; $scope.followTooltip = "Jump to last line of standard out."; + if ($scope.followEngaged) { + if (!$scope.followScroll) { + $scope.followScroll = function() { + $log.error("follow scroll undefined, standard out directive not loaded yet?"); + }; + } + $scope.followScroll(); + } } if (change === 'countFinished') { @@ -412,17 +420,6 @@ function(jobData, jobDataOptions, jobLabels, jobFinished, count, $scope, ParseTy // container $(".JobResultsStdOut-followAnchor") .appendTo(".JobResultsStdOut-stdoutContainer"); - - // if follow is engaged, - // scroll down to the followAnchor - if ($scope.followEngaged) { - if (!$scope.followScroll) { - $scope.followScroll = function() { - $log.error("follow scroll undefined, standard out directive not loaded yet?"); - }; - } - $scope.followScroll(); - } } }); @@ -591,10 +588,25 @@ function(jobData, jobDataOptions, jobLabels, jobFinished, count, $scope, ParseTy var buffer = []; var processBuffer = function() { - for (let i = 0; i < 20; i++) { + var follow = function() { + // if follow is engaged, + // scroll down to the followAnchor + if ($scope.followEngaged) { + if (!$scope.followScroll) { + $scope.followScroll = function() { + $log.error("follow scroll undefined, standard out directive not loaded yet?"); + }; + } + $scope.followScroll(); + } + } + + for (let i = 0; i < 4; i++) { processEvent(buffer[i]); buffer.splice(i, 1); } + + follow(); }; var bufferInterval;