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/ConfirmRemoveResource.js | 41 ++++++++++++++++++++
 2 files changed, 42 insertions(+)
 create mode 100644 www/manager6/window/ConfirmRemoveResource.js

diff --git a/www/manager6/Makefile b/www/manager6/Makefile
index 85f9268d1..17ae49a24 100644
--- a/www/manager6/Makefile
+++ b/www/manager6/Makefile
@@ -120,6 +120,7 @@ JSSRC=                                                      
\
        window/BulkAction.js                            \
        window/CephInstall.js                           \
        window/Clone.js                                 \
+       window/ConfirmRemoveResource.js                 \
        window/FirewallEnableEdit.js                    \
        window/FirewallLograteEdit.js                   \
        window/LoginWindow.js                           \
diff --git a/www/manager6/window/ConfirmRemoveResource.js 
b/www/manager6/window/ConfirmRemoveResource.js
new file mode 100644
index 000000000..55b8022ee
--- /dev/null
+++ b/www/manager6/window/ConfirmRemoveResource.js
@@ -0,0 +1,41 @@
+/*
+ * ConfirmRemoveDialog window with additional checkboxes for removing resources
+ */
+Ext.define('PVE.window.ConfirmRemoveResource', {
+    extend: 'Proxmox.window.ConfirmRemoveDialog',
+    alias: 'widget.pveConfirmRemoveResource',
+
+    additionalItems: [
+        {
+            xtype: 'proxmoxcheckbox',
+            name: 'purge',
+            reference: 'purgeCheckbox',
+            boxLabel: gettext('Purge resource from referenced HA rules'),
+            padding: '5 0 0 0',
+            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',
+                ),
+            },
+        },
+    ],
+
+    getText: function () {
+        let me = this;
+
+        me.text = `Are you sure you want to remove resource 
'${me.getItem().id}'?`;
+
+        return me.callParent();
+    },
+
+    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