(scanId, scan)
| 19144 | updateDashboardStatus(data); |
| 19145 | await refreshDashboardStatsForCurrentSelection({ forceRefresh: true, fallbackData: data }); |
| 19146 | } catch (error) { |
| 19147 | console.error('Error refreshing dashboard:', error); |
| 19148 | } |
| 19149 | } |
| 19150 | |
| 19151 | function updateDashboardStatus(data) { |
| 19152 | refreshDashboardStatsForCurrentSelection({ fallbackData: data }).catch(() => { |
| 19153 | updateDashboardStats(data); |
| 19154 | }); |
| 19155 | |
| 19156 | // Update status - use the actual e-paper display text |
| 19157 | updateElement('Ragnar-status', data.ragnar_status || 'IDLE'); |
| 19158 | updateElement('Ragnar-says', (data.ragnar_says || 'Hacking away...')); |
| 19159 | |
| 19160 | // Update mode and handle manual controls |
| 19161 | const automationEnabled = typeof data.automation_enabled === 'boolean' ? data.automation_enabled : !Boolean(data.manual_mode); |
| 19162 | const isManualMode = Boolean(data.manual_mode); |
| 19163 | |
| 19164 | let modeLabel = 'Auto'; |
| 19165 | let modeClass = 'text-green-400 font-semibold'; |
| 19166 | if (!automationEnabled) { |
| 19167 | modeLabel = 'Sleeping'; |
| 19168 | modeClass = 'text-purple-300 font-semibold'; |
| 19169 | } else if (isManualMode) { |
| 19170 | modeLabel = 'Manual'; |
| 19171 | modeClass = 'text-orange-400 font-semibold'; |
| 19172 | } |
| 19173 | |
| 19174 | updateElement('Ragnar-mode', modeLabel); |
| 19175 | |
| 19176 | const modeElement = document.getElementById('Ragnar-mode'); |
| 19177 | if (modeElement) { |
| 19178 | modeElement.className = modeClass; |
| 19179 | } |
| 19180 | |
| 19181 | syncManualModeUI(isManualMode); |
| 19182 | updateAutomationToggleButton(automationEnabled); |
| 19183 | |
| 19184 | // Update connectivity status with WiFi SSID |
| 19185 | updateConnectivityIndicator('wifi-status', data.wifi_connected, data.current_ssid, data.ap_mode_active); |
| 19186 | updateConnectivityIndicator('bluetooth-status', data.bluetooth_active); |
| 19187 | updateConnectivityIndicator('usb-status', data.usb_active); |
| 19188 | updateConnectivityIndicator('pan-status', data.pan_connected); |
| 19189 | updateLanIndicator(data); |
| 19190 | |
| 19191 | // Update the primary connection card |
| 19192 | updatePrimaryConnectionCard(data); |
| 19193 | |
| 19194 | updateReleaseGateState(data.release_gate); |
| 19195 | updatePwnToggleAvailability(Boolean(data.headless_mode)); |
| 19196 | } |
| 19197 | |
| 19198 | function updateAutomationToggleButton(automationEnabled, options = {}) { |
| 19199 | const button = document.getElementById('automation-toggle-btn'); |
| 19200 | if (!button) { |
| 19201 | return; |
| 19202 | } |
| 19203 |
no test coverage detected