mirror of
https://github.com/ZwareBear/awx.git
synced 2026-05-05 07:51:51 -05:00
Add WIP implementation of pagination with cache
This commit is contained in:
committed by
Jake McDermott
parent
ab8651eab6
commit
4b81d8d494
@@ -89,20 +89,36 @@ function JobsIndexController (_job_, JobEventModel, _$sce_, _$timeout_, _$scope_
|
||||
}
|
||||
|
||||
function next () {
|
||||
job.next({ related: 'job_events' })
|
||||
const config = {
|
||||
related: 'job_events',
|
||||
params: {
|
||||
order_by: 'start_line'
|
||||
}
|
||||
};
|
||||
|
||||
job.next(config)
|
||||
.then(cursor => {
|
||||
meta.next = job.get('related.job_events.next');
|
||||
meta.prev = job.get('related.job_events.previous');
|
||||
|
||||
console.log(ROW_LIMIT);
|
||||
console.log(getRowCount());
|
||||
console.log(getRowHeight());
|
||||
console.log(getRowsInView());
|
||||
console.log(getScrollPosition());
|
||||
|
||||
console.log('above:', getRowsAbove());
|
||||
console.log('below:', getRowsBelow());
|
||||
append(cursor);
|
||||
shift();
|
||||
|
||||
debugger;
|
||||
});
|
||||
}
|
||||
|
||||
function prev () {
|
||||
job.prev({ related: 'job_events' })
|
||||
.then(cursor => {
|
||||
console.log(cursor);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -158,6 +174,22 @@ function append (cursor) {
|
||||
$compile(rows.contents())($scope);
|
||||
}
|
||||
|
||||
/*
|
||||
*function prepend (cursor) {
|
||||
*
|
||||
*}
|
||||
*
|
||||
*/
|
||||
function shift () {
|
||||
const count = getRowCount() - ROW_LIMIT;
|
||||
const rows = $(ELEMENT_TBODY).children().slice(0, count);
|
||||
|
||||
console.log(count, rows);
|
||||
|
||||
rows.empty();
|
||||
rows.remove();
|
||||
}
|
||||
|
||||
function expand () {
|
||||
vm.toggle(meta.parent, true);
|
||||
}
|
||||
@@ -398,6 +430,8 @@ function onScroll () {
|
||||
if (top === 0) {
|
||||
vm.menu.scroll.display = false;
|
||||
|
||||
prev();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user