From 85b227213f19be0fd1f0a371914d434a83df3ada Mon Sep 17 00:00:00 2001 From: Jake McDermott Date: Mon, 16 Jul 2018 11:42:27 -0400 Subject: [PATCH 1/2] don't page up or down while already paging up or down --- awx/ui/client/features/output/index.controller.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/awx/ui/client/features/output/index.controller.js b/awx/ui/client/features/output/index.controller.js index 0dca3b527f..5039e83ff1 100644 --- a/awx/ui/client/features/output/index.controller.js +++ b/awx/ui/client/features/output/index.controller.js @@ -97,11 +97,15 @@ function first () { } function next () { - return slide.getNext(); + scroll.pause(); + + return slide.getNext() + .finally(() => scroll.resume()); } function previous () { unfollow(); + scroll.pause(); const initialPosition = scroll.getScrollPosition(); @@ -111,7 +115,8 @@ function previous () { scroll.setScrollPosition(currentHeight - popHeight + initialPosition); return $q.resolve(); - }); + }) + .finally(() => scroll.resume()); } function last () { From 81476d544f9ebf8d643b7bcd143b592da2470626 Mon Sep 17 00:00:00 2001 From: Jake McDermott Date: Mon, 16 Jul 2018 11:43:40 -0400 Subject: [PATCH 2/2] fix initial head/tail page values when in page mode --- awx/ui/client/features/output/page.service.js | 21 ++++++++++++------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/awx/ui/client/features/output/page.service.js b/awx/ui/client/features/output/page.service.js index 5acf17c6be..0b14b36d8d 100644 --- a/awx/ui/client/features/output/page.service.js +++ b/awx/ui/client/features/output/page.service.js @@ -27,6 +27,7 @@ function PageService ($q) { this.records = {}; this.uuids = {}; + this.state = { head: 0, tail: 0, @@ -35,16 +36,18 @@ function PageService ($q) { this.chain = $q.resolve(); }; - this.pushFront = results => { + this.pushFront = (results, key) => { if (!results) { return $q.resolve(); } return this.storage.append(results) .then(() => { - this.records[++this.state.tail] = {}; + const tail = key || ++this.state.tail; + + this.records[tail] = {}; results.forEach(({ counter, start_line, end_line, uuid }) => { - this.records[this.state.tail][counter] = { start_line, end_line }; + this.records[tail][counter] = { start_line, end_line }; this.uuids[counter] = uuid; }); @@ -52,16 +55,18 @@ function PageService ($q) { }); }; - this.pushBack = results => { + this.pushBack = (results, key) => { if (!results) { return $q.resolve(); } return this.storage.prepend(results) .then(() => { - this.records[--this.state.head] = {}; + const head = key || --this.state.head; + + this.records[head] = {}; results.forEach(({ counter, start_line, end_line, uuid }) => { - this.records[this.state.head][counter] = { start_line, end_line }; + this.records[head][counter] = { start_line, end_line }; this.uuids[counter] = uuid; }); @@ -216,7 +221,7 @@ function PageService ($q) { this.state.head = lastPage; this.state.tail = lastPage; - return this.pushBack(events); + return this.pushBack(events, lastPage); }) .then(() => this.getPrevious()); @@ -226,7 +231,7 @@ function PageService ($q) { this.state.head = 1; this.state.tail = 1; - return this.pushBack(events); + return this.pushBack(events, 1); }) .then(() => this.getNext());