]> git.proxmox.com Git - proxmox-widget-toolkit.git/commitdiff
edit window: url is optional if both loadUrl and submitUrl are set
authorThomas Lamprecht <t.lamprecht@proxmox.com>
Sat, 21 Nov 2020 18:42:57 +0000 (19:42 +0100)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Sat, 21 Nov 2020 19:03:18 +0000 (20:03 +0100)
but it cannot be the default identityFn in that case..

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

index 184020d8ac1ed0d7757e8d1fd3bbf76bcf16a107..e952362ae9b2a84466d82529ec2fb99bc3648fc6 100644 (file)
@@ -246,8 +246,12 @@ Ext.define('Proxmox.window.Edit', {
     initComponent: function() {
        let me = this;
 
-       if (!me.url) {
-           throw "no url specified";
+       if (!me.url && (
+               !me.submitUrl || !me.loadUrl || me.submitUrl === Ext.identityFn ||
+               me.loadUrl === Ext.identityFn
+           )
+       ) {
+           throw "neither 'url' nor both, submitUrl and loadUrl specified";
        }
 
        if (me.create) {throw "deprecated parameter, use isCreate";}
@@ -257,7 +261,7 @@ Ext.define('Proxmox.window.Edit', {
        me.items = undefined;
 
        me.formPanel = Ext.create('Ext.form.Panel', {
-           url: me.url,
+           url: me.url, // FIXME: not in 'form' class, safe to remove??
            method: me.method || 'PUT',
            trackResetOnLoad: true,
            bodyPadding: me.bodyPadding !== undefined ? me.bodyPadding : 10,