mirror of
https://git.proxmox.com/git/proxmox-widget-toolkit
synced 2026-01-08 21:30:26 +00:00
ui: logpanel: catch up to very fast task logs with api calls
by updating the start to 'total-limit' if we follow the task log live. to do that, we decouple the 'scroll' event from updating the 'start' parameter and call that directly after we scrolled down. to not trigger the scroll event multiple times, suspend the scroll event while doing that. while we're touching those lines, remove the 'setTimeout' workaround for touchscreens, since it seems to work fine since extjs 7.0 this also fixes the issue that the scroll event is not called sometimes Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
This commit is contained in:
parent
b5ff20a615
commit
2f47411867
@ -72,8 +72,11 @@ Ext.define('Proxmox.panel.LogView', {
|
||||
content.update(lines.join('<br>'));
|
||||
|
||||
if (scrollToBottom) {
|
||||
// we use setTimeout to work around scroll handling on touchscreens
|
||||
setTimeout(function() { view.scrollTo(0, Infinity); }, 10);
|
||||
let scroller = view.getScrollable();
|
||||
scroller.suspendEvent('scroll');
|
||||
view.scrollTo(0, Infinity);
|
||||
me.updateStart(true);
|
||||
scroller.resumeEvent('scroll');
|
||||
}
|
||||
},
|
||||
|
||||
@ -126,6 +129,25 @@ Ext.define('Proxmox.panel.LogView', {
|
||||
});
|
||||
},
|
||||
|
||||
updateStart: function(scrolledToBottom, targetLine) {
|
||||
let me = this;
|
||||
let view = me.getView();
|
||||
let viewModel = me.getViewModel();
|
||||
|
||||
let limit = viewModel.get('params.limit');
|
||||
|
||||
if (scrolledToBottom) {
|
||||
let total = viewModel.get('data.total');
|
||||
viewModel.set('params.start',
|
||||
Math.max(parseInt(total - limit, 10), 0));
|
||||
} else {
|
||||
viewModel.set('params.start',
|
||||
Math.max(parseInt(targetLine - (limit / 2) + 10, 10), 0));
|
||||
}
|
||||
|
||||
view.loadTask.delay(200);
|
||||
},
|
||||
|
||||
onScroll: function(x, y) {
|
||||
let me = this;
|
||||
let view = me.getView();
|
||||
@ -141,9 +163,7 @@ Ext.define('Proxmox.panel.LogView', {
|
||||
let viewEnd = parseInt(line + viewLines + 1 + view.viewBuffer, 10);
|
||||
|
||||
if (viewStart < start || viewEnd > start+limit) {
|
||||
viewModel.set('params.start',
|
||||
Math.max(parseInt(line - (limit / 2) + 10, 10), 0));
|
||||
view.loadTask.delay(200);
|
||||
me.updateStart(false, line);
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user