public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Elias Huhsovitz <e.huhsovitz@proxmox.com>
To: pve-devel@lists.proxmox.com
Cc: Elias Huhsovitz <e.huhsovitz@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	[thread overview]
Message-ID: <20261103092730.21635-3-e.huhsovitz@proxmox.com> (raw)
In-Reply-To: <20261103092730.21635-1-e.huhsovitz@proxmox.com>

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 <e.huhsovitz@proxmox.com>
---
 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





  parent reply	other threads:[~2026-11-03  9:27 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-03  9:27 [PATCH manager v2 0/3] ui: lxc/qemu: reduce ambiguity when attaching unused disk Elias Huhsovitz
2026-11-03  9:27 ` [PATCH manager v2 1/3] ui: lxc/qemu: rename button label 'Edit' to 'Attach' for unused disks Elias Huhsovitz
2026-11-03  9:27 ` Elias Huhsovitz [this message]
2026-11-03  9:27 ` [PATCH manager v2 3/3] ui: qemu: re-order buttons in hardware tab to match lxc layout Elias Huhsovitz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261103092730.21635-3-e.huhsovitz@proxmox.com \
    --to=e.huhsovitz@proxmox.com \
    --cc=pve-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal