From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gate001.proxmox.com (gate001.proxmox.com [IPv6:2a0f:8001:1:32::40]) by lore.proxmox.com (Postfix) with ESMTPS id DEEC31FF0A7 for ; Wed, 16 Sep 2026 16:51:13 +0200 (CEST) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id 364C3215B6; Wed, 16 Sep 2026 16:51:12 +0200 (CEST) Date: Wed, 16 Sep 2026 16:51:05 +0200 From: Arthur Bied-Charreton To: Thomas Ellmenreich Subject: Re: [PATCH manager v4 1/2] fix #5475: configurable window title Message-ID: References: <20260914062202.27182-1-t.ellmenreich@proxmox.com> <20260914062202.27182-2-t.ellmenreich@proxmox.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20260914062202.27182-2-t.ellmenreich@proxmox.com> X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1789570267045 X-SPAM-LEVEL: Spam detection results: 0 AWL 1.494 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_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: WU2QGYIH7RJX2D2LJMAB4JH5C7U7UUYS X-Message-ID-Hash: WU2QGYIH7RJX2D2LJMAB4JH5C7U7UUYS X-MailFrom: a.bied-charreton@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 CC: pve-devel@lists.proxmox.com X-Mailman-Version: 3.3.10 Precedence: list List-Id: Proxmox VE development discussion List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: thanks for the patch! I made a few comments inline, I also noticed that setting the window title to node-and-cluster fails silently on standalone nodes, which took me a bit to realize. not sure if rejecting it for standalone nodes at the API layer makes sense since the setting becomes meaningful once a cluster is created, but maybe a hint in the dialog would be enough? On Mon, Sep 14, 2026 at 08:22:01AM +0200, Thomas Ellmenreich wrote: > Added a new 'ui-settings' format string to the datacenter.cfg which now > has a 'title' option to configure the browser tab title for pve tabs. > > Adjusted the index.html templating to construct the correct window title > on every request according to the cluster configuration. > > Signed-off-by: Thomas Ellmenreich > --- > PVE/Service/pveproxy.pm | 27 ++++++++++++++++ > www/index.html.tpl | 2 +- > www/manager6/UIOptions.js | 6 ++++ > www/manager6/dc/OptionView.js | 61 +++++++++++++++++++++++++++++++++++ > 4 files changed, 95 insertions(+), 1 deletion(-) > > diff --git a/PVE/Service/pveproxy.pm b/PVE/Service/pveproxy.pm > index dfdd014c..d0ebdb71 100755 > --- a/PVE/Service/pveproxy.pm > +++ b/PVE/Service/pveproxy.pm > @@ -202,6 +202,30 @@ my sub get_path_mtime { > return $mtime; > } > > +# builds the window title from the datacenter.cfg configuration > +my $get_window_title = sub { nit: `my sub foo` seems to be preferred over `my $foo = sub` in this file. > + my ($title_enum, $nodename) = @_; > + > + my $title; > + > + if (defined $title_enum) { > + eval { > + if ($title_enum eq "node-and-cluster") { > + my $clinfo = PVE::Cluster::get_clinfo(); > + my $clustername = $clinfo->{cluster}->{name}; > + > + $title = "$nodename - $clustername" if $clustername; > + } elsif ($title_enum eq "fqdn") { > + $title = PVE::Tools::get_fqdn($nodename); haven't looked too deeply into it, but afaict on a standard setup this resolves the FQDN from /etc/hosts. still, this lookup is now reachable from an unauthenticated path, could that be problematic in some setups? not sure how likely a DNS stall is here, just wanted to mention it. > + } > + }; > + > + warn "failed to create '$title_enum' window title: $@" if $@; > + } > + > + return ($title // "$nodename") . " - 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) = @_; > @@ -232,10 +256,12 @@ sub get_index { > } > } > > + my $window_title; currently if anything dies in the eval block before $get_window_title is called, $window_title stays undef. you coudl read only the title setting inside the eval and call $get_window_title after the block, since it cannot die anyway. > my $consent_text; > eval { > my $dc_conf = PVE::Cluster::cfs_read_file('datacenter.cfg'); > $consent_text = $dc_conf->{'consent-text'}; > + $window_title = $get_window_title->($dc_conf->{'ui-settings'}->{'title'}, $nodename); > > if (!$lang) { > $lang = $dc_conf->{language} // 'en'; > @@ -277,6 +303,7 @@ sub get_index { > console => $args->{console}, > nodename => $nodename, > arch => PVE::Tools::get_host_dpkg_arch(), > + window_title => $window_title, > debug => $debug, > version => "$version", > wtversion => $wtversion, > diff --git a/www/index.html.tpl b/www/index.html.tpl > index c18e6411..a45bad39 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..49307fa4 100644 > --- a/www/manager6/UIOptions.js > +++ b/www/manager6/UIOptions.js > @@ -90,6 +90,12 @@ Ext.define('PVE.UIOptions', { > alphabetical: gettext('Alphabetical'), > }, > > + titleOptions: { > + __default__: 'Node Name (Default)', > + 'node-and-cluster': 'Node and Cluster Name', > + fqdn: 'Fully Qualified Domain Name (FQDN)', > + }, these should probably also be wrapped in gettext > + > shouldSortTags: function () { > return !(PVE.UIOptions.options['tag-style']?.ordering === 'config'); > }, > diff --git a/www/manager6/dc/OptionView.js b/www/manager6/dc/OptionView.js > 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'] = { > + required: true, > + renderer: (value) => { > + if (value === undefined) { > + return gettext('No Overrides'); > + } > + let txt = ''; > + if (value.title) { > + txt += Ext.String.format(gettext('Title: {0}'), value.title); nit: this shows the raw enum value, which confused me a bit given the dropdown in the edit window shows the display text. as you noted off-list, the display names could make the column quite a lot wider, however I don't think this would be an issue, since there are other columns that are pretty wide as well (e.g. the tag style overrides). > + } > + return txt; > + }, > + header: gettext('Ui Settings'), as far as I could tell from a quick search through the codebase, we do not use Ui (with small i) anywhere in user-facing strings, I think UI would be better here. > + editor: { > + xtype: 'proxmoxWindowEdit', > + width: 800, > + subject: gettext('Ui Settings'), same here > + fieldDefaults: { > + labelWidth: 100, > + }, > + url: '/api2/extjs/cluster/options', > + items: [ > + { > + xtype: 'inputpanel', > + setValues: function (values) { > + if (values === undefined) { > + return undefined; > + } > + values = values?.['ui-settings'] ?? {}; > + values.title = values.title || '__default__'; > + return Proxmox.panel.InputPanel.prototype.setValues.call(this, values); > + }, > + onGetValues: function (values) { > + let style = {}; > + if (values.title) { > + style.title = values.title; > + } > + let value = PVE.Parser.printPropertyString(style); > + if (value === '') { > + 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', > -- > 2.47.3 > > > > >