secubox-openwrt/package/secubox/luci-app-crowdsec-dashboard/htdocs/luci-static/resources/crowdsec-dashboard/nav.js
CyberMind-FR c5e22fd08d refactor(nav): Unify navigation component with auto-theme initialization
SecuNav.renderTabs() now automatically initializes theme and loads CSS,
eliminating boilerplate from views. Added renderCompactTabs() for nested
modules and renderBreadcrumb() for back-navigation.

Updated module navs: cdn-cache, client-guardian, crowdsec-dashboard,
media-flow, mqtt-bridge, system-hub. Removed ~1000 lines of duplicate CSS.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-05 03:42:32 +01:00

38 lines
1.2 KiB
JavaScript

'use strict';
'require baseclass';
'require secubox/nav as SecuNav';
/**
* CrowdSec Dashboard Navigation
* Uses SecuNav.renderCompactTabs() for consistent styling
*/
var tabs = [
{ id: 'overview', icon: '📊', label: _('Overview'), path: ['admin', 'secubox', 'security', 'crowdsec', 'overview'] },
{ id: 'decisions', icon: '⛔', label: _('Decisions'), path: ['admin', 'secubox', 'security', 'crowdsec', 'decisions'] },
{ id: 'alerts', icon: '⚠️', label: _('Alerts'), path: ['admin', 'secubox', 'security', 'crowdsec', 'alerts'] },
{ id: 'bouncers', icon: '🛡️', label: _('Bouncers'), path: ['admin', 'secubox', 'security', 'crowdsec', 'bouncers'] },
{ id: 'setup', icon: '⚙️', label: _('Setup'), path: ['admin', 'secubox', 'security', 'crowdsec', 'setup'] }
];
return baseclass.extend({
getTabs: function() {
return tabs.slice();
},
/**
* Render CrowdSec navigation tabs
* Delegates to SecuNav.renderCompactTabs() for consistent styling
*/
renderTabs: function(active) {
return SecuNav.renderCompactTabs(active, this.getTabs(), { className: 'cs-nav-tabs' });
},
/**
* Render breadcrumb back to SecuBox
*/
renderBreadcrumb: function() {
return SecuNav.renderBreadcrumb(_('CrowdSec'), '🛡️');
}
});