From: "Dominic Jäger" <d.jaeger@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH manager v2] storage: base edit: Use the GUI keep-all default value
Date: Wed, 25 Nov 2020 14:42:25 +0100 [thread overview]
Message-ID: <20201125134225.30516-1-d.jaeger@proxmox.com> (raw)
... if the user hasn't seen the prune panel yet.
The GUI has as default value a ticked keep-all checkbox => keep-all=1.
Previously we sent nothing in this case which led to the no-keeps default of
keep-last=1.
Signed-off-by: Dominic Jäger <d.jaeger@proxmox.com>
---
v2: Move the keep-all=1 default up
@Thomas: Or did you mean to keep only that part that I now moved up? I can try to find a nicer way
tomorrow.
www/manager6/storage/Base.js | 26 +++++++++++++++++---------
1 file changed, 17 insertions(+), 9 deletions(-)
diff --git a/www/manager6/storage/Base.js b/www/manager6/storage/Base.js
index 70e18a81..e8a76fe0 100644
--- a/www/manager6/storage/Base.js
+++ b/www/manager6/storage/Base.js
@@ -65,23 +65,31 @@ Ext.define('PVE.panel.StoragePruneInputPanel', {
keepLastEmptyText: gettext('1'),
onGetValues: function(formValues) {
+ let checkbox = this.down('proxmoxcheckbox[name=keep-all]');
if (this.needMask) { // isMasked() may not yet be true if not rendered once
return {};
+ } else if (this.isCreate && !checkbox.rendered) {
+ // User has not seen the checkbox yet => Use default
+ // keep-all has no value yet => Hardcoded
+ return { 'prune-backups': 'keep-all=1' };
}
delete formValues.delete;
- let retention = PVE.Parser.printPropertyString(formValues)
+ let retention = PVE.Parser.printPropertyString(formValues);
+ let options = { };
if (retention === '') {
- if (this.isCreate) {
- return {};
+ if (!this.isCreate) {
+ options.delete = 'prune-backups';
}
- // always delete old 'maxfiles' on edit, we map it to keep-last on window load
- return {
- delete: ['prune-backups','maxfiles'],
- };
+ } else {
+ options['prune-backups'] = retention;
}
- let options = { 'prune-backups': retention };
+ // always delete old 'maxfiles' on edit, we map it to keep-last on window load
if (!this.isCreate) {
- options.delete = 'maxfiles';
+ if (options.delete) {
+ options.delete = [options.delete].concat('maxfiles');
+ } else {
+ options.delete = 'maxfiles';
+ }
}
return options;
},
--
2.20.1
next reply other threads:[~2020-11-25 13:42 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-25 13:42 Dominic Jäger [this message]
2020-11-25 13:51 ` 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=20201125134225.30516-1-d.jaeger@proxmox.com \
--to=d.jaeger@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