From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by lists.proxmox.com (Postfix) with ESMTPS id A8EEC97CBF for ; Wed, 6 Mar 2024 12:21:07 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 9042C15FA4 for ; Wed, 6 Mar 2024 12:21:07 +0100 (CET) Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com [94.136.29.106]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by firstgate.proxmox.com (Proxmox) with ESMTPS for ; Wed, 6 Mar 2024 12:21:07 +0100 (CET) Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1]) by proxmox-new.maurer-it.com (Proxmox) with ESMTP id 5DB6448845 for ; Wed, 6 Mar 2024 12:21:06 +0100 (CET) From: Dominik Csapak To: pbs-devel@lists.proxmox.com Date: Wed, 6 Mar 2024 12:21:02 +0100 Message-Id: <20240306112104.2486728-6-d.csapak@proxmox.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240306112104.2486728-1-d.csapak@proxmox.com> References: <20240306112104.2486728-1-d.csapak@proxmox.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL 0.019 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record T_SCC_BODY_TEXT_LINE -0.01 - Subject: [pbs-devel] [PATCH proxmox-backup 4/6] ui: prune: fix sending invalid parameters X-BeenThere: pbs-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox Backup Server development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Mar 2024 11:21:07 -0000 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 --- 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