[pve-devel] [PATCH manager v2 1/2] ui: pveWindowEdit: allow sane onlineHelp specification for edit windows

Thomas Lamprecht t.lamprecht at proxmox.com
Thu Oct 19 08:20:12 CEST 2017


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 <t.lamprecht at proxmox.com>
---

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




More information about the pve-devel mailing list