* [PATCH pve-manager v3 0/3] ui: prompt users for reload when web ui version changes
@ 2026-11-19 17:09 Dominik Csapak
2026-11-19 17:09 ` [PATCH pve-manager v3 1/3] api: factor out read_pwt_version and pwt_base_dir Dominik Csapak
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: Dominik Csapak @ 2026-11-19 17:09 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 /cluster/resources api call for the node that
the browser is connected to. The ui can then compare these and prompt
the user to reload.
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 GUI versions via index and /cluster/resources
ui: workspace: prompt user for reload when UI packages were updated
PVE/API2/Cluster.pm | 31 ++++++++++++++++++
PVE/API2Tools.pm | 27 ++++++++++++++++
PVE/Service/pveproxy.pm | 6 ++--
www/index.html.tpl | 6 +++-
www/manager6/Workspace.js | 67 +++++++++++++++++++++++++++++++++++++++
5 files changed, 133 insertions(+), 4 deletions(-)
--
2.47.3
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH pve-manager v3 1/3] api: factor out read_pwt_version and pwt_base_dir
2026-11-19 17:09 [PATCH pve-manager v3 0/3] ui: prompt users for reload when web ui version changes Dominik Csapak
@ 2026-11-19 17:09 ` Dominik Csapak
2026-11-19 17:09 ` [PATCH pve-manager v3 2/3] api: provide GUI versions via index and /cluster/resources Dominik Csapak
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Dominik Csapak @ 2026-11-19 17:09 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] 5+ messages in thread
* [PATCH pve-manager v3 2/3] api: provide GUI versions via index and /cluster/resources
2026-11-19 17:09 [PATCH pve-manager v3 0/3] ui: prompt users for reload when web ui version changes Dominik Csapak
2026-11-19 17:09 ` [PATCH pve-manager v3 1/3] api: factor out read_pwt_version and pwt_base_dir Dominik Csapak
@ 2026-11-19 17:09 ` Dominik Csapak
2026-11-19 17:09 ` [PATCH pve-manager v3 3/3] ui: workspace: prompt user for reload when UI packages were updated Dominik Csapak
2026-11-19 22:21 ` [PATCH pve-manager v3 0/3] ui: prompt users for reload when web ui version changes Thomas Lamprecht
3 siblings, 0 replies; 5+ messages in thread
From: Dominik Csapak @ 2026-11-19 17:09 UTC (permalink / raw)
To: pve-devel
Index has these versions anyway, just expose them to the UI via the
usual `Proxmox` object.
In the /cluster/resources API call, we add that information to the node
that is handling the request (which is normally the same where the index
was loaded from).
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.
With this information, the UI can detect an outdated UI version still
running.
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
PVE/API2/Cluster.pm | 31 +++++++++++++++++++++++++++++++
PVE/API2Tools.pm | 19 ++++++++++++++++---
www/index.html.tpl | 6 +++++-
3 files changed, 52 insertions(+), 4 deletions(-)
diff --git a/PVE/API2/Cluster.pm b/PVE/API2/Cluster.pm
index aaec3ec3..114ba033 100644
--- a/PVE/API2/Cluster.pm
+++ b/PVE/API2/Cluster.pm
@@ -21,6 +21,7 @@ use PVE::RPCEnvironment;
use PVE::SafeSyslog;
use PVE::Storage;
use PVE::Tools qw(extract_param);
+use PVE::pvecfg;
use PVE::API2::ACMEAccount;
use PVE::API2::ACMEPlugin;
@@ -504,6 +505,25 @@ __PACKAGE__->register_method({
default => 'x86_64',
optional => 1,
},
+ 'versions' => {
+ description => "Optional package versions (for type 'node').",
+ type => 'object',
+ optional => 1,
+ properties => {
+ 'pve-manager' => {
+ type => "string",
+ optional => 1,
+ description =>
+ "The pve-manager version of this node. Only included for the node handling the request.",
+ },
+ 'proxmox-widget-toolkit' => {
+ type => "string",
+ optional => 1,
+ description =>
+ "The proxmox-widget-toolkit version of this node. Only included for the node handling the request.",
+ },
+ },
+ },
},
},
},
@@ -619,6 +639,8 @@ __PACKAGE__->register_method({
my $static_node_info = PVE::Cluster::get_node_kv("static-info");
if (!$param->{type} || $param->{type} eq 'node') {
+ my $nodename = PVE::INotify::nodename();
+
foreach my $node (@$nodelist) {
my $can_audit = $rpcenv->check($authuser, "/nodes/$node", ['Sys.Audit'], 1);
my $entry =
@@ -635,6 +657,15 @@ __PACKAGE__->register_method({
$entry->{'hastate'} = $status;
}
+ if ($node eq $nodename) {
+ my $pwt_version = PVE::API2Tools::read_pwt_version();
+
+ $entry->{versions} = { 'pve-manager' => PVE::pvecfg::version() };
+ # an empty version means reading failed, omit it to avoid false positives
+ $entry->{versions}->{'proxmox-widget-toolkit'} = $pwt_version
+ if $pwt_version ne '';
+ }
+
push @$res, $entry;
}
}
diff --git a/PVE/API2Tools.pm b/PVE/API2Tools.pm
index c53ec03f..ad769f12 100644
--- a/PVE/API2Tools.pm
+++ b/PVE/API2Tools.pm
@@ -280,10 +280,23 @@ 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};
}
1;
diff --git a/www/index.html.tpl b/www/index.html.tpl
index 125c1046..21345822 100644
--- a/www/index.html.tpl
+++ b/www/index.html.tpl
@@ -48,7 +48,11 @@
NodeArch: '[% arch %]',
UserName: '[% username %]',
CSRFPreventionToken: '[% token %]',
- ConsentText: '[% consenttext.squote %]'
+ ConsentText: '[% consenttext.squote %]',
+ GUIVersions: {
+ 'pve-manager': '[% version %]',
+ 'proxmox-widget-toolkit': '[% wtversion %]',
+ },
};
</script>
<script type="text/javascript" src="/proxmoxlib.js?ver=[% wtversion %]"></script>
--
2.47.3
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH pve-manager v3 3/3] ui: workspace: prompt user for reload when UI packages were updated
2026-11-19 17:09 [PATCH pve-manager v3 0/3] ui: prompt users for reload when web ui version changes Dominik Csapak
2026-11-19 17:09 ` [PATCH pve-manager v3 1/3] api: factor out read_pwt_version and pwt_base_dir Dominik Csapak
2026-11-19 17:09 ` [PATCH pve-manager v3 2/3] api: provide GUI versions via index and /cluster/resources Dominik Csapak
@ 2026-11-19 17:09 ` Dominik Csapak
2026-11-19 22:21 ` [PATCH pve-manager v3 0/3] ui: prompt users for reload when web ui version changes Thomas Lamprecht
3 siblings, 0 replies; 5+ messages in thread
From: Dominik Csapak @ 2026-11-19 17:09 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 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 <d.csapak@proxmox.com>
---
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
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH pve-manager v3 0/3] ui: prompt users for reload when web ui version changes
2026-11-19 17:09 [PATCH pve-manager v3 0/3] ui: prompt users for reload when web ui version changes Dominik Csapak
` (2 preceding siblings ...)
2026-11-19 17:09 ` [PATCH pve-manager v3 3/3] ui: workspace: prompt user for reload when UI packages were updated Dominik Csapak
@ 2026-11-19 22:21 ` Thomas Lamprecht
3 siblings, 0 replies; 5+ messages in thread
From: Thomas Lamprecht @ 2026-11-19 22:21 UTC (permalink / raw)
To: Dominik Csapak, pve-devel
Am 19.11.26 um 18:12 schrieb Dominik Csapak:
> 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 /cluster/resources api call for the node that
> the browser is connected to. The ui can then compare these and prompt
> the user to reload.
thanks, can be nice to have, a few points on the design:
1. Popping up a modal dialog for this is a bit bold ;-) and with
`closable: false` on top it's a good way to drive people up the wall.
Imagine you're setting up a backup job with a complex selection, and then
the UI throws a dialog at you that you can't just close and that pushes
you towards a reload, which would throw all that state away. An outdated
UI is rarely that urgent. FWIW, where I needed something like this
elsewhere, I went with a non-modal snack bar only, similar to Home
Assistant, because a UI that forces me to reload (and lose my state) is
one of the things that rather annoy me.
2. After "Later", the sentence plus button in the top bar push the user menu
off screen in a 1280 px wide window, even more so with longer
translations.
3. Instead of the dialog and that hint, I'd rather show a small notice right
after the version string: an info icon, a short "New version" label and
a compact "Reload UI" button, with a tooltip on both like "A new version
of the web interface was installed. Reload the page to use it." That
also fits at 1280 px with longer translations.
4. I'd keep this out of /cluster/resources. It's polled every few seconds
and used by many other clients, the new property is only set for one
node, and it adds a column to `pvesh get /cluster/resources`. The ticket
call is not a good fit either, it lives in pve-access-control and every
API client logging in would get this.
GET /nodes/{node}/version seems like the right place: it already returns
the pve-manager version, every user may call it, and it's proxied to the
given node, so the answer always comes from the node the page was loaded
from, even behind a load balancer. The UI can check it every few
minutes, a short delay after an upgrade is fine. Please ignore errors
there though, the check will hit the pveproxy restart during the upgrade
and would otherwise pop up an error dialog.
Smaller ones/nits: I'd rename GUIVersions to UIVersion and make it a single
string, built by one helper from the pve-manager and widget toolkit versions
and used for both the index and an optional `ui-version` property of the
version call. The UI only needs to know whether anything changed, and
sharing the helper rules out format mismatches.
Patch 1/3 is fine as is. I tried a few notice variants in a mock setup and
can send you screenshots if that helps.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2026-11-19 22:21 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-19 17:09 [PATCH pve-manager v3 0/3] ui: prompt users for reload when web ui version changes Dominik Csapak
2026-11-19 17:09 ` [PATCH pve-manager v3 1/3] api: factor out read_pwt_version and pwt_base_dir Dominik Csapak
2026-11-19 17:09 ` [PATCH pve-manager v3 2/3] api: provide GUI versions via index and /cluster/resources Dominik Csapak
2026-11-19 17:09 ` [PATCH pve-manager v3 3/3] ui: workspace: prompt user for reload when UI packages were updated Dominik Csapak
2026-11-19 22:21 ` [PATCH pve-manager v3 0/3] ui: prompt users for reload when web ui version changes Thomas Lamprecht
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox