[pbs-devel] applied: [PATCH widget-toolkit 1/1] edit window: add optional custom submit options

Thomas Lamprecht t.lamprecht at proxmox.com
Thu Mar 7 15:22:10 CET 2024


Am 06/03/2024 um 15:04 schrieb Dominik Csapak:
> 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 at proxmox.com>
> ---
>  src/window/Edit.js | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
> 

applied, thanks!

> @@ -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);

I thought about using the spread operator, i.e. something like:

Proxmox.Utils.API2Request({
   url: url,
   // and so on
   ...(me.submitOptions ?? {})
});

but it doesn't really has much advantage besides being more modern syntax,
which on it's own is not a good justification, so I ignored the itch to
adapt this ^^




More information about the pbs-devel mailing list