[pve-devel] [PATCH v2 manager] ui: tree-wide: use new AltText button
Matthias Heiserer
m.heiserer at proxmox.com
Mon Mar 28 15:07:37 CEST 2022
text is not needed with the AltText button.
Signed-off-by: Matthias Heiserer <m.heiserer at proxmox.com>
---
www/manager6/lxc/Resources.js | 18 +-----------------
www/manager6/qemu/HardwareView.js | 18 +-----------------
2 files changed, 2 insertions(+), 34 deletions(-)
diff --git a/www/manager6/lxc/Resources.js b/www/manager6/lxc/Resources.js
index 15ee3c67..96dc43a1 100644
--- a/www/manager6/lxc/Resources.js
+++ b/www/manager6/lxc/Resources.js
@@ -189,8 +189,7 @@ Ext.define('PVE.lxc.RessourceView', {
handler: run_resize,
});
- var remove_btn = new Proxmox.button.Button({
- text: gettext('Remove'),
+ var remove_btn = new Proxmox.button.AltText({
defaultText: gettext('Remove'),
altText: gettext('Detach'),
selModel: me.selModel,
@@ -210,21 +209,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 });
- },
- },
});
var move_btn = new Proxmox.button.Button({
diff --git a/www/manager6/qemu/HardwareView.js b/www/manager6/qemu/HardwareView.js
index 6cea4287..a95da1dc 100644
--- a/www/manager6/qemu/HardwareView.js
+++ b/www/manager6/qemu/HardwareView.js
@@ -438,8 +438,7 @@ Ext.define('PVE.qemu.HardwareView', {
handler: run_move,
});
- var remove_btn = new Proxmox.button.Button({
- text: gettext('Remove'),
+ var remove_btn = new Proxmox.button.AltText({
defaultText: gettext('Remove'),
altText: gettext('Detach'),
selModel: sm,
@@ -485,21 +484,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 });
- },
- },
});
var revert_btn = new PVE.button.PendingRevert({
--
2.30.2
More information about the pve-devel
mailing list