The ConfirmRemoveDialog offers additional customization, but covers
SafeDestroy's feature set. This is done mostly to streamline the
implementation, basing dialogs to remove guests, storage, or resources
on the same component.

Signed-off-by: Michael Köppl <m.koe...@proxmox.com>
---
 www/manager6/window/SafeDestroyGuest.js   | 26 ++++++++++++++++++++++-
 www/manager6/window/SafeDestroyStorage.js | 23 +++++++++++++++++++-
 2 files changed, 47 insertions(+), 2 deletions(-)

diff --git a/www/manager6/window/SafeDestroyGuest.js 
b/www/manager6/window/SafeDestroyGuest.js
index ee0c649c9..291702141 100644
--- a/www/manager6/window/SafeDestroyGuest.js
+++ b/www/manager6/window/SafeDestroyGuest.js
@@ -2,9 +2,14 @@
  * SafeDestroy window with additional checkboxes for removing guests
  */
 Ext.define('PVE.window.SafeDestroyGuest', {
-    extend: 'Proxmox.window.SafeDestroy',
+    extend: 'Proxmox.window.ConfirmRemoveDialog',
     alias: 'widget.pveSafeDestroyGuest',
 
+    confirmButtonText: 'Remove',
+    declineButtonText: null,
+
+    dangerous: true,
+
     additionalItems: [
         {
             xtype: 'proxmoxcheckbox',
@@ -32,8 +37,27 @@ Ext.define('PVE.window.SafeDestroyGuest', {
         },
     ],
 
+    config: {
+        text: undefined,
+        item: {
+            id: undefined,
+            formattedIdentifier: undefined,
+        },
+        taskName: undefined,
+    },
+
     note: gettext('Referenced disks will always be destroyed.'),
 
+    getText: function () {
+        let me = this;
+
+        let identifier = me.getItem().formattedIdentifier ?? me.getItem().id;
+
+        me.text = `${Proxmox.Utils.format_task_description(me.getTaskName(), 
identifier)}`;
+
+        return me.callParent();
+    },
+
     getParams: function () {
         let me = this;
 
diff --git a/www/manager6/window/SafeDestroyStorage.js 
b/www/manager6/window/SafeDestroyStorage.js
index 8dcb41317..74cfd5a8c 100644
--- a/www/manager6/window/SafeDestroyStorage.js
+++ b/www/manager6/window/SafeDestroyStorage.js
@@ -2,11 +2,16 @@
  * SafeDestroy window with additional checkboxes for removing a storage on the 
disk level.
  */
 Ext.define('PVE.window.SafeDestroyStorage', {
-    extend: 'Proxmox.window.SafeDestroy',
+    extend: 'Proxmox.window.ConfirmRemoveDialog',
     alias: 'widget.pveSafeDestroyStorage',
 
     showProgress: true,
 
+    confirmButtonText: 'Remove',
+    declineButtonText: null,
+
+    dangerous: true,
+
     additionalItems: [
         {
             xtype: 'proxmoxcheckbox',
@@ -28,6 +33,22 @@ Ext.define('PVE.window.SafeDestroyStorage', {
         },
     ],
 
+    config: {
+        text: undefined,
+        item: {
+            id: undefined,
+        },
+        taskName: undefined,
+    },
+
+    getText: function () {
+        let me = this;
+
+        me.text = `${Proxmox.Utils.format_task_description(me.getTaskName(), 
me.getItem().id)}`;
+
+        return me.callParent();
+    },
+
     getParams: function () {
         let me = this;
 
-- 
2.47.3



_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel

Reply via email to