mirror of
https://git.proxmox.com/git/proxmox-widget-toolkit
synced 2025-06-25 08:54:08 +00:00
object grid: fix onlineHelp setting from editorConfig for row editors
In our row editors helpers, we unconditionally set onlineHelp from
'opts.onlineHelp', even if it's undefined.
Later we use 'Ext.apply' to set first the editorConfig defaults, then
the 'rowdef.editor' settings. In javascript, the objects
{} and
{ foo: undefined }
are not the same, so Ext.apply overwrites the default from editorConfig
with that from the row definition, also for undefined.
This means if we have a default onlineHelp in editorConfig and none in
the add_*_row options, we would not show it.
To fix it, check if 'opts.onlineHelp' is truthy before setting it in
the row definition. This should not happen for other options used
from the row helper options, since those are nested
(Ext.apply does not work recursively)
This fixes a regression in pmg-gui, where we set a default onlineHelp
for e.g. the Mail Proxy Options which would not show up anymore.
Note: PMG is the only product where we used this pattern, so this
was not visible anywhere in PVE or PBS.
Fixes: 7d16f8b
(object grid: allow to pass online help to row editors)
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
Reviewed-By: Stoiko Ivanov <s.ivanov@proxmox.com>
Tested-By: Stoiko Ivanov <s.ivanov@proxmox.com>
This commit is contained in:
parent
15a62419a1
commit
f6440d3ee1
@ -67,7 +67,6 @@ Ext.define('Proxmox.grid.ObjectGrid', {
|
||||
editor: {
|
||||
xtype: 'proxmoxWindowEdit',
|
||||
subject: text,
|
||||
onlineHelp: opts.onlineHelp,
|
||||
fieldDefaults: {
|
||||
labelWidth: opts.labelWidth || 100,
|
||||
},
|
||||
@ -84,6 +83,9 @@ Ext.define('Proxmox.grid.ObjectGrid', {
|
||||
},
|
||||
},
|
||||
};
|
||||
if (opts.onlineHelp) {
|
||||
me.rows[name].editor.onlineHelp = opts.onlineHelp;
|
||||
}
|
||||
},
|
||||
|
||||
add_text_row: function(name, text, opts) {
|
||||
@ -100,7 +102,6 @@ Ext.define('Proxmox.grid.ObjectGrid', {
|
||||
editor: {
|
||||
xtype: 'proxmoxWindowEdit',
|
||||
subject: text,
|
||||
onlineHelp: opts.onlineHelp,
|
||||
fieldDefaults: {
|
||||
labelWidth: opts.labelWidth || 100,
|
||||
},
|
||||
@ -115,6 +116,9 @@ Ext.define('Proxmox.grid.ObjectGrid', {
|
||||
},
|
||||
},
|
||||
};
|
||||
if (opts.onlineHelp) {
|
||||
me.rows[name].editor.onlineHelp = opts.onlineHelp;
|
||||
}
|
||||
},
|
||||
|
||||
add_boolean_row: function(name, text, opts) {
|
||||
@ -131,7 +135,6 @@ Ext.define('Proxmox.grid.ObjectGrid', {
|
||||
editor: {
|
||||
xtype: 'proxmoxWindowEdit',
|
||||
subject: text,
|
||||
onlineHelp: opts.onlineHelp,
|
||||
fieldDefaults: {
|
||||
labelWidth: opts.labelWidth || 100,
|
||||
},
|
||||
@ -147,6 +150,9 @@ Ext.define('Proxmox.grid.ObjectGrid', {
|
||||
},
|
||||
},
|
||||
};
|
||||
if (opts.onlineHelp) {
|
||||
me.rows[name].editor.onlineHelp = opts.onlineHelp;
|
||||
}
|
||||
},
|
||||
|
||||
add_integer_row: function(name, text, opts) {
|
||||
@ -163,7 +169,6 @@ Ext.define('Proxmox.grid.ObjectGrid', {
|
||||
editor: {
|
||||
xtype: 'proxmoxWindowEdit',
|
||||
subject: text,
|
||||
onlineHelp: opts.onlineHelp,
|
||||
fieldDefaults: {
|
||||
labelWidth: opts.labelWidth || 100,
|
||||
},
|
||||
@ -180,6 +185,9 @@ Ext.define('Proxmox.grid.ObjectGrid', {
|
||||
},
|
||||
},
|
||||
};
|
||||
if (opts.onlineHelp) {
|
||||
me.rows[name].editor.onlineHelp = opts.onlineHelp;
|
||||
}
|
||||
},
|
||||
|
||||
// adds a row that allows editing in a full TextArea that transparently de/encodes as Base64
|
||||
@ -198,7 +206,6 @@ Ext.define('Proxmox.grid.ObjectGrid', {
|
||||
editor: {
|
||||
xtype: 'proxmoxWindowEdit',
|
||||
subject: text,
|
||||
onlineHelp: opts.onlineHelp,
|
||||
fieldDefaults: {
|
||||
labelWidth: opts.labelWidth || 600,
|
||||
},
|
||||
@ -209,6 +216,9 @@ Ext.define('Proxmox.grid.ObjectGrid', {
|
||||
},
|
||||
},
|
||||
};
|
||||
if (opts.onlineHelp) {
|
||||
me.rows[name].editor.onlineHelp = opts.onlineHelp;
|
||||
}
|
||||
},
|
||||
|
||||
editorConfig: {}, // default config passed to editor
|
||||
|
Loading…
Reference in New Issue
Block a user