From: Dominik Csapak <d.csapak@proxmox.com>
To: pbs-devel@lists.proxmox.com
Subject: [pbs-devel] [PATCH proxmox-backup 4/6] ui: prune: fix sending invalid parameters
Date: Wed, 6 Mar 2024 12:21:02 +0100 [thread overview]
Message-ID: <20240306112104.2486728-6-d.csapak@proxmox.com> (raw)
In-Reply-To: <20240306112104.2486728-1-d.csapak@proxmox.com>
the prune input panel is used in various contexts (add/editing a
prunejob, adding a datastore, executing a prune). These different api
calls don't all take the same parameters, so we have to correctly set
the `isCreate` to not send a `delete` paramter for those request if
there was an empty field.
Also set 'max-depth:0' only when recursive was not set *and* we can
set 'recursive', because for creating a datastore that is not supported
by the api, and for the prune job editing we override the whole
onGetValues anyway so that's not an issue there.
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
www/datastore/Content.js | 1 +
www/panel/PrunePanel.js | 2 +-
www/window/PruneJobEdit.js | 7 ++++++-
3 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/www/datastore/Content.js b/www/datastore/Content.js
index 87317ec1..fa0b7d2c 100644
--- a/www/datastore/Content.js
+++ b/www/datastore/Content.js
@@ -479,6 +479,7 @@ Ext.define('PBS.DataStoreContent', {
ns,
dryrun: true,
canRecurse: true,
+ isCreate: true,
},
],
});
diff --git a/www/panel/PrunePanel.js b/www/panel/PrunePanel.js
index 59c28a8e..7ccdb1de 100644
--- a/www/panel/PrunePanel.js
+++ b/www/panel/PrunePanel.js
@@ -27,7 +27,7 @@ Ext.define('PBS.panel.PruneInputPanel', {
if (me.ns && me.ns !== '') {
values.ns = me.ns;
}
- if (!values.recursive) {
+ if (!values.recursive && me.canRecurse) {
values['max-depth'] = 0;
}
delete values.recursive;
diff --git a/www/window/PruneJobEdit.js b/www/window/PruneJobEdit.js
index b2259bb9..b804fdb4 100644
--- a/www/window/PruneJobEdit.js
+++ b/www/window/PruneJobEdit.js
@@ -105,7 +105,9 @@ Ext.define('PBS.window.PruneJobEdit', {
xtype: 'pbsNamespaceMaxDepthReduced',
name: 'max-depth',
fieldLabel: gettext('Max. Depth'),
- deleteEmpty: true,
+ cbind: {
+ deleteEmpty: '{!isCreate}',
+ },
},
],
@@ -133,6 +135,9 @@ Ext.define('PBS.window.PruneJobEdit', {
columnB: [
{
xtype: 'pbsPruneInputPanel',
+ cbind: {
+ isCreate: '{isCreate}',
+ },
getValues: () => ({}), // let that handle our inputpanel here
},
{
--
2.39.2
next prev parent reply other threads:[~2024-03-06 11:21 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-06 11:20 [pbs-devel] [PATCH widget-toolkit/proxmox-backup] adapt to stricter api parameter checks Dominik Csapak
2024-03-06 11:20 ` [pbs-devel] [PATCH widget-toolkit 1/1] realms: don't send type and delete on creation Dominik Csapak
2024-03-06 11:20 ` [pbs-devel] [PATCH proxmox-backup 1/6] ui: prune job edit: indent fix Dominik Csapak
2024-03-06 11:21 ` [pbs-devel] [PATCH proxmox-backup 2/6] ui: metrics: don't send digest when creating a new influxdbupd host Dominik Csapak
2024-03-06 11:21 ` [pbs-devel] [PATCH proxmox-backup 3/6] ui: tape backup job: don't send delete value on creation Dominik Csapak
2024-03-06 11:21 ` Dominik Csapak [this message]
2024-03-06 11:21 ` [pbs-devel] [PATCH proxmox-backup 5/6] ui: sync " Dominik Csapak
2024-03-06 11:21 ` [pbs-devel] [PATCH proxmox-backup 6/6] ui: verify " Dominik Csapak
2024-03-07 9:32 ` [pbs-devel] applied-series: [PATCH widget-toolkit/proxmox-backup] adapt to stricter api parameter checks 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=20240306112104.2486728-6-d.csapak@proxmox.com \
--to=d.csapak@proxmox.com \
--cc=pbs-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