all lists on lists.proxmox.com
 help / color / mirror / Atom feed
From: Dominik Csapak <d.csapak@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [PATCH manager 3/3] ui: workspace: prompt user for reload when UI packages were updated
Date: Wed, 23 Sep 2026 13:35:03 +0200	[thread overview]
Message-ID: <20260923113757.2202858-4-d.csapak@proxmox.com> (raw)
In-Reply-To: <20260923113757.2202858-1-d.csapak@proxmox.com>

When the UI packages (pve-manager, proxmox-widget-toolkit) are updated,
an already running Web UI instance still uses the potentially older
versions.

Detect that by comparing the version from the site load to the ones
reported from /cluster/resources (which is polled regularly) and prompt
the user to reload the UI.

The message box offers a 'Later' option so that ongoing work can be
finished before reloading. In that case the notice is shown in the top
bar until the user reloads.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
 www/manager6/Workspace.js | 66 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 66 insertions(+)

diff --git a/www/manager6/Workspace.js b/www/manager6/Workspace.js
index 189d3373..392d9783 100644
--- a/www/manager6/Workspace.js
+++ b/www/manager6/Workspace.js
@@ -193,6 +193,55 @@ Ext.define('PVE.StdWorkspace', {
         }
     },
 
+    // compare the versions the backend reports with the ones this page was loaded with
+    checkGUIVersions: function () {
+        let me = this;
+
+        if (me.guiUpdateDetected) {
+            return;
+        }
+
+        let node = PVE.data.ResourceStore.getNodeById(Proxmox.NodeName);
+        let versions = node?.data?.versions;
+        if (!versions) {
+            return; // e.g., older backend
+        }
+
+        let changed = Object.entries(Proxmox.GUIVersions ?? {}).some(
+            ([pkg, loaded]) => versions[pkg] !== undefined && versions[pkg] !== loaded,
+        );
+        if (!changed) {
+            return;
+        }
+
+        me.guiUpdateDetected = true;
+        let msgBox = Ext.create('Ext.window.MessageBox', {
+            closeAction: 'destroy',
+        });
+        msgBox.show({
+            title: gettext('New Version Available'),
+            message: gettext(
+                'A new version of the web interface is available. Reload the page to use it.',
+            ),
+            icon: Ext.Msg.INFO,
+            closable: false,
+            buttons: Ext.Msg.YESNO,
+            buttonText: {
+                yes: gettext('Reload UI'),
+                no: gettext('Later'),
+            },
+            fn: function (btn) {
+                if (btn === 'yes') {
+                    window.location.reload();
+                } else if (btn === 'no') {
+                    me.down('#uiUpdateHint').setVisible(true);
+                    me.down('#uiUpdateBtn').setVisible(true);
+                    msgBox.close();
+                }
+            },
+        });
+    },
+
     updateUserInfo: function () {
         let me = this;
         let ui = me.query('#userinfo')[0];
@@ -352,6 +401,21 @@ Ext.define('PVE.StdWorkspace', {
                                 'line-height': '20px',
                             },
                         },
+                        {
+                            itemId: 'uiUpdateHint',
+                            html: gettext('A new version of the web interface is available.'),
+                            hidden: true,
+                        },
+                        {
+                            xtype: 'button',
+                            itemId: 'uiUpdateBtn',
+                            baseCls: 'x-btn',
+                            iconCls: 'fa fa-refresh',
+                            text: gettext('Reload UI'),
+                            margin: '0 5',
+                            hidden: true,
+                            handler: () => window.location.reload(),
+                        },
                         {
                             flex: 2,
                         },
@@ -546,6 +610,8 @@ Ext.define('PVE.StdWorkspace', {
 
         me.updateUserInfo();
 
+        me.mon(PVE.data.ResourceStore, 'load', me.checkGUIVersions, me);
+
         // on resize, center all modal windows
         Ext.on('resize', function () {
             let modalWindows = Ext.ComponentQuery.query('window[modal]');
-- 
2.47.3





      parent reply	other threads:[~2026-09-23 11:38 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-23 11:35 [PATCH manager 0/3] ui: prompt users for reload when web ui version changes Dominik Csapak
2026-09-23 11:35 ` [PATCH manager 1/3] api: factor out read_pwt_version and pwt_base_dir Dominik Csapak
2026-09-23 11:35 ` [PATCH manager 2/3] api: provide GUI versions via index and /cluster/resources Dominik Csapak
2026-09-23 11:35 ` Dominik Csapak [this message]

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=20260923113757.2202858-4-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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal