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 3C3A963D11 for ; Wed, 25 Nov 2020 14:52:01 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 33B4F1ABD2 for ; Wed, 25 Nov 2020 14:52:01 +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 71F341ABC8 for ; Wed, 25 Nov 2020 14:52:00 +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 3E6BF4406F for ; Wed, 25 Nov 2020 14:52:00 +0100 (CET) To: Proxmox VE development discussion , =?UTF-8?Q?Dominic_J=c3=a4ger?= References: <20201125134225.30516-1-d.jaeger@proxmox.com> From: Thomas Lamprecht Message-ID: <4b3ddac9-78cc-28d2-fe72-3088f0098b2f@proxmox.com> Date: Wed, 25 Nov 2020 14:51:59 +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: <20201125134225.30516-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.079 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 URIBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [proxmox.com] Subject: Re: [pve-devel] [PATCH manager v2] 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 13:52:01 -0000 On 25.11.20 14:42, 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 > Signed-off-by: Dominic J=C3=A4ger > --- > v2: Move the keep-all=3D1 default up >=20 > @Thomas: Or did you mean to keep only that part that I now moved up? I = can try to find a nicer way > tomorrow. >=20 missed that patch, sorry, I applied another variant - it's shorter, but I hope it caught also all edge cases now. https://git.proxmox.com/?p=3Dpve-manager.git;a=3Dcommitdiff;h=3D85fa61343= 1167358e5441f10c4247aa24e14421a > www/manager6/storage/Base.js | 26 +++++++++++++++++--------- > 1 file changed, 17 insertions(+), 9 deletions(-) >=20 > diff --git a/www/manager6/storage/Base.js b/www/manager6/storage/Base.j= s > index 70e18a81..e8a76fe0 100644 > --- a/www/manager6/storage/Base.js > +++ b/www/manager6/storage/Base.js > @@ -65,23 +65,31 @@ Ext.define('PVE.panel.StoragePruneInputPanel', { > keepLastEmptyText: gettext('1'), > =20 > onGetValues: function(formValues) { > + let checkbox =3D this.down('proxmoxcheckbox[name=3Dkeep-all]'); > if (this.needMask) { // isMasked() may not yet be true if not rendere= d once > return {}; > + } else if (this.isCreate && !checkbox.rendered) { > + // User has not seen the checkbox yet =3D> Use default > + // keep-all has no value yet =3D> Hardcoded > + return { 'prune-backups': 'keep-all=3D1' }; > } > delete formValues.delete; > - let retention =3D PVE.Parser.printPropertyString(formValues) > + let retention =3D PVE.Parser.printPropertyString(formValues); > + let options =3D { }; > if (retention =3D=3D=3D '') { > - if (this.isCreate) { > - return {}; > + if (!this.isCreate) { > + options.delete =3D 'prune-backups'; > } > - // 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 }; > + // always delete old 'maxfiles' on edit, we map it to keep-last on wi= ndow load > if (!this.isCreate) { > - options.delete =3D 'maxfiles'; > + if (options.delete) { > + options.delete =3D [options.delete].concat('maxfiles'); > + } else { > + options.delete =3D 'maxfiles'; > + } > } > return options; > }, >=20