added troub
This commit is contained in:
@ -1,18 +1,23 @@
|
||||
function updateDeviceStatus() {
|
||||
fetch('/api/status')
|
||||
function updateDiagnostics() {
|
||||
fetch('/api/diagnostics')
|
||||
.then(response => response.json())
|
||||
.then(data => {
|
||||
Object.entries(data).forEach(([deviceName, isUp]) => {
|
||||
const deviceElement = document.querySelector(`.device-status:has(span:contains("${deviceName}"))`);
|
||||
if (deviceElement) {
|
||||
const indicator = deviceElement.querySelector('.status-indicator');
|
||||
indicator.className = `status-indicator status-${isUp ? 'up' : 'down'}`;
|
||||
}
|
||||
const diagnosticsPanel = document.querySelector('.diagnostics-content');
|
||||
diagnosticsPanel.innerHTML = '';
|
||||
|
||||
Object.entries(data).forEach(([device, diagnostics]) => {
|
||||
const diagElement = document.createElement('div');
|
||||
diagElement.className = `diagnostic-item ${diagnostics.type}-diagnostic`;
|
||||
diagElement.innerHTML = `
|
||||
<h3>${device}</h3>
|
||||
<pre>${JSON.stringify(diagnostics.results, null, 2)}</pre>
|
||||
`;
|
||||
diagnosticsPanel.appendChild(diagElement);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
// Update every 30 seconds
|
||||
setInterval(updateDeviceStatus, 30000);
|
||||
// Update diagnostics every minute
|
||||
setInterval(updateDiagnostics, 60000);
|
||||
// Initial update
|
||||
updateDeviceStatus();
|
||||
|
||||
Reference in New Issue
Block a user