]> git.proxmox.com Git - proxmox-widget-toolkit.git/blobdiff - button/HelpButton.js
use eslint and execute as check target
[proxmox-widget-toolkit.git] / button / HelpButton.js
index dcb6f6e1ee3de5c05d584636dd364eb2878b6393..d97a6c4fb72bca8203f4c685696a384b8a000859 100644 (file)
@@ -1,9 +1,6 @@
 /* help button pointing to an online documentation
    for components contained in a modal window
 */
-/*global
-  proxmoxOnlineHelpInfo
-*/
 Ext.define('Proxmox.button.Help', {
     extend: 'Ext.button.Button',
     xtype: 'proxmoxHelpButton',
@@ -23,32 +20,32 @@ Ext.define('Proxmox.button.Help', {
        listen: {
            global: {
                proxmoxShowHelp: 'onProxmoxShowHelp',
-               proxmoxHideHelp: 'onProxmoxHideHelp'
-           }
+               proxmoxHideHelp: 'onProxmoxHideHelp',
+           },
        },
        onProxmoxShowHelp: function(helpLink) {
-           var me = this.getView();
-           if (me.listenToGlobalEvent === true) {
-               me.setOnlineHelp(helpLink);
-               me.show();
+           let view = this.getView();
+           if (view.listenToGlobalEvent === true) {
+               view.setOnlineHelp(helpLink);
+               view.show();
            }
        },
        onProxmoxHideHelp: function() {
-           var me = this.getView();
-           if (me.listenToGlobalEvent === true) {
-               me.hide();
+           let view = this.getView();
+           if (view.listenToGlobalEvent === true) {
+               view.hide();
            }
-       }
+       },
     },
 
     // this sets the link and the tooltip text
-    setOnlineHelp:function(blockid) {
-       var me = this;
+    setOnlineHelp: function(blockid) {
+       let me = this;
 
-       var info = proxmoxOnlineHelpInfo[blockid];
+       let info = Proxmox.Utils.get_help_info(blockid);
        if (info) {
            me.onlineHelp = blockid;
-           var title = info.title;
+           let title = info.title;
            if (info.subtitle) {
                title += ' - ' + info.subtitle;
            }
@@ -58,19 +55,16 @@ Ext.define('Proxmox.button.Help', {
 
     // helper to set the onlineHelp via a config object
     setHelpConfig: function(config) {
-       var me = this;
+       let me = this;
        me.setOnlineHelp(config.onlineHelp);
     },
 
     handler: function() {
-       var me = this;
-       var docsURI;
+       let me = this;
+       let docsURI;
 
        if (me.onlineHelp) {
-           var info = proxmoxOnlineHelpInfo[me.onlineHelp];
-           if (info) {
-               docsURI = window.location.origin + info.link;
-           }
+           docsURI = Proxmox.Utils.get_help_link(me.onlineHelp);
        }
 
        if (docsURI) {
@@ -81,13 +75,12 @@ Ext.define('Proxmox.button.Help', {
     },
 
     initComponent: function() {
-       /*jslint confusion: true */
-       var me = this;
+       let me = this;
 
        me.callParent();
 
-       if  (me.onlineHelp) {
+       if (me.onlineHelp) {
            me.setOnlineHelp(me.onlineHelp); // set tooltip
        }
-    }
+    },
 });