From 656dcdcd2fc68fbfc6cb9fcf670606a149e7ed27 Mon Sep 17 00:00:00 2001 From: John Mitchell Date: Thu, 16 Feb 2017 16:09:07 -0500 Subject: [PATCH 1/3] fix job results out of order case --- .../src/job-results/job-results.controller.js | 43 +++++++++++-------- 1 file changed, 24 insertions(+), 19 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 cd0cb61626..1e57f7bf4c 100644 --- a/awx/ui/client/src/job-results/job-results.controller.js +++ b/awx/ui/client/src/job-results/job-results.controller.js @@ -365,25 +365,30 @@ function(jobData, jobDataOptions, jobLabels, jobFinished, count, $scope, ParseTy var putAfter; var isDup = false; - $(".header_" + putIn + ",." + putIn) - .each((i, v) => { - if (angular.element(v).scope() - .event.start_line < mungedEvent - .start_line) { - putAfter = v; - } else if (angular.element(v).scope() - .event.start_line === mungedEvent - .start_line) { - isDup = true; - return false; - } else if (angular.element(v).scope() - .event.start_line > mungedEvent - .start_line) { - return false; - } else { - appendToBottom(mungedEvent); - } - }); + + if ($(".header_" + putIn + ",." + putIn).length === 0) { + appendToBottom(mungedEvent); + } else { + $(".header_" + putIn + ",." + putIn) + .each((i, v) => { + if (angular.element(v).scope() + .event.start_line < mungedEvent + .start_line) { + putAfter = v; + } else if (angular.element(v).scope() + .event.start_line === mungedEvent + .start_line) { + isDup = true; + return false; + } else if (angular.element(v).scope() + .event.start_line > mungedEvent + .start_line) { + return false; + } else { + appendToBottom(mungedEvent); + } + }); + } if (!isDup) { $(putAfter).after($compile(mungedEvent From 9747f7597bf01148b660c824e528e2cd94ba0b17 Mon Sep 17 00:00:00 2001 From: John Mitchell Date: Thu, 16 Feb 2017 16:24:18 -0500 Subject: [PATCH 2/3] 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; From 30b4f1787253fdd83a02a051122f971dc8983713 Mon Sep 17 00:00:00 2001 From: John Mitchell Date: Fri, 17 Feb 2017 10:38:38 -0500 Subject: [PATCH 3/3] fix jshint error --- awx/ui/client/src/job-results/job-results.controller.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 9f3235cd89..b968c78222 100644 --- a/awx/ui/client/src/job-results/job-results.controller.js +++ b/awx/ui/client/src/job-results/job-results.controller.js @@ -599,7 +599,7 @@ function(jobData, jobDataOptions, jobLabels, jobFinished, count, $scope, ParseTy } $scope.followScroll(); } - } + }; for (let i = 0; i < 4; i++) { processEvent(buffer[i]);