[pve-devel] [PATCH manager] use the width-helper from utils

Matthias Heiserer m.heiserer at proxmox.com
Thu Mar 24 12:33:31 CET 2022


Signed-off-by: Matthias Heiserer <m.heiserer at 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






More information about the pve-devel mailing list