* [PATCH pve-manager v4 0/3] ui: prompt users for reload when web ui version changes
@ 2026-11-20 9:46 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
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Dominik Csapak @ 2026-11-20 9:46 UTC (permalink / raw)
To: pve-devel
On some updates (like recently with ceph), the UI has new or better
information about backend states, but the user must reload the page to
get the new version, which might not be obvious.
To help users detect such outdated running UI versions, send the current
one in the index and /nodes/{node}/version api call. The ui can then
compare these and prompt the user to reload.
changes from v3 (thanks very much @Thomas):
* rebase on master
* expose a single 'ui-version' string instead of per-package versions
* provide it via /nodes/{node}/version instead of /cluster/resources
* generate it with a shared helper for index and API, including the repoid
* ui: poll the version every 2 minutes instead of on resource store load
* ui: drop the message box, show a short notice with tooltip in the top bar
* use 'UI' instead of 'GUI' in names and commit subjects
changes from v2:
* always use mtime to check if we should read the file again, this
is cheap enough and more accurate
i measured a stat call on the file with a simple loop of 1000000
calls, and it came out to ~3.5s on my machine, this would make
one stat call cost abou 3us which is fine IMO.
(though my benchmark methodology is probably a bit flawed...)
changes from v1:
* move the caching of the pwt version from the /cluster/resources API
call into read_pwt_version, so all callers share it
* add a 'force' parameter to read_pwt_version and use it for the index,
so that the index always gets the current version, like before
* don't focus any button by default in the reload message box, so an
accidental key press neither reloads nor dismisses it
* mention in the commit message that the prompt can lag behind one poll
cycle
* sort the 'use PVE::File' statement correctly
Dominik Csapak (3):
api: factor out read_pwt_version and pwt_base_dir
api: provide UI versions via index and /nodes/{node}/version
ui: workspace: show reload notice when UI packages were updated
PVE/API2/Nodes.pm | 14 ++++++-
PVE/API2Tools.pm | 38 ++++++++++++++++++
PVE/Service/pveproxy.pm | 9 +++--
www/index.html.tpl | 3 +-
www/manager6/Workspace.js | 82 +++++++++++++++++++++++++++++++++------
5 files changed, 130 insertions(+), 16 deletions(-)
--
2.47.3
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH pve-manager v4 1/3] api: factor out read_pwt_version and pwt_base_dir
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 ` 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 ` [PATCH pve-manager v4 3/3] ui: workspace: show reload notice when UI packages were updated Dominik Csapak
2 siblings, 0 replies; 4+ messages in thread
From: Dominik Csapak @ 2026-11-20 9:46 UTC (permalink / raw)
To: pve-devel
Getting the pwt version will be useful in other places later, so factor
it out into API2Tools.
While at it, change it to use 'PVE::File' and handle missing pwt file by
providing the default '' (to avoid a perl warning in that case).
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
PVE/API2Tools.pm | 14 ++++++++++++++
PVE/Service/pveproxy.pm | 6 +++---
2 files changed, 17 insertions(+), 3 deletions(-)
diff --git a/PVE/API2Tools.pm b/PVE/API2Tools.pm
index bca21aa5..c53ec03f 100644
--- a/PVE/API2Tools.pm
+++ b/PVE/API2Tools.pm
@@ -12,6 +12,7 @@ use URI;
use PVE::Cluster;
use PVE::DataCenterConfig; # so we can cfs-read datacenter.cfg
use PVE::Exception qw(raise_param_exc);
+use PVE::File;
use PVE::INotify;
use PVE::RPCEnvironment;
use PVE::SafeSyslog;
@@ -272,4 +273,17 @@ sub get_resource_pool_guest_members {
return $pool_members;
}
+my $PWT_BASE_DIR = '/usr/share/javascript/proxmox-widget-toolkit';
+my $PWT_FILE = "$PWT_BASE_DIR/proxmoxlib.js";
+
+sub pwt_base_dir {
+ return $PWT_BASE_DIR;
+}
+
+sub read_pwt_version {
+ my $wtversionraw = PVE::File::file_read_first_line($PWT_FILE) // '';
+ my $wtversion = $wtversionraw =~ m|^// (.*)$| ? $1 : '';
+ return $wtversion;
+}
+
1;
diff --git a/PVE/Service/pveproxy.pm b/PVE/Service/pveproxy.pm
index acd23416..dc97f815 100755
--- a/PVE/Service/pveproxy.pm
+++ b/PVE/Service/pveproxy.pm
@@ -11,6 +11,7 @@ use URI::QueryParam;
use URI;
use PVE::API2;
+use PVE::API2Tools;
use PVE::APIServer::AnyEvent;
use PVE::APIServer::Formatter::HTML;
use PVE::APIServer::Formatter::Standard;
@@ -56,7 +57,7 @@ my $basedirs = {
novnc => '/usr/share/novnc-pve',
yew_mobile => '/usr/share/pve-yew-mobile-gui',
i18n_yew => '/usr/share/pve-yew-mobile-i18n',
- widgettoolkit => '/usr/share/javascript/proxmox-widget-toolkit',
+ widgettoolkit => PVE::API2Tools::pwt_base_dir(),
xtermjs => '/usr/share/pve-xtermjs',
};
@@ -261,8 +262,7 @@ sub get_index {
my $version = PVE::pvecfg::version();
- my $wtversionraw = PVE::Tools::file_read_firstline("$basedirs->{widgettoolkit}/proxmoxlib.js");
- my $wtversion = $wtversionraw =~ m|^// (.*)$| ? $1 : '';
+ my $wtversion = PVE::API2Tools::read_pwt_version();
# while we could use the actual pkg version (e.g., shipped as pkg-version file in each
# respective package's /usr/share/<pkg> folder, this way it should also work when using make
--
2.47.3
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH pve-manager v4 2/3] api: provide UI versions via index and /nodes/{node}/version
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 ` Dominik Csapak
2026-11-20 9:46 ` [PATCH pve-manager v4 3/3] ui: workspace: show reload notice when UI packages were updated Dominik Csapak
2 siblings, 0 replies; 4+ messages in thread
From: Dominik Csapak @ 2026-11-20 9:46 UTC (permalink / raw)
To: pve-devel
Add a version string from the UI packages, so that the UI can easily
detect when the versions of the backend differ from the ones the page
was loaded with.
Generate the string via a shared `ui_version` helper that takes no
arguments, so that the index and API always produce the same string.
Cache the pwt versions locally for as long as the mtime does not change.
Stat'ing should be cached by the underlying filesystem and be very
cheap. This way we don't hit the file read on every call.
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
PVE/API2/Nodes.pm | 14 +++++++++++++-
PVE/API2Tools.pm | 30 +++++++++++++++++++++++++++---
PVE/Service/pveproxy.pm | 3 +++
www/index.html.tpl | 3 ++-
4 files changed, 45 insertions(+), 5 deletions(-)
diff --git a/PVE/API2/Nodes.pm b/PVE/API2/Nodes.pm
index b34d992c..ddbf7544 100644
--- a/PVE/API2/Nodes.pm
+++ b/PVE/API2/Nodes.pm
@@ -320,12 +320,24 @@ __PACKAGE__->register_method({
type => 'string',
description => 'The short git commit hash ID from which this version was build',
},
+ 'ui-version' => {
+ type => 'string',
+ optional => 1,
+ description =>
+ 'A string generated from UI package versions, to detect changes.',
+ },
},
},
code => sub {
my ($resp, $param) = @_;
- return PVE::pvecfg::version_info();
+ my $res = PVE::pvecfg::version_info();
+
+ if (my $ui_version = PVE::API2Tools::ui_version()) {
+ $res->{'ui-version'} = $ui_version;
+ }
+
+ return $res;
},
});
diff --git a/PVE/API2Tools.pm b/PVE/API2Tools.pm
index c53ec03f..dcd3dc36 100644
--- a/PVE/API2Tools.pm
+++ b/PVE/API2Tools.pm
@@ -18,6 +18,7 @@ use PVE::RPCEnvironment;
use PVE::SafeSyslog;
use PVE::Storage::Plugin;
use PVE::Tools;
+use PVE::pvecfg;
# each rrd key for a resource will only exist once. The key format might be different though. Therefore return on first hit
sub get_rrd_key {
@@ -280,10 +281,33 @@ sub pwt_base_dir {
return $PWT_BASE_DIR;
}
+my $pwt_version_cache = {};
+
sub read_pwt_version {
- my $wtversionraw = PVE::File::file_read_first_line($PWT_FILE) // '';
- my $wtversion = $wtversionraw =~ m|^// (.*)$| ? $1 : '';
- return $wtversion;
+ my $st = stat($PWT_FILE);
+ my $mtime = $st ? $st->mtime() : 0;
+
+ if (
+ !defined($pwt_version_cache->{version})
+ || $pwt_version_cache->{mtime} != $mtime
+ ) {
+ my $wtversionraw = PVE::File::file_read_first_line($PWT_FILE) // '';
+ my $wtversion = $wtversionraw =~ m|^// (.*)$| ? $1 : '';
+ $pwt_version_cache->{version} = $wtversion;
+ $pwt_version_cache->{mtime} = $mtime;
+ }
+
+ return $pwt_version_cache->{version};
+}
+
+# returns a combined pve-manager and proxmox-widget-toolkit version string
+# or undef if the pwt version was not readable or parseable
+sub ui_version {
+ my $manager_version = PVE::pvecfg::version_text();
+ my $pwt_version = read_pwt_version();
+ return undef if !$pwt_version;
+
+ return "$manager_version-$pwt_version";
}
1;
diff --git a/PVE/Service/pveproxy.pm b/PVE/Service/pveproxy.pm
index dc97f815..40c07ff6 100755
--- a/PVE/Service/pveproxy.pm
+++ b/PVE/Service/pveproxy.pm
@@ -264,6 +264,8 @@ sub get_index {
my $wtversion = PVE::API2Tools::read_pwt_version();
+ my $uiversion = PVE::API2Tools::ui_version();
+
# while we could use the actual pkg version (e.g., shipped as pkg-version file in each
# respective package's /usr/share/<pkg> folder, this way it should also work when using make
# install to directly install to local root filesystem.
@@ -287,6 +289,7 @@ sub get_index {
debug => $debug,
version => "$version",
wtversion => $wtversion,
+ uiversion => $uiversion,
theme => $theme,
consenttext => $consent_text,
i18n_js_mtime => $i18n_js_mtime,
diff --git a/www/index.html.tpl b/www/index.html.tpl
index 125c1046..466418ca 100644
--- a/www/index.html.tpl
+++ b/www/index.html.tpl
@@ -48,7 +48,8 @@
NodeArch: '[% arch %]',
UserName: '[% username %]',
CSRFPreventionToken: '[% token %]',
- ConsentText: '[% consenttext.squote %]'
+ ConsentText: '[% consenttext.squote %]',
+ UIVersion: '[% uiversion %]',
};
</script>
<script type="text/javascript" src="/proxmoxlib.js?ver=[% wtversion %]"></script>
--
2.47.3
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH pve-manager v4 3/3] ui: workspace: show reload notice when UI packages were updated
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
2 siblings, 0 replies; 4+ messages in thread
From: Dominik Csapak @ 2026-11-20 9:46 UTC (permalink / raw)
To: pve-devel
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
^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-11-20 9:53 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 ` [PATCH pve-manager v4 3/3] ui: workspace: show reload notice when UI packages were updated Dominik Csapak
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.