update html
This commit is contained in:
@ -6,17 +6,19 @@ const UPDATE_INTERVALS = {
|
|||||||
|
|
||||||
// Core update functions
|
// Core update functions
|
||||||
function updateDeviceStatus() {
|
function updateDeviceStatus() {
|
||||||
console.log('Updating device status...');
|
console.log('Fetching device status...');
|
||||||
fetch('/api/status')
|
fetch('/api/status')
|
||||||
.then(response => response.json())
|
.then(response => response.json())
|
||||||
.then(data => {
|
.then(data => {
|
||||||
console.log('Received status data:', data);
|
console.log('Received status data:', data);
|
||||||
Object.entries(data).forEach(([deviceName, status]) => {
|
Object.entries(data).forEach(([deviceName, status]) => {
|
||||||
console.log(`Updating ${deviceName} status to ${status}`);
|
const deviceElement = document.querySelector(`.device-status[data-device-name="${deviceName}"]`);
|
||||||
updateDeviceIndicator(deviceName, status);
|
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() {
|
function updateSystemMetrics() {
|
||||||
|
|||||||
@ -22,10 +22,6 @@
|
|||||||
<div class="device-info">
|
<div class="device-info">
|
||||||
<span class="device-name">{{ device.name }}</span>
|
<span class="device-name">{{ device.name }}</span>
|
||||||
<span class="device-details">{{ device.ip }}</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>
|
||||||
</div>
|
</div>
|
||||||
{%- endfor %}
|
{%- endfor %}
|
||||||
|
|||||||
Reference in New Issue
Block a user