Add an extended removal dialog for HA resources, which also allows
setting a purge parameter through the checkbox. By default, the purge
option is enabled, updating rules referencing the resource and deleting
any rules that only have this resource left.

Signed-off-by: Michael Köppl <[email protected]>
---
 www/manager6/Makefile                      |  1 +
 www/manager6/window/SafeDestroyResource.js | 32 ++++++++++++++++++++++
 2 files changed, 33 insertions(+)
 create mode 100644 www/manager6/window/SafeDestroyResource.js

diff --git a/www/manager6/Makefile b/www/manager6/Makefile
index 85f9268d1..a8bea9413 100644
--- a/www/manager6/Makefile
+++ b/www/manager6/Makefile
@@ -127,6 +127,7 @@ JSSRC=                                                      
\
        window/Prune.js                                 \
        window/Restore.js                               \
        window/SafeDestroyGuest.js                      \
+       window/SafeDestroyResource.js                   \
        window/SafeDestroyStorage.js                    \
        window/Settings.js                              \
        window/Snapshot.js                              \
diff --git a/www/manager6/window/SafeDestroyResource.js 
b/www/manager6/window/SafeDestroyResource.js
new file mode 100644
index 000000000..988af7969
--- /dev/null
+++ b/www/manager6/window/SafeDestroyResource.js
@@ -0,0 +1,32 @@
+/*
+ * SafeDestroy window with additional checkboxes for removing resources
+ */
+Ext.define('PVE.window.SafeDestroyResource', {
+    extend: 'Proxmox.window.SafeDestroy',
+    alias: 'widget.pveSafeDestroyResource',
+
+    additionalItems: [
+        {
+            xtype: 'proxmoxcheckbox',
+            name: 'purge',
+            reference: 'purgeCheckbox',
+            boxLabel: gettext('Purge resource from referenced HA rules'),
+            checked: true,
+            autoEl: {
+                tag: 'div',
+                'data-qtip': gettext(
+                    'Also removes resource from HA rules and removes rule if 
there are no other resources in it',
+                ),
+            },
+        },
+    ],
+
+    getParams: function () {
+        let me = this;
+
+        const purgeCheckbox = me.lookupReference('purgeCheckbox');
+        me.params.purge = purgeCheckbox.checked ? 1 : 0;
+
+        return me.callParent();
+    },
+});
-- 
2.47.3



_______________________________________________
pve-devel mailing list
[email protected]
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel

Reply via email to