From: Fabian Ebner <f.ebner@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH v5 manager 6/6] fix #2745: ui: backup window: allow specifying remove parameter for manual backup
Date: Thu, 6 May 2021 14:16:32 +0200 [thread overview]
Message-ID: <20210506121632.8417-7-f.ebner@proxmox.com> (raw)
In-Reply-To: <20210506121632.8417-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>
---
Changes from v4:
* Don't use gettext on a variable and use 'Keep Last' instead of
'keep-last', etc. as labels.
* Only show retention settings when the prune checkbox is set.
* Do not hide zero/undefined retention options, now that there's more space
with the two-column layout.
* Use labelWidth 110 for retention options, so German (and maybe other)
translations of labels do not wrap
www/manager6/window/Backup.js | 92 ++++++++++++++++++++++++++++++++++-
1 file changed, 91 insertions(+), 1 deletion(-)
diff --git a/www/manager6/window/Backup.js b/www/manager6/window/Backup.js
index a1e34674..7048c366 100644
--- a/www/manager6/window/Backup.js
+++ b/www/manager6/window/Backup.js
@@ -36,6 +36,38 @@ Ext.define('PVE.window.Backup', {
emptyText: Proxmox.Utils.noneText,
});
+ const keepNames = [
+ ['keep-last', gettext('Keep Last')],
+ ['keep-hourly', gettext('Keep Hourly')],
+ ['keep-daily', gettext('Keep Daily')],
+ ['keep-weekly', gettext('Keep Weekly')],
+ ['keep-monthly', gettext('Keep Monthly')],
+ ['keep-yearly', gettext('Keep Yearly')],
+ ];
+
+ let pruneSettings = keepNames.map(
+ name => Ext.create('Ext.form.field.Display', {
+ name: name[0],
+ fieldLabel: name[1],
+ hidden: 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.setHidden(!value));
+ },
+ });
+
let initialDefaults = false;
var storagesel = Ext.create('PVE.form.StorageSelector', {
@@ -82,6 +114,30 @@ 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);
+ } else {
+ field.reset();
+ }
+ });
+ return;
+ }
+ }
+
+ // no defaults or keep-all=1
+ removeCheckbox.setHidden(true);
+ removeCheckbox.setValue(false);
+ pruneSettings.forEach(field => field.reset());
},
failure: function(response, opts) {
initialDefaults = true;
@@ -98,11 +154,45 @@ Ext.define('PVE.window.Backup', {
column1: [
storagesel,
modeSelector,
+ removeCheckbox,
],
column2: [
compressionSelector,
mailtoField,
],
+ columnB: [{
+ layout: 'hbox',
+ border: false,
+ defaults: {
+ border: false,
+ layout: 'anchor',
+ flex: 1,
+ },
+ items: [
+ {
+ padding: '0 10 0 0',
+ defaults: {
+ labelWidth: 110,
+ },
+ items: [
+ pruneSettings[0],
+ pruneSettings[2],
+ pruneSettings[4],
+ ],
+ },
+ {
+ padding: '0 0 0 10',
+ defaults: {
+ labelWidth: 110,
+ },
+ items: [
+ pruneSettings[1],
+ pruneSettings[3],
+ pruneSettings[5],
+ ],
+ },
+ ],
+ }],
});
var submitBtn = Ext.create('Ext.Button', {
@@ -114,7 +204,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-05-06 12:17 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-06 12:16 [pve-devel] [PATCH-SERIES v5 manager] fix #2745: " Fabian Ebner
2021-05-06 12:16 ` [pve-devel] [PATCH v5 manager 1/6] ui: backup window: avoid issuing API call with null/empty parameter Fabian Ebner
2021-05-06 12:16 ` [pve-devel] [PATCH v5 manager 2/6] ui: backup window: also set initialDefaults variable in failure case Fabian Ebner
2021-05-06 12:16 ` [pve-devel] [PATCH v5 manager 3/6] ui: backup window: set loading mask early enough Fabian Ebner
2021-05-06 12:16 ` [pve-devel] [PATCH v5 manager 4/6] ui: backup window: switch to proxmox input panel Fabian Ebner
2021-05-06 12:16 ` [pve-devel] [PATCH v5 manager 5/6] ui: backup window: switch to two-column layout Fabian Ebner
2021-05-06 12:16 ` Fabian Ebner [this message]
2021-05-07 6:56 ` [pve-devel] [PATCH v5 manager 7/7] ui: backup window: also reset removal fields when defaults API call fails Fabian Ebner
2021-06-17 16:00 ` [pve-devel] applied-series: [PATCH-SERIES v5 manager] fix #2745: allow specifying remove parameter for manual backup 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=20210506121632.8417-7-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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal