From 4d07ee6cb99e2ad3938adabc8e3234623351046b Mon Sep 17 00:00:00 2001 From: Thomas Lamprecht Date: Sat, 21 Nov 2020 17:17:33 +0100 Subject: [PATCH] edit window: add submitUrl config Helps for those cases where the id is in the API path itself. Signed-off-by: Thomas Lamprecht --- src/window/Edit.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/window/Edit.js b/src/window/Edit.js index f548196..67ffdf5 100644 --- a/src/window/Edit.js +++ b/src/window/Edit.js @@ -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;