all lists on lists.proxmox.com
 help / color / mirror / Atom feed
From: Matthias Heiserer <m.heiserer@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH manager] use the width-helper from utils
Date: Thu, 24 Mar 2022 12:33:31 +0100	[thread overview]
Message-ID: <20220324113331.681971-3-m.heiserer@proxmox.com> (raw)
In-Reply-To: <20220324113331.681971-1-m.heiserer@proxmox.com>

Signed-off-by: Matthias Heiserer <m.heiserer@proxmox.com>
---
 www/manager6/lxc/Resources.js     | 14 +-------------
 www/manager6/qemu/HardwareView.js | 14 +-------------
 2 files changed, 2 insertions(+), 26 deletions(-)

diff --git a/www/manager6/lxc/Resources.js b/www/manager6/lxc/Resources.js
index 15ee3c67..1b5d51d9 100644
--- a/www/manager6/lxc/Resources.js
+++ b/www/manager6/lxc/Resources.js
@@ -211,19 +211,7 @@ Ext.define('PVE.lxc.RessourceView', {
 	    },
 	    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 });
-		},
+		render: Proxmox.Utils.calculateWidth,
 	    },
 	});
 
diff --git a/www/manager6/qemu/HardwareView.js b/www/manager6/qemu/HardwareView.js
index 6cea4287..473cfcf4 100644
--- a/www/manager6/qemu/HardwareView.js
+++ b/www/manager6/qemu/HardwareView.js
@@ -486,19 +486,7 @@ 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 });
-		},
+		render: Proxmox.Utils.calculateWidth,
 	    },
 	});
 
-- 
2.30.2





  parent reply	other threads:[~2022-03-24 11:33 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-24 11:33 [pve-devel] [PATCH widget-toolkit 1/2] Utils: add calculate max button width hack Matthias Heiserer
2022-03-24 11:33 ` [pve-devel] [PATCH widget-toolkit 2/2] use the width-helper from utils Matthias Heiserer
2022-03-25  8:37   ` Thomas Lamprecht
2022-03-24 11:33 ` Matthias Heiserer [this message]
2022-03-25  8:47   ` [pve-devel] [PATCH manager] " Thomas Lamprecht
2022-03-25  8:35 ` [pve-devel] [PATCH widget-toolkit 1/2] Utils: add calculate max button width hack Thomas Lamprecht
2022-03-25  8:47 ` Thomas Lamprecht
2022-03-28  9:43   ` Matthias Heiserer
2022-03-28  9:44     ` Thomas Lamprecht
2022-03-28 10:17       ` Matthias Heiserer
2022-03-28 10:27         ` Thomas Lamprecht

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=20220324113331.681971-3-m.heiserer@proxmox.com \
    --to=m.heiserer@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal