From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gate001.proxmox.com (gate001.proxmox.com [45.144.208.40]) by lore.proxmox.com (Postfix) with ESMTPS id 6621A1FF0DA for ; Thu, 19 Nov 2026 18:11:59 +0100 (CET) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id 86A0A216C5; Thu, 19 Nov 2026 18:11:57 +0100 (CET) From: Dominik Csapak To: pve-devel@lists.proxmox.com Subject: [PATCH pve-manager v3 3/3] ui: workspace: prompt user for reload when UI packages were updated Date: Thu, 19 Nov 2026 18:09:09 +0100 Message-ID: <20261119171151.475428-4-d.csapak@proxmox.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20261119171151.475428-1-d.csapak@proxmox.com> References: <20261119171151.475428-1-d.csapak@proxmox.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL 0.123 Adjusted score from AWL reputation of From: address DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment (newer systems) POISEN_SPAM_PILL 0.1 Meta: its spam POISEN_SPAM_PILL_1 0.1 random spam to be learned in bayes POISEN_SPAM_PILL_3 0.1 random spam to be learned in bayes RCVD_IN_DNSWL_MED -2.3 Sender listed at https://www.dnswl.org/, medium trust SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Message-ID-Hash: XFX2RTXLPSIRNZQ2ELXSIM4YYZSTNJLM X-Message-ID-Hash: XFX2RTXLPSIRNZQ2ELXSIM4YYZSTNJLM X-MailFrom: d.csapak@proxmox.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.10 Precedence: list List-Id: Proxmox VE development discussion List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: 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. Note that the prompt could lag behind one poll cycle, since the node cache gets cleared in 'beforeload' but can be filled in again by various parts of the UI before the load event (and thus the check) triggers. This is harmless though, since the next load will trigger the check with the updated version. 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 --- www/manager6/Workspace.js | 67 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) diff --git a/www/manager6/Workspace.js b/www/manager6/Workspace.js index 189d3373..3bf8a782 100644 --- a/www/manager6/Workspace.js +++ b/www/manager6/Workspace.js @@ -193,6 +193,56 @@ 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'), + }, + defaultFocus: 'invalid', // force the focus to be not any button + 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 +402,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 +611,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