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 EBE8D1FF0AA for ; Tue, 03 Nov 2026 10:27:53 +0100 (CET) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id B1F1721865; Tue, 03 Nov 2026 10:27:40 +0100 (CET) From: Elias Huhsovitz To: pve-devel@lists.proxmox.com Subject: [PATCH manager v2 2/3] ui: lxc/qemu: convert buttons displaying altText to proxmoxAltTextButton Date: Tue, 3 Nov 2026 10:27:29 +0100 Message-ID: <20261103092730.21635-3-e.huhsovitz@proxmox.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20261103092730.21635-1-e.huhsovitz@proxmox.com> References: <20261103092730.21635-1-e.huhsovitz@proxmox.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1793698054924 X-SPAM-LEVEL: Spam detection results: 0 AWL -0.161 Adjusted score from AWL reputation of From: address DMARC_MISSING 0.1 Missing DMARC policy ENA_SUBJ_ODD_CASE 1.2 Subject has odd case 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: HPPCTUFOVOP72KGRUSZT2OTLGTHN6RYX X-Message-ID-Hash: HPPCTUFOVOP72KGRUSZT2OTLGTHN6RYX 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 CC: Elias Huhsovitz X-Mailman-Version: 3.3.10 Precedence: list List-Id: Proxmox VE development discussion List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Buttons displaying alternative text, depending on the config state, rely on a listener to set to appropriate width. This prevents the whole toolbar to move when switching between hardware/resources. Currently this behaviour is defined for each button that displays alternative text individually. Convert the buttons to a proxmoxAltTextButton, as defined in the proxmox-widget-toolkit, to unify the width handling. Signed-off-by: Elias Huhsovitz --- www/manager6/lxc/Resources.js | 17 +---------------- www/manager6/qemu/HardwareView.js | 17 +---------------- 2 files changed, 2 insertions(+), 32 deletions(-) diff --git a/www/manager6/lxc/Resources.js b/www/manager6/lxc/Resources.js index 40321d03..e04d5283 100644 --- a/www/manager6/lxc/Resources.js +++ b/www/manager6/lxc/Resources.js @@ -235,7 +235,7 @@ Ext.define('PVE.lxc.RessourceView', { }, }); - var remove_btn = new Proxmox.button.Button({ + var remove_btn = new Proxmox.button.AltText({ text: gettext('Remove'), defaultText: gettext('Remove'), altText: gettext('Detach'), @@ -256,21 +256,6 @@ Ext.define('PVE.lxc.RessourceView', { return msg; }, handler: run_remove, - listeners: { - render: function (btn) { - // hack: calculate the max button width on first display to prevent the whole - // toolbar to move when we switch between the "Remove" and "Detach" labels - let def = btn.getSize().width; - - btn.setText(btn.altText); - let alt = btn.getSize().width; - - btn.setText(btn.defaultText); - - let optimal = alt > def ? alt : def; - btn.setSize({ width: optimal }); - }, - }, }); let move_menuitem = new Ext.menu.Item({ diff --git a/www/manager6/qemu/HardwareView.js b/www/manager6/qemu/HardwareView.js index 3eebd05f..bc0aa19d 100644 --- a/www/manager6/qemu/HardwareView.js +++ b/www/manager6/qemu/HardwareView.js @@ -633,7 +633,7 @@ Ext.define('PVE.qemu.HardwareView', { }, }); - let remove_btn = new Proxmox.button.Button({ + let remove_btn = new Proxmox.button.AltText({ text: gettext('Remove'), defaultText: gettext('Remove'), altText: gettext('Detach'), @@ -679,21 +679,6 @@ Ext.define('PVE.qemu.HardwareView', { }, }); }, - listeners: { - render: function (btn) { - // hack: calculate the max button width on first display to prevent the whole - // toolbar to move when we switch between the "Remove" and "Detach" labels - var def = btn.getSize().width; - - btn.setText(btn.altText); - var alt = btn.getSize().width; - - btn.setText(btn.defaultText); - - var optimal = alt > def ? alt : def; - btn.setSize({ width: optimal }); - }, - }, }); let revert_btn = new PVE.button.PendingRevert({ -- 2.47.3