From ea18674638fc7b848cc9e21d66ed88fd9cab15e4 Mon Sep 17 00:00:00 2001 From: CyberMind-FR Date: Tue, 3 Feb 2026 11:51:50 +0100 Subject: [PATCH] fix(security-threats): Remove null rendering in dashboard LuCI's E() renders null array children as literal "null" text. Use concat with empty arrays instead of ternary-to-null for conditional peer/IOC table sections and top-level sections. Co-Authored-By: Claude Opus 4.5 --- .../secubox-security-threats/dashboard.js | 29 ++++++++----------- 1 file changed, 12 insertions(+), 17 deletions(-) diff --git a/package/secubox/luci-app-secubox-security-threats/htdocs/luci-static/resources/view/secubox-security-threats/dashboard.js b/package/secubox/luci-app-secubox-security-threats/htdocs/luci-static/resources/view/secubox-security-threats/dashboard.js index d91f8258..f2aad786 100644 --- a/package/secubox/luci-app-secubox-security-threats/htdocs/luci-static/resources/view/secubox-security-threats/dashboard.js +++ b/package/secubox/luci-app-secubox-security-threats/htdocs/luci-static/resources/view/secubox-security-threats/dashboard.js @@ -23,24 +23,16 @@ return L.view.extend({ poll.add(L.bind(function() { this.handleRefresh(); }, this), 15); - return E('div', { 'class': 'si-dash' }, [ + var sections = [ E('style', {}, this.getStyles()), - - // Status bar this.renderStatusBar(status), - - // Firewall stats this.renderFirewallStats(stats), - - // Mesh Intelligence this.renderMeshIntel(intel, meshIocs, meshPeers), - - // Threats table this.renderThreats(threats), - - // Blocked IPs (collapsed) this.renderBlocked(blocked) - ]); + ].filter(function(el) { return el != null; }); + + return E('div', { 'class': 'si-dash' }, sections); }, renderStatusBar: function(status) { @@ -142,8 +134,9 @@ return L.view.extend({ ) ]), + ].concat( // Peer table - peers.length > 0 ? + peers.length > 0 ? [ E('div', { 'class': 'si-subsection' }, [ E('h4', {}, 'Peer Contributors'), E('table', { 'class': 'table' }, [ @@ -163,10 +156,11 @@ return L.view.extend({ ]); }) )) - ]) : null, + ]) + ] : [], // Received IOCs table (show top 10) - iocs.length > 0 ? + iocs.length > 0 ? [ E('div', { 'class': 'si-subsection' }, [ E('h4', {}, 'Received IOCs (' + iocs.length + ')'), E('table', { 'class': 'table' }, [ @@ -190,8 +184,9 @@ return L.view.extend({ ]); }) )) - ]) : null - ]); + ]) + ] : [] + )); }, renderThreats: function(threats) {