mirror of
https://git.proxmox.com/git/proxmox-widget-toolkit
synced 2025-05-03 04:53:26 +00:00
edit window: add extraParams config
For passing some default params which are passed along automatically when calling load and doing the submit. Useful in PBS, as there we often have the snapshot ID in multiple parameters, not included in the request path, required for various API call. The params take low precendence, and are overwritten by values in form fields with the same name for submit, or explicit params passed to load calls Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
parent
1289d32611
commit
9244bb7242
@ -7,6 +7,10 @@ Ext.define('Proxmox.window.Edit', {
|
||||
// set extra options like params for the load request
|
||||
autoLoadOptions: undefined,
|
||||
|
||||
// to submit extra params on load and submit, useful, e.g., if not all ID
|
||||
// parameters are included in the URL
|
||||
extraRequestParams: {},
|
||||
|
||||
resizable: false,
|
||||
|
||||
// use this to atimatically generate a title like `Create: <subject>`
|
||||
@ -62,6 +66,8 @@ Ext.define('Proxmox.window.Edit', {
|
||||
let me = this;
|
||||
|
||||
let values = {};
|
||||
Ext.apply(values, me.extraRequestParams);
|
||||
|
||||
let form = me.formPanel.getForm();
|
||||
|
||||
form.getFields().each(function(field) {
|
||||
@ -187,6 +193,12 @@ Ext.define('Proxmox.window.Edit', {
|
||||
waitMsgTarget: me,
|
||||
}, options);
|
||||
|
||||
if (Object.keys(me.extraRequestParams).length > 0) {
|
||||
let params = newopts.params || {};
|
||||
Ext.applyIf(params, me.extraRequestParams);
|
||||
newopts.params = params;
|
||||
}
|
||||
|
||||
let createWrapper = function(successFn) {
|
||||
Ext.apply(newopts, {
|
||||
url: me.url,
|
||||
|
Loading…
Reference in New Issue
Block a user