From: Elias Huhsovitz <e.huhsovitz@proxmox.com>
To: pve-devel@lists.proxmox.com
Cc: Elias Huhsovitz <e.huhsovitz@proxmox.com>
Subject: [PATCH manager] ui: qemu: rename button label 'Edit' to 'Attach' for unused disks
Date: Fri, 30 Oct 2026 13:42:35 +0100 [thread overview]
Message-ID: <20261030124235.124337-1-e.huhsovitz@proxmox.com> (raw)
Currently, adding an unused (detached) disk requires the user to select
the disk and click the generic "Edit" button. This is confusing,
because: (1) The "Edit" label does not implicitly convey the action of
adding/attaching the disk. (2) The action to make a disk unused is
explicitly labeled "Detach", so a user expects a contrary "Attach"
button.
Harmonize the UI terminology by dynamically changing the "Edit" button
label to "Attach" when an unused disk is selected. This mirrors the
existing behavior of the "Remove" button, which changes to "Detach" for
used disks.
To prevent the toolbar from jittering when switching between labels of
different lengths, apply the same maximum-width calculation hack on
render that is already used for the remove button.
Signed-off-by: Elias Huhsovitz <e.huhsovitz@proxmox.com>
---
www/manager6/qemu/HardwareView.js | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
diff --git a/www/manager6/qemu/HardwareView.js b/www/manager6/qemu/HardwareView.js
index 8b932995..3a59658a 100644
--- a/www/manager6/qemu/HardwareView.js
+++ b/www/manager6/qemu/HardwareView.js
@@ -474,9 +474,26 @@ Ext.define('PVE.qemu.HardwareView', {
let edit_btn = new Proxmox.button.Button({
text: gettext('Edit'),
+ defaultText: gettext('Edit'),
+ altText: gettext('Attach'),
selModel: sm,
disabled: true,
handler: run_editor,
+ 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 "Edit" and "Attach" 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 runEfiEnroll = function () {
@@ -818,6 +835,10 @@ Ext.define('PVE.qemu.HardwareView', {
(isDisk && !diskCap),
);
+ edit_btn.setText(
+ isUnusedDisk && !isCloudInit ? edit_btn.altText : edit_btn.defaultText,
+ );
+
diskaction_btn.setDisabled(
pending || !diskCap || isCloudInit || !(isDisk || isEfi || tpmMoveable),
);
--
2.47.3
next reply other threads:[~2026-10-30 12:43 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-30 12:42 Elias Huhsovitz [this message]
2026-10-30 16:37 ` [PATCH manager] ui: qemu: rename button label 'Edit' to 'Attach' for unused disks 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=20261030124235.124337-1-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