]> git.proxmox.com Git - pve-manager.git/commitdiff
ui: config panel: ensure onlineHelp mapping targets are validated
authorThomas Lamprecht <t.lamprecht@proxmox.com>
Tue, 10 Jan 2023 11:32:35 +0000 (12:32 +0100)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Tue, 10 Jan 2023 11:32:41 +0000 (12:32 +0100)
our onlineHelp linter is pretty dumb and scans for used help
references heuristically, so add a small indirection to the mapping
of resource tree type to onlineHelp so that it detects those
references and thus enforces that they exists in pve-docs.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
www/manager6/panel/ConfigPanel.js

index 28d919f6aa0a8f1fc44bed9cae6e342f528329a6..1b3c91f8ddc2a3e4097d35cdd856c471fea916a1 100644 (file)
@@ -176,15 +176,16 @@ Ext.define('PVE.panel.Config', {
        me.tbar = undefined;
 
        if (!me.onlineHelp) {
+           // use the onlineHelp property indirection to enforce checking reference validity
            let typeToOnlineHelp = {
-               'type/lxc': 'chapter_pct',
-               'type/node': 'chapter_system_administration',
-               'type/pool': 'pveum_pools',
-               'type/qemu': 'chapter_virtual_machines',
-               'type/sdn': 'chapter_pvesdn',
-               'type/storage': 'chapter_storage',
+               'type/lxc': { onlineHelp: 'chapter_pct' },
+               'type/node': { onlineHelp: 'chapter_system_administration' },
+               'type/pool': { onlineHelp: 'pveum_pools' },
+               'type/qemu': { onlineHelp: 'chapter_virtual_machines' },
+               'type/sdn': { onlineHelp: 'chapter_pvesdn' },
+               'type/storage': { onlineHelp: 'chapter_storage' },
            };
-           me.onlineHelp = typeToOnlineHelp[me.pveSelNode.data.id];
+           me.onlineHelp = typeToOnlineHelp[me.pveSelNode.data.id]?.onlineHelp;
        }
 
        if (me.tbarSpacing) {