]> git.proxmox.com Git - proxmox-widget-toolkit.git/commitdiff
HelpButton: be backward compatible with PVE help mapping
authorThomas Lamprecht <t.lamprecht@proxmox.com>
Mon, 11 Dec 2017 10:18:14 +0000 (11:18 +0100)
committerDominik Csapak <d.csapak@proxmox.com>
Thu, 14 Dec 2017 14:38:50 +0000 (15:38 +0100)
pve-doc-generator used pveOnlineHelp as variable name while the
widget toolkit expects proxmoxOnlineHelp, allow both for now.

As its not quite clear when the switch to the widget toolkit happens
this is more flexible than changing the generator and adding a
versioned build dependency in pve-manager for it.
We normally do not bump pve-docs during releases either.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
CC: Dominik Csapak <d.csapak@proxmox.com>
button/HelpButton.js

index dcb6f6e1ee3de5c05d584636dd364eb2878b6393..1bf3f32a0426f38ea66b549ff9556ea551a76451 100644 (file)
@@ -41,11 +41,25 @@ Ext.define('Proxmox.button.Help', {
        }
     },
 
+    getOnlineHelpInfo: function (ref) {
+       var helpMap;
+       if (typeof proxmoxOnlineHelpInfo !== 'undefined') {
+           helpMap = proxmoxOnlineHelpInfo;
+       } else if (typeof pveOnlineHelpInfo !== 'undefined') {
+           // be backward compatible with older pve-doc-generators
+           helpMap = pveOnlineHelpInfo;
+       } else {
+           throw "no global OnlineHelpInfo map declared";
+       }
+
+       return helpMap[ref];
+    },
+
     // this sets the link and the tooltip text
     setOnlineHelp:function(blockid) {
        var me = this;
 
-       var info = proxmoxOnlineHelpInfo[blockid];
+       var info = me.getOnlineHelpInfo(blockid);
        if (info) {
            me.onlineHelp = blockid;
            var title = info.title;
@@ -67,7 +81,7 @@ Ext.define('Proxmox.button.Help', {
        var docsURI;
 
        if (me.onlineHelp) {
-           var info = proxmoxOnlineHelpInfo[me.onlineHelp];
+           var info = me.getOnlineHelpInfo(me.onlineHelp);
            if (info) {
                docsURI = window.location.origin + info.link;
            }