mirror of
https://github.com/ansible/awx.git
synced 2026-03-02 09:18:48 -03:30
set page-up post-scroll height to beginning of new dataset
This commit is contained in:
@@ -99,11 +99,9 @@ function previous () {
|
|||||||
const initialPosition = scroll.getScrollPosition();
|
const initialPosition = scroll.getScrollPosition();
|
||||||
|
|
||||||
return slide.slideUp()
|
return slide.slideUp()
|
||||||
.then(changed => {
|
.then(popHeight => {
|
||||||
if (changed[0] !== 0 || changed[1] !== 0) {
|
const currentHeight = scroll.getScrollHeight();
|
||||||
const currentHeight = scroll.getScrollHeight();
|
scroll.setScrollPosition(currentHeight - popHeight + initialPosition);
|
||||||
scroll.setScrollPosition((currentHeight / 4) - initialPosition);
|
|
||||||
}
|
|
||||||
|
|
||||||
return $q.resolve();
|
return $q.resolve();
|
||||||
});
|
});
|
||||||
@@ -289,7 +287,7 @@ function OutputIndexController (
|
|||||||
bufferInit();
|
bufferInit();
|
||||||
|
|
||||||
status.init(resource);
|
status.init(resource);
|
||||||
slide.init(render, resource.events);
|
slide.init(render, resource.events, scroll);
|
||||||
|
|
||||||
render.init({ compile, toggles: vm.toggleLineEnabled });
|
render.init({ compile, toggles: vm.toggleLineEnabled });
|
||||||
scroll.init({ previous, next });
|
scroll.init({ previous, next });
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ function getOverlapArray (range, other) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function SlidingWindowService ($q) {
|
function SlidingWindowService ($q) {
|
||||||
this.init = (storage, api) => {
|
this.init = (storage, api, { getScrollHeight }) => {
|
||||||
const { prepend, append, shift, pop, deleteRecord } = storage;
|
const { prepend, append, shift, pop, deleteRecord } = storage;
|
||||||
const { getMaxCounter, getRange, getFirst, getLast } = api;
|
const { getMaxCounter, getRange, getFirst, getLast } = api;
|
||||||
|
|
||||||
@@ -78,6 +78,10 @@ function SlidingWindowService ($q) {
|
|||||||
deleteRecord,
|
deleteRecord,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
this.hooks = {
|
||||||
|
getScrollHeight,
|
||||||
|
};
|
||||||
|
|
||||||
this.records = {};
|
this.records = {};
|
||||||
this.uuids = {};
|
this.uuids = {};
|
||||||
this.chain = $q.resolve();
|
this.chain = $q.resolve();
|
||||||
@@ -153,7 +157,7 @@ function SlidingWindowService ($q) {
|
|||||||
|
|
||||||
let lines = 0;
|
let lines = 0;
|
||||||
|
|
||||||
for (let i = min; i <= min + count; ++i) {
|
for (let i = min; i <= max; ++i) {
|
||||||
if (this.records[i]) {
|
if (this.records[i]) {
|
||||||
lines += (this.records[i].end_line - this.records[i].start_line);
|
lines += (this.records[i].end_line - this.records[i].start_line);
|
||||||
}
|
}
|
||||||
@@ -199,6 +203,21 @@ function SlidingWindowService ($q) {
|
|||||||
.then(events => this.pushFront(events));
|
.then(events => this.pushFront(events));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (overlap && overlap[0] < 0) {
|
||||||
|
this.chain = this.chain.then(() => this.popBack(Math.abs(overlap[0])));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (overlap && overlap[1] < 0) {
|
||||||
|
this.chain = this.chain.then(() => this.popFront(Math.abs(overlap[1])));
|
||||||
|
}
|
||||||
|
|
||||||
|
let popHeight;
|
||||||
|
this.chain = this.chain.then(() => {
|
||||||
|
popHeight = this.hooks.getScrollHeight();
|
||||||
|
|
||||||
|
return $q.resolve();
|
||||||
|
});
|
||||||
|
|
||||||
if (overlap && overlap[0] > 0) {
|
if (overlap && overlap[0] > 0) {
|
||||||
const pushBackRange = [head - overlap[0], head];
|
const pushBackRange = [head - overlap[0], head];
|
||||||
|
|
||||||
@@ -215,21 +234,8 @@ function SlidingWindowService ($q) {
|
|||||||
.then(events => this.pushFront(events));
|
.then(events => this.pushFront(events));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (overlap && overlap[0] < 0) {
|
|
||||||
this.chain = this.chain.then(() => this.popBack(Math.abs(overlap[0])));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (overlap && overlap[1] < 0) {
|
|
||||||
this.chain = this.chain.then(() => this.popFront(Math.abs(overlap[1])));
|
|
||||||
}
|
|
||||||
|
|
||||||
this.chain = this.chain
|
this.chain = this.chain
|
||||||
.then(() => {
|
.then(() => $q.resolve(popHeight));
|
||||||
const range = this.getRange();
|
|
||||||
const displacement = [range[0] - head, range[1] - tail];
|
|
||||||
|
|
||||||
return $q.resolve(displacement);
|
|
||||||
});
|
|
||||||
|
|
||||||
return this.chain;
|
return this.chain;
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user