update html

This commit is contained in:
2025-02-07 23:38:49 -05:00
parent 02d03f4f3f
commit 067ce4d316
2 changed files with 7 additions and 9 deletions

View File

@ -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() {

View File

@ -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 %}