]> git.proxmox.com Git - pve-manager.git/commitdiff
add a helpbutton to the toolbar of the configpanel
authorDominik Csapak <d.csapak@proxmox.com>
Tue, 13 Sep 2016 11:46:10 +0000 (13:46 +0200)
committerDietmar Maurer <dietmar@proxmox.com>
Tue, 13 Sep 2016 14:40:43 +0000 (16:40 +0200)
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@proxmox.com>
www/manager6/panel/ConfigPanel.js

index a5279d825c80f8abde18ab503571e2559ab0729f..7e7a77384b94dab365786090aca2f910fb0acd6e 100644 (file)
@@ -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