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() {
|
||||
|
||||
@ -22,10 +22,6 @@
|
||||
<div class="device-info">
|
||||
<span class="device-name">{{ device.name }}</span>
|
||||
<span class="device-details">{{ device.ip }}</span>
|
||||
<span class="device-type">{{ device.type }} ({{ device.connection_type }})</span>
|
||||
{% if device.critical %}
|
||||
<span class="critical-badge">Critical</span>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
{%- endfor %}
|
||||
|
||||
Reference in New Issue
Block a user