HelpButton: be backward compatible with PVE help mapping

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>
This commit is contained in:
Thomas Lamprecht 2017-12-11 11:18:14 +01:00 committed by Dominik Csapak
parent 6689e1cedd
commit 0e029e08ef

View 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;
}