instead of heuristically choosing the onlineHelp entry from our first
item prefer the one we have in our config, if noone the fallback to
the old heuristic.

Signed-off-by: Thomas Lamprecht <[email protected]>
---

changes v1 -> v2:
* add a param config entry on top, to document the old and new
  behavior

 www/manager6/window/Edit.js | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/www/manager6/window/Edit.js b/www/manager6/window/Edit.js
index 9a026683..b840dbaa 100644
--- a/www/manager6/window/Edit.js
+++ b/www/manager6/window/Edit.js
@@ -30,6 +30,11 @@ Ext.define('PVE.window.Edit', {
 
     showProgress: false,
 
+    // assign a reference from pve-docs, to add a help button docked to the
+    // bottom of the window. If undefined we magically fall back to the
+    // onlineHelp of our first item, if set.
+    onlineHelp: undefined,
+
     isValid: function() {
        var me = this;
 
@@ -272,10 +277,11 @@ Ext.define('PVE.window.Edit', {
                me.buttons = [ submitBtn, resetBtn ];
        }
 
-       if (items[0].onlineHelp) {
+       var onlineHelp = me.onlineHelp || items[0].onlineHelp;
+       if (onlineHelp) {
            var helpButton = Ext.create('PVE.button.Help');
            me.buttons.unshift(helpButton, '->');
-           Ext.GlobalEvents.fireEvent('pveShowHelp', items[0].onlineHelp);
+           Ext.GlobalEvents.fireEvent('pveShowHelp', onlineHelp);
        }
 
        Ext.applyIf(me, {
-- 
2.11.0


_______________________________________________
pve-devel mailing list
[email protected]
https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel

Reply via email to