// Config Manager - Main orchestrator for modular config system if (typeof window.ConfigManager === 'undefined') { //console.log('ConfigManager: Defining new ConfigManager class...'); class ConfigManager { constructor() { this.core = new ConfigCore(); this.domainManager = new DomainManager(); this.whitelistManager = new IPWhitelistManager(); this.renderer = new ConfigRenderer(); this.sidebar = new ConfigSidebar(); this.form = new ConfigForm(); this.utils = new ConfigUtils(); // Expose IPWhitelistManager globally for wrapper functions window.IPWhitelistManager = this.whitelistManager; } async renderConfig(category) { //console.log('ConfigManager: Rendering ' + category + ' config...'); const configSection = document.getElementById('config-section'); if (!configSection) { console.error('ConfigManager: config-section element not found'); return; } // The sidebar and page headers read window.configData. Load it up front so // populateSidebar() has categories on a cold admin visit (e.g. straight // from the dashboard); otherwise the overview/tools branches below render // an empty sidebar until something else populates configData. Cached after // the first call, so the config-category path below is a cache hit. try { await this.core.loadConfig(category); } catch (e) {} // Overview is the Admin landing — an ops/health board, not a config form. if (category === 'overview') { try { this.sidebar.populateSidebar(); } catch (e) {} if (typeof AdminOverview !== 'undefined') { window.adminOverview = new AdminOverview('config-section'); await window.adminOverview.init(); } else { configSection.innerHTML = '
No configuration items found for this category.
These options are for advanced users and may affect system stability
' + catDesc + '
' : '') + 'Failed to load configuration: ' + error.message + '