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 406B16E369 for ; Tue, 29 Mar 2022 14:53:40 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 0E0D52EACE for ; Tue, 29 Mar 2022 14:53:39 +0200 (CEST) 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 82ACE2E8B6 for ; Tue, 29 Mar 2022 14:53:32 +0200 (CEST) Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1]) by proxmox-new.maurer-it.com (Proxmox) with ESMTP id 236D545974 for ; Tue, 29 Mar 2022 14:53:32 +0200 (CEST) From: Fabian Ebner To: pve-devel@lists.proxmox.com Date: Tue, 29 Mar 2022 14:53:16 +0200 Message-Id: <20220329125324.120737-5-f.ebner@proxmox.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220329125324.120737-1-f.ebner@proxmox.com> References: <20220329125324.120737-1-f.ebner@proxmox.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL 0.115 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 T_SCC_BODY_TEXT_LINE -0.01 - Subject: [pve-devel] [RFC v2 manager 3/8] ui: storage edit: retention: add max-protected-backups setting 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: Tue, 29 Mar 2022 12:53:40 -0000 Signed-off-by: Fabian Ebner --- I feel like this too might not be needed anymore, now that the default is more dynamic. Dependency bump for storage needed. Changes from v1: * Adapt empty text to reflect new default. www/manager6/panel/BackupJobPrune.js | 47 ++++++++++++++++++++++------ www/manager6/storage/Base.js | 1 + 2 files changed, 39 insertions(+), 9 deletions(-) diff --git a/www/manager6/panel/BackupJobPrune.js b/www/manager6/panel/BackupJobPrune.js index a58fe1fe..2bc3e633 100644 --- a/www/manager6/panel/BackupJobPrune.js +++ b/www/manager6/panel/BackupJobPrune.js @@ -15,21 +15,32 @@ Ext.define('PVE.panel.BackupJobPrune', { } else if (this.isCreate && !this.rendered) { return this.keepAllDefaultForCreate ? { 'prune-backups': 'keep-all=1' } : {}; } + + let options = { 'delete': [] }; + + if ('max-protected-backups' in formValues) { + options['max-protected-backups'] = formValues['max-protected-backups']; + } else if (this.hasMaxProtected) { + options.delete.push('max-protected-backups'); + } + + delete formValues['max-protected-backups']; delete formValues.delete; + let retention = PVE.Parser.printPropertyString(formValues); if (retention === '') { - if (this.isCreate) { - return {}; - } - // always delete old 'maxfiles' on edit, we map it to keep-last on window load - return { - 'delete': ['prune-backups', 'maxfiles'], - }; + options.delete.push('prune-backups'); + } else { + options['prune-backups'] = retention; } - let options = { 'prune-backups': retention }; + if (!this.isCreate) { - options.delete = 'maxfiles'; + // always delete old 'maxfiles' on edit, we map it to keep-last on window load + options.delete.push('maxfiles'); + } else { + delete options.delete; } + return options; }, @@ -57,6 +68,10 @@ Ext.define('PVE.panel.BackupJobPrune', { } panel.down('component[name=pbs-hint]').setHidden(!panel.showPBSHint); + let maxProtected = panel.down('proxmoxintegerfield[name=max-protected-backups]'); + maxProtected.setDisabled(!panel.hasMaxProtected); + maxProtected.setHidden(!panel.hasMaxProtected); + panel.query('pmxPruneKeepField').forEach(field => { field.on('change', panel.updateComponents, panel); }); @@ -95,5 +110,19 @@ Ext.define('PVE.panel.BackupJobPrune', { padding: '5 1', html: gettext("It's preferred to configure backup retention directly on the Proxmox Backup Server."), }, + { + xtype: 'proxmoxintegerfield', + name: 'max-protected-backups', + fieldLabel: gettext('Maximum Protected'), + minValue: -1, + hidden: true, + disabled: true, + emptyText: 'unlimited with Datastore.Allocate privilege, 5 otherwise', + deleteEmpty: true, + autoEl: { + tag: 'div', + 'data-qtip': Ext.String.format(gettext('Use {0} for unlimited'), -1), + }, + }, ], }); diff --git a/www/manager6/storage/Base.js b/www/manager6/storage/Base.js index 89dc2eff..7f6d7a09 100644 --- a/www/manager6/storage/Base.js +++ b/www/manager6/storage/Base.js @@ -120,6 +120,7 @@ Ext.define('PVE.storage.BaseEdit', { { xtype: 'pveBackupJobPrunePanel', title: gettext('Backup Retention'), + hasMaxProtected: true, isCreate: me.isCreate, keepAllDefaultForCreate: true, showPBSHint: me.ipanel.isPBS, -- 2.30.2