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 C09C863D4A for ; Wed, 25 Nov 2020 14:42:59 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id B165C1AA5B for ; Wed, 25 Nov 2020 14:42:29 +0100 (CET) Received: from dev.dominic.proxmox.com (212-186-127-178.static.upcbusiness.at [212.186.127.178]) by firstgate.proxmox.com (Proxmox) with ESMTP id 42A321AA51 for ; Wed, 25 Nov 2020 14:42:29 +0100 (CET) Received: by dev.dominic.proxmox.com (Postfix, from userid 0) id 2740222910; Wed, 25 Nov 2020 14:42:29 +0100 (CET) From: =?UTF-8?q?Dominic=20J=C3=A4ger?= To: pve-devel@lists.proxmox.com Date: Wed, 25 Nov 2020 14:42:25 +0100 Message-Id: <20201125134225.30516-1-d.jaeger@proxmox.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 1 AWL -0.357 Adjusted score from AWL reputation of From: address KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment KAM_LAZY_DOMAIN_SECURITY 1 Sending domain does not have any anti-forgery methods KHOP_HELO_FCRDNS 0.4 Relay HELO differs from its IP's reverse DNS NO_DNS_FOR_FROM 0.379 Envelope sender has no MX or A DNS records SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_NONE 0.001 SPF: sender does not publish an SPF Record Subject: [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:42:59 -0000 ... if the user hasn't seen the prune panel yet. The GUI has as default value a ticked keep-all checkbox => keep-all=1. Previously we sent nothing in this case which led to the no-keeps default of keep-last=1. Signed-off-by: Dominic Jäger --- v2: Move the keep-all=1 default up @Thomas: Or did you mean to keep only that part that I now moved up? I can try to find a nicer way tomorrow. www/manager6/storage/Base.js | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/www/manager6/storage/Base.js b/www/manager6/storage/Base.js 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'), onGetValues: function(formValues) { + let checkbox = this.down('proxmoxcheckbox[name=keep-all]'); if (this.needMask) { // isMasked() may not yet be true if not rendered once return {}; + } else if (this.isCreate && !checkbox.rendered) { + // User has not seen the checkbox yet => Use default + // keep-all has no value yet => Hardcoded + return { 'prune-backups': 'keep-all=1' }; } delete formValues.delete; - let retention = PVE.Parser.printPropertyString(formValues) + let retention = PVE.Parser.printPropertyString(formValues); + let options = { }; if (retention === '') { - if (this.isCreate) { - return {}; + if (!this.isCreate) { + options.delete = 'prune-backups'; } - // always delete old 'maxfiles' on edit, we map it to keep-last on window load - return { - delete: ['prune-backups','maxfiles'], - }; + } else { + options['prune-backups'] = retention; } - let options = { 'prune-backups': retention }; + // always delete old 'maxfiles' on edit, we map it to keep-last on window load if (!this.isCreate) { - options.delete = 'maxfiles'; + if (options.delete) { + options.delete = [options.delete].concat('maxfiles'); + } else { + options.delete = 'maxfiles'; + } } return options; }, -- 2.20.1