From: Dominik Csapak <d.csapak@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH widget-toolkit v2 1/2] ui: logpanel: fix glitching fast task logs
Date: Tue, 23 Nov 2021 13:02:28 +0100 [thread overview]
Message-ID: <20211123120229.3606307-2-d.csapak@proxmox.com> (raw)
In-Reply-To: <20211123120229.3606307-1-d.csapak@proxmox.com>
if the total we got was bigger than the last line number, we appended
empty lines at the end of the panel, to which we scrolled
the only time we need to do that is when we do not follow the task log
'live' but when we are elsewhere (to keep the scroll position/size)
so give the lines directly to 'updateView' and let it decide
if we append the empty lines at the end
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
src/panel/LogView.js | 19 ++++++++++++-------
1 file changed, 12 insertions(+), 7 deletions(-)
diff --git a/src/panel/LogView.js b/src/panel/LogView.js
index 1772737..51335fa 100644
--- a/src/panel/LogView.js
+++ b/src/panel/LogView.js
@@ -45,27 +45,33 @@ Ext.define('Proxmox.panel.LogView', {
return maxPos - pos;
},
- updateView: function(text, first, total) {
+ updateView: function(lines, first, total) {
let me = this;
let view = me.getView();
let viewModel = me.getViewModel();
let content = me.lookup('content');
let data = viewModel.get('data');
- if (first === data.first && total === data.total && text.length === data.textlen) {
+ if (first === data.first && total === data.total && lines.length === data.lines) {
return; // same content, skip setting and scrolling
}
viewModel.set('data', {
first: first,
total: total,
- textlen: text.length,
+ lines: lines.length,
});
let scrollPos = me.scrollPosBottom();
+ let scrollToBottom = view.scrollToEnd && scrollPos <= 5;
- content.update(text);
+ if (!scrollToBottom) {
+ // so that we have the 'correct' height for the text
+ lines.length = total;
+ }
+
+ content.update(lines.join('<br>'));
- if (view.scrollToEnd && scrollPos <= 5) {
+ if (scrollToBottom) {
// we use setTimeout to work around scroll handling on touchscreens
setTimeout(function() { view.scrollTo(0, Infinity); }, 10);
}
@@ -97,8 +103,7 @@ Ext.define('Proxmox.panel.LogView', {
lines[line.n - 1] = Ext.htmlEncode(line.t);
});
- lines.length = total;
- me.updateView(lines.join('<br>'), first - 1, total);
+ me.updateView(lines, first - 1, total);
me.running = false;
if (me.requested) {
me.requested = false;
--
2.30.2
next prev parent reply other threads:[~2021-11-23 12:02 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-23 12:02 [pve-devel] [PATCH widget-toolkit v2 0/2] improve logpanel behaviour for fast tasks Dominik Csapak
2021-11-23 12:02 ` Dominik Csapak [this message]
2021-11-23 12:02 ` [pve-devel] [PATCH widget-toolkit v2 2/2] ui: logpanel: catch up to very fast task logs with api calls Dominik Csapak
2021-11-24 10:43 ` [pve-devel] applied-series: [PATCH widget-toolkit v2 0/2] improve logpanel behaviour for fast tasks Thomas Lamprecht
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20211123120229.3606307-2-d.csapak@proxmox.com \
--to=d.csapak@proxmox.com \
--cc=pve-devel@lists.proxmox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox