From: "Michael Köppl" <m.koeppl@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH widget-toolkit v3 3/4] window: make buttons in SafeDestroy configurable
Date: Tue, 30 Sep 2025 16:58:44 +0200 [thread overview]
Message-ID: <20250930145848.263162-8-m.koeppl@proxmox.com> (raw)
In-Reply-To: <20250930145848.263162-1-m.koeppl@proxmox.com>
The SafeDestroy dialog can now feature either 1 or 2 buttons. By
default, "Remove" will be the only button. By overriding the
confirmButtonText and/or declineButtonText variables, the button texts
can be configured and the second button can be added to the dialog. This
enables additional use cases for the dialog.
Signed-off-by: Michael Köppl <m.koeppl@proxmox.com>
---
src/window/SafeDestroy.js | 37 ++++++++++++++++++++++++++++---------
1 file changed, 28 insertions(+), 9 deletions(-)
diff --git a/src/window/SafeDestroy.js b/src/window/SafeDestroy.js
index ffa7d1d..4193db1 100644
--- a/src/window/SafeDestroy.js
+++ b/src/window/SafeDestroy.js
@@ -19,6 +19,10 @@ Ext.define('Proxmox.window.SafeDestroy', {
// will be displayed.
dangerous: true,
+ confirmButtonText: gettext('Remove'),
+ // second button will only be displayed if a text is given
+ declineButtonText: undefined,
+
additionalItems: [],
// gets called if we have a progress bar or taskview and it detected that
@@ -56,21 +60,21 @@ Ext.define('Proxmox.window.SafeDestroy', {
'field[name=confirm]': {
change: function (f, value) {
const view = this.getView();
- const removeButton = this.lookupReference('removeButton');
+ const confirmButton = this.lookupReference('confirmButton');
if (value === view.getItem().id.toString()) {
- removeButton.enable();
+ confirmButton.enable();
} else {
- removeButton.disable();
+ confirmButton.disable();
}
},
specialkey: function (field, event) {
- const removeButton = this.lookupReference('removeButton');
- if (!removeButton.isDisabled() && event.getKey() === event.ENTER) {
- removeButton.fireEvent('click', removeButton, event);
+ const confirmButton = this.lookupReference('confirmButton');
+ if (!confirmButton.isDisabled() && event.getKey() === event.ENTER) {
+ confirmButton.fireEvent('click', confirmButton, event);
}
},
},
- 'button[reference=removeButton]': {
+ 'button[reference=confirmButton]': {
click: function () {
const view = this.getView();
Proxmox.Utils.API2Request({
@@ -110,6 +114,12 @@ Ext.define('Proxmox.window.SafeDestroy', {
});
},
},
+ 'button[reference=declineButton]': {
+ click: function () {
+ const view = this.getView();
+ view.close();
+ },
+ },
},
},
@@ -210,14 +220,23 @@ Ext.define('Proxmox.window.SafeDestroy', {
let buttons = [
{
xtype: 'button',
- reference: 'removeButton',
- text: gettext('Remove'),
+ reference: 'confirmButton',
+ text: me.confirmButtonText,
disabled: me.dangerous,
width: 75,
margin: '0 5 0 0',
},
];
+ if (me.declineButtonText) {
+ buttons.push({
+ xtype: 'button',
+ reference: 'declineButton',
+ text: me.declineButtonText,
+ width: 75,
+ });
+ }
+
me.dockedItems = [
{
xtype: 'container',
--
2.47.3
_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
next prev parent reply other threads:[~2025-09-30 14:59 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-30 14:58 [pve-devel] [PATCH container/docs/ha-manager/manager/widget-toolkit/qemu-server v3 00/11] fix #6613: update HA rules upon resource deletion Michael Köppl
2025-09-30 14:58 ` [pve-devel] [PATCH ha-manager v3 1/2] fix #6613: update rules containing the resource to be deleted Michael Köppl
2025-09-30 14:58 ` [pve-devel] [PATCH ha-manager v3 2/2] api: add purge parameter for resource deletion Michael Köppl
2025-09-30 14:58 ` [pve-devel] [PATCH qemu-server v3 1/1] fix #6613: pass purge param to delete_service_from_config Michael Köppl
2025-09-30 14:58 ` [pve-devel] [PATCH container " Michael Köppl
2025-09-30 14:58 ` [pve-devel] [PATCH widget-toolkit v3 1/4] window: refactor construction of SafeDestroy items Michael Köppl
2025-09-30 14:58 ` [pve-devel] [PATCH widget-toolkit v3 2/4] window: introduce dangerous parameter to SafeDestroy Michael Köppl
2025-09-30 14:58 ` Michael Köppl [this message]
2025-09-30 14:58 ` [pve-devel] [PATCH widget-toolkit v3 4/4] window: add more general base dialog, make SafeDestroy concrete Michael Köppl
2025-09-30 14:58 ` [pve-devel] [PATCH manager v3 1/2] ui: add ConfirmRemoveResource window Michael Köppl
2025-09-30 14:58 ` [pve-devel] [PATCH manager v3 2/2] ui: use ConfirmRemoveResource window for removing resources Michael Köppl
2025-09-30 14:58 ` [pve-devel] [PATCH docs v3 1/1] add notes about effects of purge flag for resource and guest removal Michael Köppl
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=20250930145848.263162-8-m.koeppl@proxmox.com \
--to=m.koeppl@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