* [pve-devel] [PATCH widget-toolkit 0/3] improve logpanel behaviour for fast tasks
@ 2021-11-23 7:49 Dominik Csapak
2021-11-23 7:49 ` [pve-devel] [PATCH widget-toolkit 1/3] ui: logpanel: fix glitching on fast task logs Dominik Csapak
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Dominik Csapak @ 2021-11-23 7:49 UTC (permalink / raw)
To: pve-devel
improves the handling of fast moving tasks
* no glitching
* catching up to the end of the task log
* workaround browser quirks
Dominik Csapak (3):
ui: logpanel: fix glitching on fast task logs
ui: logpanel: catch up to very fast task logs with api calls
ui: logpanel: work around browser 'setTimeout' quirks
src/panel/LogView.js | 16 ++++++++++++----
1 file changed, 12 insertions(+), 4 deletions(-)
--
2.30.2
^ permalink raw reply [flat|nested] 4+ messages in thread
* [pve-devel] [PATCH widget-toolkit 1/3] ui: logpanel: fix glitching on fast task logs
2021-11-23 7:49 [pve-devel] [PATCH widget-toolkit 0/3] improve logpanel behaviour for fast tasks Dominik Csapak
@ 2021-11-23 7:49 ` Dominik Csapak
2021-11-23 7:49 ` [pve-devel] [PATCH widget-toolkit 2/3] ui: logpanel: catch up to very fast task logs with api calls Dominik Csapak
2021-11-23 7:49 ` [pve-devel] [PATCH widget-toolkit 3/3] ui: logpanel: work around browser 'setTimeout' quirks Dominik Csapak
2 siblings, 0 replies; 4+ messages in thread
From: Dominik Csapak @ 2021-11-23 7:49 UTC (permalink / raw)
To: pve-devel
when we follow (scrollToEnd === true) a task log that produces many lines
per second, we often get a 'total' back that exceeds our start+limit.
in that case we do not want to pad the bottom of the task log with empty
lines, we only want that for finished task logs to preserve the scroll
bar position+size.
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
src/panel/LogView.js | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/panel/LogView.js b/src/panel/LogView.js
index 1772737..bbf38ee 100644
--- a/src/panel/LogView.js
+++ b/src/panel/LogView.js
@@ -97,7 +97,9 @@ Ext.define('Proxmox.panel.LogView', {
lines[line.n - 1] = Ext.htmlEncode(line.t);
});
- lines.length = total;
+ if (!view.scrollToEnd) {
+ lines.length = total;
+ }
me.updateView(lines.join('<br>'), first - 1, total);
me.running = false;
if (me.requested) {
--
2.30.2
^ permalink raw reply [flat|nested] 4+ messages in thread
* [pve-devel] [PATCH widget-toolkit 2/3] ui: logpanel: catch up to very fast task logs with api calls
2021-11-23 7:49 [pve-devel] [PATCH widget-toolkit 0/3] improve logpanel behaviour for fast tasks Dominik Csapak
2021-11-23 7:49 ` [pve-devel] [PATCH widget-toolkit 1/3] ui: logpanel: fix glitching on fast task logs Dominik Csapak
@ 2021-11-23 7:49 ` Dominik Csapak
2021-11-23 7:49 ` [pve-devel] [PATCH widget-toolkit 3/3] ui: logpanel: work around browser 'setTimeout' quirks Dominik Csapak
2 siblings, 0 replies; 4+ messages in thread
From: Dominik Csapak @ 2021-11-23 7:49 UTC (permalink / raw)
To: pve-devel
if we have a task log that produces more lines than we ask for
(start+limit), set the start to the (current) total-limit.
otherwise, keep the logic to set the start so that our current line is
about in the middle of the requested data (to have a buffer in both
directions)
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
src/panel/LogView.js | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/src/panel/LogView.js b/src/panel/LogView.js
index bbf38ee..4a273a1 100644
--- a/src/panel/LogView.js
+++ b/src/panel/LogView.js
@@ -132,14 +132,20 @@ Ext.define('Proxmox.panel.LogView', {
let line = view.getScrollY()/lineHeight;
let start = viewModel.get('params.start');
let limit = viewModel.get('params.limit');
+ let total = viewModel.get('data.total');
let viewLines = view.getHeight()/lineHeight;
let viewStart = Math.max(parseInt(line - 1 - view.viewBuffer, 10), 0);
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));
+ if (view.scrollToEnd && total) {
+ viewModel.set('params.start',
+ Math.max(parseInt(total - limit, 10), 0));
+ } else {
+ viewModel.set('params.start',
+ Math.max(parseInt(line - (limit / 2) + 10, 10), 0));
+ }
view.loadTask.delay(200);
}
},
--
2.30.2
^ permalink raw reply [flat|nested] 4+ messages in thread
* [pve-devel] [PATCH widget-toolkit 3/3] ui: logpanel: work around browser 'setTimeout' quirks
2021-11-23 7:49 [pve-devel] [PATCH widget-toolkit 0/3] improve logpanel behaviour for fast tasks Dominik Csapak
2021-11-23 7:49 ` [pve-devel] [PATCH widget-toolkit 1/3] ui: logpanel: fix glitching on fast task logs Dominik Csapak
2021-11-23 7:49 ` [pve-devel] [PATCH widget-toolkit 2/3] ui: logpanel: catch up to very fast task logs with api calls Dominik Csapak
@ 2021-11-23 7:49 ` Dominik Csapak
2 siblings, 0 replies; 4+ messages in thread
From: Dominik Csapak @ 2021-11-23 7:49 UTC (permalink / raw)
To: pve-devel
for some reason, some browsers omit the scroll event if the 'scrollTo'
was done before layouting in some cases, so manually trigger our 'onScroll'
handler to set the new start parameter alwyas after scrolling
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
src/panel/LogView.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/panel/LogView.js b/src/panel/LogView.js
index 4a273a1..be3850e 100644
--- a/src/panel/LogView.js
+++ b/src/panel/LogView.js
@@ -67,7 +67,7 @@ Ext.define('Proxmox.panel.LogView', {
if (view.scrollToEnd && scrollPos <= 5) {
// we use setTimeout to work around scroll handling on touchscreens
- setTimeout(function() { view.scrollTo(0, Infinity); }, 10);
+ setTimeout(function() { view.scrollTo(0, Infinity); me.onScroll(); }, 10);
}
},
--
2.30.2
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2021-11-23 7:50 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-23 7:49 [pve-devel] [PATCH widget-toolkit 0/3] improve logpanel behaviour for fast tasks Dominik Csapak
2021-11-23 7:49 ` [pve-devel] [PATCH widget-toolkit 1/3] ui: logpanel: fix glitching on fast task logs Dominik Csapak
2021-11-23 7:49 ` [pve-devel] [PATCH widget-toolkit 2/3] ui: logpanel: catch up to very fast task logs with api calls Dominik Csapak
2021-11-23 7:49 ` [pve-devel] [PATCH widget-toolkit 3/3] ui: logpanel: work around browser 'setTimeout' quirks Dominik Csapak
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox