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

Thomas Lamprecht t.lamprecht at proxmox.com
Fri Oct 18 22:28:44 CEST 2019


On 10/15/19 1:00 PM, Christian Ebner wrote:
> Signed-off-by: Christian Ebner <c.ebner at proxmox.com>
> ---
> version 4:
>     * no changes since v3
> 
>  www/manager6/window/SafeDestroy.js | 12 ++++++++++++
>  1 file changed, 12 insertions(+)
> 
> diff --git a/www/manager6/window/SafeDestroy.js b/www/manager6/window/SafeDestroy.js
> index eb3e6665..ef867deb 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,14 @@ Ext.define('PVE.window.SafeDestroy', {
>  		    labelWidth: 300,
>  		    hideTrigger: true,
>  		    allowBlank: false
> +		},
> +		{
> +		    xtype: 'proxmoxcheckbox',
> +		    name: 'purge',
> +		    reference: 'purgeCheckbox',
> +		    fieldLabel: gettext('Purge'),
> +		    labelWidth: 300,
> +		    checked: false
>  		}
>  	    ]
>  	}
> 



hmm SafeDestroy is used for more than CT/VMs, e.g., Ceph pools,
certain storage content, ...?

so maybe do something like (untested)

----8<----
diff --git a/www/manager6/window/SafeDestroy.js b/www/manager6/window/SafeDestroy.js
index ef867deb..2a0a0843 100644
--- a/www/manager6/window/SafeDestroy.js
+++ b/www/manager6/window/SafeDestroy.js
@@ -177,6 +177,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 + ')';
---

or a bind or cbind? Overwriting this for CTs/VMs only could work too.

Anyway, additionally to that I'd like to have a tool tip with more
details about what gets purged.
grep for "qtip" to see how it could be done, some elements can also
use "tooltip" config directly, not sure if checkbox was such a element..

cheers




More information about the pve-devel mailing list