[pve-devel] [PATCH manager 3/9] add a helpbutton to the toolbar of the configpanel

Dominik Csapak d.csapak at proxmox.com
Tue Sep 13 13:46:10 CEST 2016


this adds a contextual help button to the action
toolbar on the far right.

now the subclasses of pvePanelConfig have to have
a property 'onlineHelp', which is a relative link
to the relevant documentation

if no link is given, we output 'No Help available'.

For the folder view, we have a switch statement,
because these are dynamically created and simply
from type pvePanelConfig

if an option has the property onlineHelp, this link
will be set when selecting it, so that
you have a contextual help button for the options
(e.g. directly to the backup documentation on the 'Backup' entry)

if an option does not have this property, it defaults
to the pvePanelConfig property

Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
 www/manager6/panel/ConfigPanel.js | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/www/manager6/panel/ConfigPanel.js b/www/manager6/panel/ConfigPanel.js
index a5279d8..7e7a773 100644
--- a/www/manager6/panel/ConfigPanel.js
+++ b/www/manager6/panel/ConfigPanel.js
@@ -113,6 +113,7 @@ Ext.define('PVE.panel.Config', {
 	if (me.savedItems[cardid]) {
 	    var curcard = me.getLayout().getActiveItem();
 	    var newcard = me.add(me.savedItems[cardid]);
+	    me.helpButton.onlineHelp = newcard.onlineHelp || me.onlineHelp;
 	    if (curcard) {
 		me.setActiveItem(cardid);
 		me.remove(curcard, true);
@@ -157,6 +158,16 @@ Ext.define('PVE.panel.Config', {
 	var tbar = me.tbar || [];
 	me.tbar = undefined;
 
+	if (!me.onlineHelp) {
+	    switch(me.pveSelNode.data.id) {
+		case 'type/storage':me.onlineHelp = 'chapter-pvesm.html'; break;
+		case 'type/qemu':me.onlineHelp = 'chapter-qm.html'; break;
+		case 'type/lxc':me.onlineHelp = 'chapter-pct.html'; break;
+		case 'type/pool':me.onlineHelp = 'chapter-pveum.html#_pools'; break;
+		case 'type/node':me.onlineHelp = 'chapter-sysadmin.html'; break;
+	    }
+	}
+
 	tbar.unshift('->');
 	tbar.unshift({
 	    xtype: 'tbtext',
@@ -164,6 +175,14 @@ Ext.define('PVE.panel.Config', {
 	    baseCls: 'x-panel-header-text'
 	});
 
+	me.helpButton = Ext.create('PVE.button.Help', {
+	    hidden: false,
+	    listenToGlobalEvent: false,
+	    onlineHelp: me.onlineHelp || undefined
+	});
+
+	tbar.push(me.helpButton);
+
 	me.dockedItems[1].items = tbar;
 
 	// include search tab
-- 
2.1.4




More information about the pve-devel mailing list