From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by lists.proxmox.com (Postfix) with ESMTPS id 61C9463CA9 for ; Wed, 25 Nov 2020 13:25:14 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 596FC19CC5 for ; Wed, 25 Nov 2020 13:25:14 +0100 (CET) Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com [212.186.127.180]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by firstgate.proxmox.com (Proxmox) with ESMTPS id CF41F19CBB for ; Wed, 25 Nov 2020 13:25:13 +0100 (CET) Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1]) by proxmox-new.maurer-it.com (Proxmox) with ESMTP id 97A0243B50 for ; Wed, 25 Nov 2020 13:25:13 +0100 (CET) To: Proxmox VE development discussion , =?UTF-8?Q?Dominic_J=c3=a4ger?= References: <20201125113630.83660-1-d.jaeger@proxmox.com> From: Thomas Lamprecht Message-ID: <622882dd-79cd-72a7-d2de-c7860e60bd94@proxmox.com> Date: Wed, 25 Nov 2020 13:25:12 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:83.0) Gecko/20100101 Thunderbird/83.0 MIME-Version: 1.0 In-Reply-To: <20201125113630.83660-1-d.jaeger@proxmox.com> Content-Type: text/plain; charset=UTF-8 Content-Language: en-US Content-Transfer-Encoding: quoted-printable X-SPAM-LEVEL: Spam detection results: 0 AWL -0.080 Adjusted score from AWL reputation of From: address KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment NICE_REPLY_A -0.001 Looks like a legit reply (A) RCVD_IN_DNSWL_MED -2.3 Sender listed at https://www.dnswl.org/, medium trust SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Subject: Re: [pve-devel] [PATCH manager] storage: base edit: Use the GUI keep-all default value X-BeenThere: pve-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox VE development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 25 Nov 2020 12:25:14 -0000 On 25.11.20 12:36, Dominic J=C3=A4ger wrote: > ... if the user hasn't seen the prune panel yet. > The GUI has as default value a ticked keep-all checkbox =3D> keep-all=3D= 1. > Previously we sent nothing in this case which led to the no-keeps defau= lt of > keep-last=3D1. >=20 > Furthermore, refactor so that "The always delete old 'maxfiles' on edit= " is now > clearly visible even without comment. I applied a fix for another issue when editing storages which do not support this settings at all, maybe we could just add a else-if to that with a `this.isCreate && this.rendered` check and returning: return { 'prune-backups': 'keep-all=3D1' }; (on create deletion is not supported anyway, so should be fine) >=20 > Signed-off-by: Dominic J=C3=A4ger > --- > www/manager6/storage/Base.js | 34 ++++++++++++++++++++++++---------- > 1 file changed, 24 insertions(+), 10 deletions(-) >=20 > diff --git a/www/manager6/storage/Base.js b/www/manager6/storage/Base.j= s > index 80bc8002..0ad54817 100644 > --- a/www/manager6/storage/Base.js > +++ b/www/manager6/storage/Base.js > @@ -66,19 +66,33 @@ Ext.define('PVE.panel.StoragePruneInputPanel', { > =20 > onGetValues: function(formValues) { > delete formValues.delete; > - let retention =3D PVE.Parser.printPropertyString(formValues) > + let retention =3D PVE.Parser.printPropertyString(formValues); > + let isEdit =3D !this.isCreate; > + let options =3D { }; > if (retention =3D=3D=3D '') { > - if (this.isCreate) { > - return {}; > + if (isEdit) { > + options.delete =3D 'prune-backups'; > + } else { > + let checkbox =3D this.down('proxmoxcheckbox[name=3Dkeep-all]'); > + // Checkbox gets its default value true after being rendered (listen= er) > + // Rendered =3D> User saw (& potentially changed) the value =3D> use= it > + // Otherwise use default (hardcoded, because default is not yet > + // assigned to the checkbox) > + let value =3D checkbox.rendered ? checkbox.getValue() : 'keep-all=3D= 1'; > + console.assert(value); > + options['prune-backups'] =3D value; > } > - // always delete old 'maxfiles' on edit, we map it to keep-last o= n window load > - return { > - delete: ['prune-backups','maxfiles'], > - }; > + } else { > + options['prune-backups'] =3D retention; > } > - let options =3D { 'prune-backups': retention }; > - if (!this.isCreate) { > - options.delete =3D 'maxfiles'; > + // always delete old 'maxfiles' on edit, we map it to keep-last on wi= ndow load > + if (isEdit) { > + if (options.delete) { > + // here isEdit =3D true > + options.delete =3D [options.delete].concat('maxfiles'); > + } else { > + options.delete =3D 'maxfiles'; > + } > } > return options; > }, >=20