[pve-devel] [PATCH v5 manager] fix #1291: add purge checkbox to VM/CT destroy dialog

Christian Ebner c.ebner at proxmox.com
Tue Oct 22 16:40:37 CEST 2019


Signed-off-by: Christian Ebner <c.ebner at proxmox.com>
---
version 5:
   * only show checkbox for CT/VM destroy dialog (as suggested) 
   * added qtip to checkbox

 www/manager6/window/SafeDestroy.js | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/www/manager6/window/SafeDestroy.js b/www/manager6/window/SafeDestroy.js
index eb3e6665..e1a03601 100644
--- a/www/manager6/window/SafeDestroy.js
+++ b/www/manager6/window/SafeDestroy.js
@@ -26,6 +26,10 @@ Ext.define('PVE.window.SafeDestroy', {
 
     getParams: function() {
 	var me = this;
+	var purgeCheckbox = me.lookupReference('purgeCheckbox');
+	if (purgeCheckbox.checked) {
+	    me.params.purge = 1;
+	}
 	if (Ext.Object.isEmpty(me.params)) {
 	    return '';
 	}
@@ -121,6 +125,18 @@ Ext.define('PVE.window.SafeDestroy', {
 		    labelWidth: 300,
 		    hideTrigger: true,
 		    allowBlank: false
+		},
+		{
+		    xtype: 'proxmoxcheckbox',
+		    name: 'purge',
+		    reference: 'purgeCheckbox',
+		    fieldLabel: gettext('Purge'),
+		    labelWidth: 300,
+		    checked: false,
+		    autoEl: {
+			tag: 'div',
+			'data-qtip': gettext('Remove from replication and backup jobs')
+		    }
 		}
 	    ]
 	}
@@ -165,6 +181,12 @@ Ext.define('PVE.window.SafeDestroy', {
 
 	messageCmp.setHtml(msg);
 
+	if (!(item.type === 'VM' || item.type === 'CT')) {
+	    let purgeCheckbox = me.lookupReference('purgeCheckbox');
+	    purgeCheckbox.setDisabled(true);
+	    purgeCheckbox.setHidden(true);
+	}
+
 	var confirmField = me.lookupReference('confirmField');
 	msg = gettext('Please enter the ID to confirm') +
 	    ' (' + item.id + ')';
-- 
2.20.1




More information about the pve-devel mailing list