]> git.proxmox.com Git - proxmox-widget-toolkit.git/commitdiff
panel/JournalView: fix flickering in journal livemode
authorDominik Csapak <d.csapak@proxmox.com>
Tue, 22 Jun 2021 09:57:25 +0000 (11:57 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Tue, 22 Jun 2021 10:46:26 +0000 (12:46 +0200)
it seems that something changed in extjs 7 which does not quite
restore the correct scroll position when the identical content is set
on a component. this means that sometimes, we update the text
with the identical one, but the scroll position is now off, only
to scroll back to the bottom

this causes a flickering everytime we do the api call.

instead, only update the component when the content really changed.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
src/panel/JournalView.js

index 692f2414569ec879bda5c72d2f02458d35a9fe6f..f672be137df657d37457c184e288e915e245d024 100644 (file)
@@ -77,6 +77,8 @@ Ext.define('Proxmox.panel.JournalView', {
            let num = lines.length;
            let text = lines.map(Ext.htmlEncode).join('<br>');
 
+           let contentChanged = true;
+
            if (!livemode) {
                if (num) {
                    view.content = text;
@@ -89,6 +91,8 @@ Ext.define('Proxmox.panel.JournalView', {
                    view.content = view.content ? text + '<br>' + view.content : text;
                } else if (!top && num) {
                    view.content = view.content ? view.content + '<br>' + text : text;
+               } else {
+                   contentChanged = false;
                }
 
                // update cursors
@@ -101,7 +105,9 @@ Ext.define('Proxmox.panel.JournalView', {
                }
            }
 
-           contentEl.update(view.content);
+           if (contentChanged) {
+               contentEl.update(view.content);
+           }
 
            me.updateScroll(livemode, num, scrollPos, scrollPosTop);
        },