update html
This commit is contained in:
@ -6,17 +6,19 @@ const UPDATE_INTERVALS = {
|
||||
|
||||
// Core update functions
|
||||
function updateDeviceStatus() {
|
||||
console.log('Updating device status...');
|
||||
console.log('Fetching device status...');
|
||||
fetch('/api/status')
|
||||
.then(response => response.json())
|
||||
.then(data => {
|
||||
console.log('Received status data:', data);
|
||||
Object.entries(data).forEach(([deviceName, status]) => {
|
||||
console.log(`Updating ${deviceName} status to ${status}`);
|
||||
updateDeviceIndicator(deviceName, status);
|
||||
const deviceElement = document.querySelector(`.device-status[data-device-name="${deviceName}"]`);
|
||||
if (deviceElement) {
|
||||
const indicator = deviceElement.querySelector('.status-indicator');
|
||||
indicator.className = `status-indicator status-${status ? 'up' : 'down'}`;
|
||||
}
|
||||
});
|
||||
})
|
||||
.catch(error => console.error('Error updating status:', error));
|
||||
});
|
||||
}
|
||||
|
||||
function updateSystemMetrics() {
|
||||
|
||||
Reference in New Issue
Block a user