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 5912F1FF13A for ; Wed, 22 Jul 2026 12:27:31 +0200 (CEST) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id 269C8214B8; Wed, 22 Jul 2026 12:27:31 +0200 (CEST) Mime-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=UTF-8 Date: Wed, 22 Jul 2026 12:27:26 +0200 Message-Id: Subject: Re: [PATCH manager v2 1/2] fix #5475: configurable window title From: "Elias Huhsovitz" To: "Thomas Ellmenreich" , X-Mailer: aerc 0.20.0 References: <20260720100329.118508-1-t.ellmenreich@proxmox.com> <20260720100329.118508-2-t.ellmenreich@proxmox.com> In-Reply-To: <20260720100329.118508-2-t.ellmenreich@proxmox.com> X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1784716019028 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.191 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) RCVD_IN_DNSWL_LOW -0.7 Sender listed at https://www.dnswl.org/, low 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: HGUCWJQKGGDBCHH5ONTH4UHSDO2PMQBT X-Message-ID-Hash: HGUCWJQKGGDBCHH5ONTH4UHSDO2PMQBT X-MailFrom: e.huhsovitz@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: On Mon Jul 20, 2026 at 12:03 PM CEST, Thomas Ellmenreich wrote: > Allow setting of the new 'ui-settings' format string and the nested > 'title' property. Setting this property defines the window titles > for all cluster nodes. > > Signed-off-by: Thomas Ellmenreich TL;DR:=20 - missing argument for PVE::Tools::get_fqdn($nodename) - missing defined checks pveproxy.pm - confusing option names I tested the patch on a pve cluster consisting of 2 nodes. 1. The setting names render including the $ symbol, e.g. ($nodename, $fqdn)= in the WebUI.=20 This makes it seem broken from an end user point of view.=20 You generally do not expect placeholder values in settings menu. 2. I encountered a bug regarding the fdqn setting (see comment below) 3. I recommend adding some general robustness in case of undef values: Initialize $window_title to a safe value not relying on the cluster, in case of an error. Expect that the underlying API/calls might return undef. see commnets below: > --- > PVE/Service/pveproxy.pm | 21 ++++++++++++ > www/index.html.tpl | 2 +- > www/manager6/UIOptions.js | 6 ++++ > www/manager6/dc/OptionView.js | 61 +++++++++++++++++++++++++++++++++++ > 4 files changed, 89 insertions(+), 1 deletion(-) > > diff --git a/PVE/Service/pveproxy.pm b/PVE/Service/pveproxy.pm > index c6011a00..811295f4 100755 > --- a/PVE/Service/pveproxy.pm > +++ b/PVE/Service/pveproxy.pm > @@ -202,6 +202,24 @@ my sub get_path_mtime { > return $mtime; > } > =20 > +# builds the window title from the datacenter.cfg configuration > +my $get_window_title =3D sub { > + my ($title_enum, $nodename) =3D @_; > + > + my $title =3D "$nodename"; > + > + if ($title_enum eq "node-and-cluster") { > + my $clinfo =3D PVE::Cluster::get_clinfo(); > + my $clustername =3D $clinfo->{cluster}->{name}; ^^^^ This returned undef once when i was messing with the cluster settings, when= i reloaded the web page using CTL + F5 on firefox. This resulted in my window title to default to the link address of the web page. I suspect this is because the error is surpressed somewhere, probably by the eval block below. The correct formatting appeared when i accessed the WebUI in a new brower tab. Initializing the window title using a safe default in case of an error, might be an option. > + > + $title =3D "$nodename - $clustername"; > + } elsif ($title_enum eq "fqdn") { > + $title =3D PVE::Tools::get_fqdn(); ^^^^^ PVE:Tools::get_fqdn requires a parameter. The first line of the function (on my test machine is): my ($nodename) =3D @_; This resulted in an error (captured by journalctl -u pveproxy -f): Use of uninitialized value $lang in concatenation (.) or string at /usr/sha= re/perl5/PVE/Service/pveproxy.pm line 273. pve-3 pveproxy[27666]: getaddrinfo: Name or service not known at /usr/share= /perl5/PVE/Tools.pm line 915. I belive the fix is: $title =3D PVE::Tools::get_fqdn($nodename); Also: a misconfigured /etc/hosts file might result in the function returning undef --> some type of error handling is needed. > + } > + > + return $title . " - Proxmox Virtual Environment"; > +}; > + > # NOTE: Requests to those pages are not authenticated so we must be very= careful here > sub get_index { > my ($nodename, $server, $r, $args) =3D @_; > @@ -232,10 +250,12 @@ sub get_index { > } > } > =20 > + my $window_title; > my $consent_text; > eval { > my $dc_conf =3D PVE::Cluster::cfs_read_file('datacenter.cfg'); > $consent_text =3D $dc_conf->{'consent-text'}; > + $window_title =3D $get_window_title->($dc_conf->{'ui-settings'}-= >{'title'}, $nodename); > =20 > if (!$lang) { > $lang =3D $dc_conf->{language} // 'en'; > @@ -276,6 +296,7 @@ sub get_index { > token =3D> $token, > console =3D> $args->{console}, > nodename =3D> $nodename, > + window_title =3D> $window_title, > debug =3D> $debug, > version =3D> "$version", > wtversion =3D> $wtversion, > diff --git a/www/index.html.tpl b/www/index.html.tpl > index 74ee02d9..5138b7cc 100644 > --- a/www/index.html.tpl > +++ b/www/index.html.tpl > @@ -4,7 +4,7 @@ > > > > - [% nodename %] - Proxmox Virtual Environment > + [% window_title %] > > > > diff --git a/www/manager6/UIOptions.js b/www/manager6/UIOptions.js > index 8c4674af..bb0af8d5 100644 > --- a/www/manager6/UIOptions.js > +++ b/www/manager6/UIOptions.js > @@ -90,6 +90,12 @@ Ext.define('PVE.UIOptions', { > alphabetical: gettext('Alphabetical'), > }, > =20 > + titleOptions: { > + __default__: '$nodename - Proxmox Virtual Environment', > + 'node-and-cluster': '$nodename - $clustername - Proxmox Virtual = Environment', > + fqdn: '$fqdn - Proxmox Virtual Environment', > + }, > + > shouldSortTags: function () { > return !(PVE.UIOptions.options['tag-style']?.ordering =3D=3D=3D = 'config'); > }, > diff --git a/www/manager6/dc/OptionView.js b/www/manager6/dc/OptionView.j= s > index dc12aa7e..208cc147 100644 > --- a/www/manager6/dc/OptionView.js > +++ b/www/manager6/dc/OptionView.js > @@ -91,6 +91,67 @@ Ext.define('PVE.dc.OptionView', { > defaultValue: '__default__', > deleteEmpty: true, > }); > + me.rows['ui-settings'] =3D { > + required: true, > + renderer: (value) =3D> { > + if (value =3D=3D=3D undefined) { > + return gettext('No Overrides'); > + } > + let txt =3D ''; > + if (value.title) { > + txt +=3D Ext.String.format(gettext('Title: {0}'), va= lue.title); > + } > + return txt; > + }, > + header: gettext('Ui Settings'), > + editor: { > + xtype: 'proxmoxWindowEdit', > + width: 800, > + subject: gettext('Ui Settings'), > + fieldDefaults: { > + labelWidth: 100, > + }, > + url: '/api2/extjs/cluster/options', > + items: [ > + { > + xtype: 'inputpanel', > + setValues: function (values) { > + if (values =3D=3D=3D undefined) { > + return undefined; > + } > + values =3D values?.['ui-settings'] ?? {}; > + values.title =3D values.title || '__default_= _'; > + return Proxmox.panel.InputPanel.prototype.se= tValues.call(this, values); > + }, > + onGetValues: function (values) { > + let style =3D {}; > + if (values.title) { > + style.title =3D values.title; > + } > + let value =3D PVE.Parser.printPropertyString= (style); > + if (value =3D=3D=3D '') { > + return { > + delete: 'ui-settings', > + }; > + } > + return { > + 'ui-settings': value, > + }; > + }, > + items: [ > + { > + xtype: 'proxmoxKVComboBox', > + name: 'title', > + fieldLabel: gettext('Title'), > + comboItems: Object.entries(PVE.UIOptions= .titleOptions), > + deleteEmpty: true, > + defaultValue: '__default__', > + }, > + ], > + }, > + ], > + }, > + }; > me.add_text_row('email_from', gettext('Email from address'), { > deleteEmpty: true, > vtype: 'proxmoxMail',