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 E37ED84F22 for ; Thu, 16 Dec 2021 13:12:42 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 7F9F71E514 for ; Thu, 16 Dec 2021 13:12:42 +0100 (CET) Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com [94.136.29.106]) (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 A22141E467 for ; Thu, 16 Dec 2021 13:12:38 +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 7BDD045316 for ; Thu, 16 Dec 2021 13:12:38 +0100 (CET) From: Fabian Ebner To: pve-devel@lists.proxmox.com Date: Thu, 16 Dec 2021 13:12:28 +0100 Message-Id: <20211216121233.162288-7-f.ebner@proxmox.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20211216121233.162288-1-f.ebner@proxmox.com> References: <20211216121233.162288-1-f.ebner@proxmox.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL 0.155 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Subject: [pve-devel] [RFC manager 4/6] ui: storage creation: retention: dynamically adapt max-protected-backups 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: Thu, 16 Dec 2021 12:12:42 -0000 depending on the other retention settings and as long as it isn't dirty (other than from the updating itself). Allow an unlimited number when keep-all=1 and use the default fall-back to 5 when pruning or fall-back for retention is configured. Signed-off-by: Fabian Ebner --- Might be too much automagic, maybe just setting -1 in afterrender and the never-rendered scenario is also enough? That is, if we even want the GUI default for creation to be unlimited. Just thought that it would better fit the keep-all default. www/manager6/panel/BackupJobPrune.js | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/www/manager6/panel/BackupJobPrune.js b/www/manager6/panel/BackupJobPrune.js index 555bccf2..880f0234 100644 --- a/www/manager6/panel/BackupJobPrune.js +++ b/www/manager6/panel/BackupJobPrune.js @@ -13,7 +13,14 @@ Ext.define('PVE.panel.BackupJobPrune', { if (this.needMask) { // isMasked() may not yet be true if not rendered once return {}; } else if (this.isCreate && !this.rendered) { - return this.keepAllDefaultForCreate ? { 'prune-backups': 'keep-all=1' } : {}; + let options = {}; + if (this.keepAllDefaultForCreate) { + options['prune-backups'] = 'keep-all=1'; + if (this.hasMaxProtected) { + options['max-protected-backups'] = -1; + } + } + return options; } let options = { 'delete': [] }; @@ -54,6 +61,17 @@ Ext.define('PVE.panel.BackupJobPrune', { field.setDisabled(keepAll); }); me.down('component[name=no-keeps-hint]').setHidden(anyValue || keepAll); + + let maxProtected = me.down('proxmoxintegerfield[name=max-protected-backups]'); + if (me.isCreate && me.hasMaxProtected && !maxProtected.isDirty()) { + if (keepAll) { + maxProtected.setValue(-1); + maxProtected.resetOriginalValue(); + } else { + maxProtected.setValue(''); + maxProtected.resetOriginalValue(); + } + } }, listeners: { @@ -71,6 +89,10 @@ Ext.define('PVE.panel.BackupJobPrune', { let maxProtected = panel.down('proxmoxintegerfield[name=max-protected-backups]'); maxProtected.setDisabled(!panel.hasMaxProtected); maxProtected.setHidden(!panel.hasMaxProtected); + if (panel.isCreate && panel.hasMaxProtected) { + maxProtected.setValue(-1); + maxProtected.resetOriginalValue(); + } panel.query('pmxPruneKeepField').forEach(field => { field.on('change', panel.updateComponents, panel); -- 2.30.2