]> git.proxmox.com Git - proxmox-widget-toolkit.git/commitdiff
edit window: add submitUrl config
authorThomas Lamprecht <t.lamprecht@proxmox.com>
Sat, 21 Nov 2020 16:17:33 +0000 (17:17 +0100)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Sat, 21 Nov 2020 19:03:18 +0000 (20:03 +0100)
Helps for those cases where the id is in the API path itself.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
src/window/Edit.js

index f548196ba26ed4d095be5cbceaa4c66292077968..67ffdf5438be1325a9a787ac8da44df875ede229 100644 (file)
@@ -30,6 +30,10 @@ Ext.define('Proxmox.window.Edit', {
 
     backgroundDelay: 0,
 
+    // string or function, called as (url, values) - useful if the ID of the
+    // new object is part of the URL, or that URL differs from GET/PUT URL
+    submitUrl: Ext.identityFn,
+
     // needed for finding the reference to submitbutton
     // because we do not have a controller
     referenceHolder: true,
@@ -132,7 +136,9 @@ Ext.define('Proxmox.window.Edit', {
            values.background_delay = me.backgroundDelay;
        }
 
-       let url = me.url;
+       let url = Ext.isFunction(me.submitUrl)
+           ? me.submitUrl(me.url, values)
+           : me.submitUrl || me.url;
        if (me.method === 'DELETE') {
            url = url + "?" + Ext.Object.toQueryString(values);
            values = undefined;