[pve-devel] [PATCH widget-toolkit 1/2] remove button: allow to set custom confirmation message

Lukas Wagner l.wagner at proxmox.com
Thu Dec 14 10:48:43 CET 2023


Signed-off-by: Lukas Wagner <l.wagner at proxmox.com>
---
 src/button/Button.js | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/src/button/Button.js b/src/button/Button.js
index 1f53869..a59a999 100644
--- a/src/button/Button.js
+++ b/src/button/Button.js
@@ -110,6 +110,7 @@ Ext.define('Proxmox.button.StdRemoveButton', {
 
     config: {
 	baseurl: undefined,
+	customConfirmationMessage: undefined,
     },
 
     getUrl: function(rec) {
@@ -133,7 +134,14 @@ Ext.define('Proxmox.button.StdRemoveButton', {
 	let me = this;
 
 	let name = me.getRecordName(rec);
-	return Ext.String.format(gettext('Are you sure you want to remove entry {0}'), `'${name}'`);
+
+	let text;
+	if (me.customConfirmationMessage) {
+	    text = me.customConfirmationMessage;
+	} else {
+	    text = gettext('Are you sure you want to remove entry {0}');
+	}
+	return Ext.String.format(text, `'${name}'`);
     },
 
     handler: function(btn, event, rec) {
-- 
2.39.2





More information about the pve-devel mailing list