ui: prune edit: prepare for being re-used for backup jobs

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@proxmox.com>
This commit is contained in:
Fabian Ebner
2021-09-06 13:32:28 +02:00
committed by Thomas Lamprecht
parent d1ec698659
commit ae361a8632
2 changed files with 9 additions and 5 deletions

View File

@ -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',

View File

@ -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'),
},
],
},