From: Thomas Lamprecht Date: Tue, 10 Jan 2023 11:32:35 +0000 (+0100) Subject: ui: config panel: ensure onlineHelp mapping targets are validated X-Git-Url: https://git.proxmox.com/?a=commitdiff_plain;h=8538f6f0b94d05ff5790303c98981cfc12438e92;hp=7f74dabc9e1e68b62d89d8c16a8de37f2c6f4f20;p=pve-manager.git ui: config panel: ensure onlineHelp mapping targets are validated 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 --- diff --git a/www/manager6/panel/ConfigPanel.js b/www/manager6/panel/ConfigPanel.js index 28d919f6..1b3c91f8 100644 --- a/www/manager6/panel/ConfigPanel.js +++ b/www/manager6/panel/ConfigPanel.js @@ -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) {