]> git.proxmox.com Git - proxmox-backup.git/commitdiff
ui: prune: fix sending invalid parameters
authorDominik Csapak <d.csapak@proxmox.com>
Wed, 6 Mar 2024 11:21:02 +0000 (12:21 +0100)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Thu, 7 Mar 2024 09:30:40 +0000 (10:30 +0100)
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
www/panel/PrunePanel.js
www/window/PruneJobEdit.js

index 87317ec1d4d2eb5419d7584a7f6fdcbe9f989db7..fa0b7d2c77fe1fda3e0c468f7c00157ed4dda4c3 100644 (file)
@@ -479,6 +479,7 @@ Ext.define('PBS.DataStoreContent', {
                        ns,
                        dryrun: true,
                        canRecurse: true,
+                       isCreate: true,
                    },
                ],
            });
index 59c28a8e88da5229b52273763e58fc1a33bf4557..7ccdb1dee044e074559b8d82826861c879983712 100644 (file)
@@ -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;
index b2259bb9a31ee951e41e179170a62fa59ee62be1..b804fdb412e398cd5758d2f466a0939028907330 100644 (file)
@@ -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
            },
            {