]> git.proxmox.com Git - proxmox-widget-toolkit.git/commitdiff
edit window: add optional custom submit options
authorDominik Csapak <d.csapak@proxmox.com>
Wed, 6 Mar 2024 14:04:24 +0000 (15:04 +0100)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Thu, 7 Mar 2024 14:08:34 +0000 (15:08 +0100)
sometimes it's necessary or handy to add custom options to the submit
api call (e.g. timeout). So just expose a `submitOptions` where users
of the edit window can put their custom options.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
src/window/Edit.js

index 7f94e3096eda4da635f5af02d572f7dc98bb3245..d4a2b551c729f78d3fa08a04594640d7ea0ef943 100644 (file)
@@ -31,6 +31,9 @@ Ext.define('Proxmox.window.Edit', {
     // custom submitText
     submitText: undefined,
 
+    // custom options for the submit api call
+    submitOptions: {},
+
     backgroundDelay: 0,
 
     // string or function, called as (url, values) - useful if the ID of the
@@ -151,7 +154,7 @@ Ext.define('Proxmox.window.Edit', {
            values = undefined;
        }
 
-       Proxmox.Utils.API2Request({
+       let requestOptions = Ext.apply({
            url: url,
            waitMsgTarget: me,
            method: me.method || (me.backgroundDelay ? 'POST' : 'PUT'),
@@ -191,7 +194,8 @@ Ext.define('Proxmox.window.Edit', {
                    me.close();
                }
            },
-       });
+       }, me.submitOptions ?? {});
+       Proxmox.Utils.API2Request(requestOptions);
     },
 
     load: function(options) {