public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Dominik Csapak <d.csapak@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [PATCH pve-manager v4 3/3] ui: workspace: show reload notice when UI packages were updated
Date: Fri, 20 Nov 2026 10:46:39 +0100	[thread overview]
Message-ID: <20261120095235.1143525-4-d.csapak@proxmox.com> (raw)
In-Reply-To: <20261120095235.1143525-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 one
reported from /nodes/{node}/version (which is now polled regularly) and
show the user a notice in the top bar to reload the UI.

Show a short "New version" label with a Reload UI button next to the
version string as soon as the change is detected. A tooltip on both says
that the new version is installed and the page needs a reload. The
notice fits the top bar at 1280 px also with longer translations, and
the info icon matches the EOL notice of earlier releases.

Re-purpose the `updateVersionInfo` method for this, since that handles
the version info already.

Co-developed-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
 www/manager6/Workspace.js | 82 +++++++++++++++++++++++++++++++++------
 1 file changed, 71 insertions(+), 11 deletions(-)

diff --git a/www/manager6/Workspace.js b/www/manager6/Workspace.js
index 189d3373..b1fe50da 100644
--- a/www/manager6/Workspace.js
+++ b/www/manager6/Workspace.js
@@ -163,13 +163,23 @@ Ext.define('PVE.StdWorkspace', {
         if (loginData) {
             PVE.data.ResourceStore.startUpdate();
 
-            Proxmox.Utils.API2Request({
-                url: '/version',
-                method: 'GET',
-                success: function (response) {
-                    PVE.VersionInfo = response.result.data;
-                    me.updateVersionInfo();
+            me.versionTask ??= Ext.TaskManager.start({
+                run: () => {
+                    if (!Proxmox.Utils.authOK()) {
+                        return;
+                    }
+                    Proxmox.Utils.API2Request({
+                        url: `/nodes/${Proxmox.NodeName}/version`,
+                        method: 'GET',
+                        success: function (response) {
+                            me.updateVersionInfo(response.result.data);
+                        },
+                        failure: () => {
+                            // Ignore errors
+                        },
+                    });
                 },
+                interval: 2 * 60 * 1000,
             });
 
             PVE.UIOptions.update();
@@ -200,18 +210,36 @@ Ext.define('PVE.StdWorkspace', {
         ui.updateLayout();
     },
 
-    updateVersionInfo: function () {
+    updateVersionInfo: function (versionInfo) {
         let me = this;
 
         let ui = me.query('#versioninfo')[0];
 
-        if (PVE.VersionInfo) {
-            let version = PVE.VersionInfo.version;
-            ui.update('Virtual Environment ' + version);
-        } else {
+        if (!PVE.VersionInfo && !versionInfo) {
             ui.update('Virtual Environment');
+            ui.updateLayout();
+            return;
         }
+
+        // only update the visible version once
+        PVE.VersionInfo ??= versionInfo;
+
+        ui.update('Virtual Environment ' + PVE.VersionInfo.version);
         ui.updateLayout();
+
+        // compare the versions the backend reports with the ones this page was loaded with
+        if (!versionInfo?.['ui-version']) {
+            return;
+        }
+
+        let notice = me.down('#uiUpdateNotice');
+        if (notice.isVisible()) {
+            return;
+        }
+
+        if (Proxmox.UIVersion !== versionInfo['ui-version']) {
+            notice.setVisible(true);
+        }
     },
 
     initComponent: function () {
@@ -274,6 +302,10 @@ Ext.define('PVE.StdWorkspace', {
 
         let caps = appState.get('GuiCap');
 
+        let uiUpdateTip = gettext(
+            'A new version of the web interface was installed. Reload the page to use it.',
+        );
+
         let createVM = Ext.createWidget('button', {
             pack: 'end',
             margin: '3 5 0 0',
@@ -352,6 +384,34 @@ Ext.define('PVE.StdWorkspace', {
                                 'line-height': '20px',
                             },
                         },
+                        {
+                            xtype: 'container',
+                            itemId: 'uiUpdateNotice',
+                            hidden: true,
+                            layout: {
+                                type: 'hbox',
+                                align: 'middle',
+                            },
+                            margin: '0 5',
+                            items: [
+                                {
+                                    xtype: 'component',
+                                    autoEl: {
+                                        tag: 'div',
+                                        'data-qtip': uiUpdateTip,
+                                    },
+                                    html: `<i class="fa fa-info-circle info-blue"></i> ${gettext('New version')}`,
+                                    margin: '0 5 0 0',
+                                },
+                                {
+                                    xtype: 'button',
+                                    cls: 'x-btn-default-toolbar-small proxmox-inline-button',
+                                    text: gettext('Reload UI'),
+                                    tooltip: uiUpdateTip,
+                                    handler: () => window.location.reload(),
+                                },
+                            ],
+                        },
                         {
                             flex: 2,
                         },
-- 
2.47.3





      parent reply	other threads:[~2026-11-20  9:52 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-20  9:46 [PATCH pve-manager v4 0/3] ui: prompt users for reload when web ui version changes Dominik Csapak
2026-11-20  9:46 ` [PATCH pve-manager v4 1/3] api: factor out read_pwt_version and pwt_base_dir Dominik Csapak
2026-11-20  9:46 ` [PATCH pve-manager v4 2/3] api: provide UI versions via index and /nodes/{node}/version Dominik Csapak
2026-11-20  9:46 ` 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=20261120095235.1143525-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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal