* [PATCH pve-manager v2 0/3] ui: prompt users for reload when web ui version changes
@ 2026-11-19 15:38 Dominik Csapak
2026-11-19 15:38 ` [PATCH pve-manager v2 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 15:38 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 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 | 26 +++++++++++++++
PVE/Service/pveproxy.pm | 6 ++--
www/index.html.tpl | 6 +++-
www/manager6/Workspace.js | 67 +++++++++++++++++++++++++++++++++++++++
5 files changed, 132 insertions(+), 4 deletions(-)
--
2.47.3
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH pve-manager v2 1/3] api: factor out read_pwt_version and pwt_base_dir
2026-11-19 15:38 [PATCH pve-manager v2 0/3] ui: prompt users for reload when web ui version changes Dominik Csapak
@ 2026-11-19 15:38 ` Dominik Csapak
2026-11-19 15:38 ` [PATCH pve-manager v2 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 15:38 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 | 12 ++++++++++++
PVE/Service/pveproxy.pm | 6 +++---
2 files changed, 15 insertions(+), 3 deletions(-)
diff --git a/PVE/API2Tools.pm b/PVE/API2Tools.pm
index bca21aa5..f137b172 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,15 @@ sub get_resource_pool_guest_members {
return $pool_members;
}
+sub pwt_base_dir {
+ return '/usr/share/javascript/proxmox-widget-toolkit';
+}
+
+sub read_pwt_version {
+ my $base_dir = pwt_base_dir();
+ my $wtversionraw = PVE::File::file_read_first_line("$base_dir/proxmoxlib.js") // '';
+ 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 v2 2/3] api: provide GUI versions via index and /cluster/resources
2026-11-19 15:38 [PATCH pve-manager v2 0/3] ui: prompt users for reload when web ui version changes Dominik Csapak
2026-11-19 15:38 ` [PATCH pve-manager v2 1/3] api: factor out read_pwt_version and pwt_base_dir Dominik Csapak
@ 2026-11-19 15:38 ` Dominik Csapak
2026-11-19 15:38 ` [PATCH pve-manager v2 3/3] ui: workspace: prompt user for reload when UI packages were updated Dominik Csapak
2026-11-19 17:13 ` superseded: [PATCH pve-manager v2 0/3] ui: prompt users for reload when web ui version changes Dominik Csapak
3 siblings, 0 replies; 5+ messages in thread
From: Dominik Csapak @ 2026-11-19 15:38 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 60 seconds, so we don't hit the file
read on every call, but force it for every index call (like we did
before).
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 | 22 ++++++++++++++++++----
PVE/Service/pveproxy.pm | 2 +-
www/index.html.tpl | 6 +++++-
4 files changed, 55 insertions(+), 6 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 f137b172..1bbfeafa 100644
--- a/PVE/API2Tools.pm
+++ b/PVE/API2Tools.pm
@@ -277,11 +277,25 @@ sub pwt_base_dir {
return '/usr/share/javascript/proxmox-widget-toolkit';
}
+my $pwt_version_cache = {};
+
sub read_pwt_version {
- my $base_dir = pwt_base_dir();
- my $wtversionraw = PVE::File::file_read_first_line("$base_dir/proxmoxlib.js") // '';
- my $wtversion = $wtversionraw =~ m|^// (.*)$| ? $1 : '';
- return $wtversion;
+ my ($force) = @_;
+
+ my $time = time();
+ if (
+ $force
+ || !defined($pwt_version_cache->{version})
+ || $pwt_version_cache->{time} + 60 < $time
+ ) {
+ my $base_dir = pwt_base_dir();
+ my $wtversionraw = PVE::File::file_read_first_line("$base_dir/proxmoxlib.js") // '';
+ my $wtversion = $wtversionraw =~ m|^// (.*)$| ? $1 : '';
+ $pwt_version_cache->{version} = $wtversion;
+ $pwt_version_cache->{time} = $time;
+ }
+
+ return $pwt_version_cache->{version};
}
1;
diff --git a/PVE/Service/pveproxy.pm b/PVE/Service/pveproxy.pm
index dc97f815..ed047d27 100755
--- a/PVE/Service/pveproxy.pm
+++ b/PVE/Service/pveproxy.pm
@@ -262,7 +262,7 @@ sub get_index {
my $version = PVE::pvecfg::version();
- my $wtversion = PVE::API2Tools::read_pwt_version();
+ my $wtversion = PVE::API2Tools::read_pwt_version(1); # force read
# 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
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 v2 3/3] ui: workspace: prompt user for reload when UI packages were updated
2026-11-19 15:38 [PATCH pve-manager v2 0/3] ui: prompt users for reload when web ui version changes Dominik Csapak
2026-11-19 15:38 ` [PATCH pve-manager v2 1/3] api: factor out read_pwt_version and pwt_base_dir Dominik Csapak
2026-11-19 15:38 ` [PATCH pve-manager v2 2/3] api: provide GUI versions via index and /cluster/resources Dominik Csapak
@ 2026-11-19 15:38 ` Dominik Csapak
2026-11-19 17:13 ` superseded: [PATCH pve-manager v2 0/3] ui: prompt users for reload when web ui version changes Dominik Csapak
3 siblings, 0 replies; 5+ messages in thread
From: Dominik Csapak @ 2026-11-19 15:38 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
* superseded: [PATCH pve-manager v2 0/3] ui: prompt users for reload when web ui version changes
2026-11-19 15:38 [PATCH pve-manager v2 0/3] ui: prompt users for reload when web ui version changes Dominik Csapak
` (2 preceding siblings ...)
2026-11-19 15:38 ` [PATCH pve-manager v2 3/3] ui: workspace: prompt user for reload when UI packages were updated Dominik Csapak
@ 2026-11-19 17:13 ` Dominik Csapak
3 siblings, 0 replies; 5+ messages in thread
From: Dominik Csapak @ 2026-11-19 17:13 UTC (permalink / raw)
To: pve-devel
superseded by v3:
https://lore.proxmox.com/pve-devel/20261119171151.475428-1-d.csapak@proxmox.com/T/#t
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2026-11-19 17:13 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-19 15:38 [PATCH pve-manager v2 0/3] ui: prompt users for reload when web ui version changes Dominik Csapak
2026-11-19 15:38 ` [PATCH pve-manager v2 1/3] api: factor out read_pwt_version and pwt_base_dir Dominik Csapak
2026-11-19 15:38 ` [PATCH pve-manager v2 2/3] api: provide GUI versions via index and /cluster/resources Dominik Csapak
2026-11-19 15:38 ` [PATCH pve-manager v2 3/3] ui: workspace: prompt user for reload when UI packages were updated Dominik Csapak
2026-11-19 17:13 ` superseded: [PATCH pve-manager v2 0/3] ui: prompt users for reload when web ui version changes Dominik Csapak
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox