From: Fabian Ebner <f.ebner@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH v4 manager 3/3] fix #2745: ui: backup: allow specifying remove parameter for manual backup
Date: Tue, 6 Apr 2021 12:41:52 +0200 [thread overview]
Message-ID: <20210406104152.11014-3-f.ebner@proxmox.com> (raw)
In-Reply-To: <20210406104152.11014-1-f.ebner@proxmox.com>
and also show the retention options that will be used for a given storage. A
user with Datastore.AllocateSpace and VM.Backup can already remove backups from
the GUI manually, so it shouldn't be a problem if they can set the remove flag
when starting a manual backup in the GUI.
Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
---
No changes from v3.
www/manager6/window/Backup.js | 67 +++++++++++++++++++++++++++++++++--
1 file changed, 65 insertions(+), 2 deletions(-)
diff --git a/www/manager6/window/Backup.js b/www/manager6/window/Backup.js
index a6dc1798..886ef6f2 100644
--- a/www/manager6/window/Backup.js
+++ b/www/manager6/window/Backup.js
@@ -36,6 +36,39 @@ Ext.define('PVE.window.Backup', {
emptyText: Proxmox.Utils.noneText,
});
+ const keepNames = [
+ 'keep-last',
+ 'keep-hourly',
+ 'keep-daily',
+ 'keep-weekly',
+ 'keep-monthly',
+ 'keep-yearly',
+ ];
+
+ let pruneSettings = keepNames.map(
+ name => Ext.create('Ext.form.field.Display', {
+ name: name,
+ fieldLabel: gettext(name),
+ hidden: true,
+ disabled: true,
+ }),
+ );
+
+ let removeCheckbox = Ext.create('Proxmox.form.Checkbox', {
+ name: 'remove',
+ checked: false,
+ hidden: true,
+ uncheckedValue: 0,
+ fieldLabel: gettext('Prune'),
+ autoEl: {
+ tag: 'div',
+ 'data-qtip': gettext('Prune older backups afterwards'),
+ },
+ handler: function(checkbox, value) {
+ pruneSettings.forEach(field => field.setDisabled(!value));
+ },
+ });
+
let initialDefaults = false;
var storagesel = Ext.create('PVE.form.StorageSelector', {
@@ -74,6 +107,35 @@ Ext.define('PVE.window.Backup', {
}
initialDefaults = true;
+
+ // always update storage dependent properties
+ if (data['prune-backups'] !== undefined) {
+ const keepParams = PVE.Parser.parsePropertyString(
+ data["prune-backups"],
+ );
+ if (!keepParams['keep-all']) {
+ removeCheckbox.setHidden(false);
+ pruneSettings.forEach(function(field) {
+ const keep = keepParams[field.name];
+ if (keep) {
+ field.setValue(keep);
+ field.setHidden(false);
+ } else {
+ field.reset();
+ field.setHidden(true);
+ }
+ });
+ return;
+ }
+ }
+
+ // no defaults or keep-all=1
+ removeCheckbox.setHidden(true);
+ removeCheckbox.setValue(false);
+ pruneSettings.forEach(function(field) {
+ field.reset();
+ field.setHidden(true);
+ });
},
failure: function(response, opts) {
Ext.Msg.alert(gettext('Error'), response.htmlStatus);
@@ -96,7 +158,8 @@ Ext.define('PVE.window.Backup', {
modeSelector,
compressionSelector,
mailtoField,
- ],
+ removeCheckbox,
+ ].concat(pruneSettings),
});
var form = me.formPanel.getForm();
@@ -110,7 +173,7 @@ Ext.define('PVE.window.Backup', {
storage: storage,
vmid: me.vmid,
mode: values.mode,
- remove: 0,
+ remove: values.remove,
};
if (values.mailto) {
--
2.20.1
next prev parent reply other threads:[~2021-04-06 10:42 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-06 10:41 [pve-devel] [PATCH v4 manager 1/3] api: vzdump: add call to get currently configured vzdump defaults Fabian Ebner
2021-04-06 10:41 ` [pve-devel] [PATCH v4 manager 2/3] ui: backup: fill in some of the " Fabian Ebner
2021-05-03 13:02 ` [pve-devel] applied: " Thomas Lamprecht
2021-04-06 10:41 ` Fabian Ebner [this message]
2021-05-03 13:02 ` [pve-devel] applied: [PATCH v4 manager 1/3] api: vzdump: add call to get currently " Thomas Lamprecht
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210406104152.11014-3-f.ebner@proxmox.com \
--to=f.ebner@proxmox.com \
--cc=pve-devel@lists.proxmox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox