[pve-devel] [PATCH manager 3/6] ui: prune edit: prepare for being re-used for backup jobs

Fabian Ebner f.ebner at proxmox.com
Mon Sep 6 13:32:28 CEST 2021


1. Rename the isPBS variable to match the actual purpose. When editing
a backup job, the hint should not be shown, even if the storage is
PBS.

2. Allow specifying the text used for the fallback hint. For backup
jobs, the first fallback is the storage configuration, so the text
needs to be different there.

3. Make using keep-all=1 by default upon creation optional. For backup
jobs, the default should be "use fallback", i.e. no settings.

Signed-off-by: Fabian Ebner <f.ebner at proxmox.com>
---
 www/manager6/panel/EditPruneInputPanel.js | 10 ++++++----
 www/manager6/storage/Base.js              |  4 +++-
 2 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/www/manager6/panel/EditPruneInputPanel.js b/www/manager6/panel/EditPruneInputPanel.js
index d58db208..547daecc 100644
--- a/www/manager6/panel/EditPruneInputPanel.js
+++ b/www/manager6/panel/EditPruneInputPanel.js
@@ -13,7 +13,7 @@ Ext.define('PVE.panel.EditPruneInputPanel', {
 	if (this.needMask) { // isMasked() may not yet be true if not rendered once
 	    return {};
 	} else if (this.isCreate && !this.rendered) {
-	    return { 'prune-backups': 'keep-all=1' };
+	    return this.keepAllDefaultForCreate ? { 'prune-backups': 'keep-all=1' } : {};
 	}
 	delete formValues.delete;
 	let retention = PVE.Parser.printPropertyString(formValues);
@@ -52,10 +52,10 @@ Ext.define('PVE.panel.EditPruneInputPanel', {
 		panel.mask(
 		    gettext('Backup content type not available for this storage.'),
 		);
-	    } else if (panel.isCreate) {
+	    } else if (panel.isCreate && panel.keepAllDefaultForCreate) {
 		panel.down('proxmoxcheckbox[name=keep-all]').setValue(true);
 	    }
-	    panel.down('component[name=pbs-hint]').setHidden(!panel.isPBS);
+	    panel.down('component[name=pbs-hint]').setHidden(!panel.showPBSHint);
 
 	    panel.query('pmxPruneKeepField').forEach(field => {
 		field.on('change', panel.updateComponents, panel);
@@ -83,7 +83,9 @@ Ext.define('PVE.panel.EditPruneInputPanel', {
 	    name: 'no-keeps-hint',
 	    hidden: true,
 	    padding: '5 1',
-	    html: gettext('Without any keep option, the node\'s vzdump.conf or `keep-all` is used as fallback for backup jobs'),
+	    cbind: {
+		html: '{fallbackHintHtml}',
+	    },
 	},
 	{
 	    xtype: 'component',
diff --git a/www/manager6/storage/Base.js b/www/manager6/storage/Base.js
index 862c981b..ffafc87e 100644
--- a/www/manager6/storage/Base.js
+++ b/www/manager6/storage/Base.js
@@ -100,7 +100,9 @@ Ext.define('PVE.storage.BaseEdit', {
 			xtype: 'pveEditPruneInputPanel',
 			title: gettext('Backup Retention'),
 			isCreate: me.isCreate,
-			isPBS: me.ipanel.isPBS,
+			keepAllDefaultForCreate: true,
+			showPBSHint: me.ipanel.isPBS,
+			fallbackHintHtml: gettext('Without any keep option, the node\'s vzdump.conf or `keep-all` is used as fallback for backup jobs'),
 		    },
 		],
 	    },
-- 
2.30.2





More information about the pve-devel mailing list