35 lines
1.2 KiB
JavaScript
35 lines
1.2 KiB
JavaScript
// Fetch and display system status
|
|
async function loadStatus() {
|
|
try {
|
|
const response = await fetch('/api/status');
|
|
const data = await response.json();
|
|
|
|
// Update status message
|
|
const statusEl = document.getElementById('status-message');
|
|
statusEl.textContent = data.message;
|
|
statusEl.classList.remove('loading');
|
|
statusEl.classList.add('healthy');
|
|
|
|
// Update timestamp
|
|
const timestamp = new Date(data.timestamp);
|
|
document.getElementById('status-timestamp').textContent =
|
|
`Last updated: ${timestamp.toLocaleString()}`;
|
|
|
|
// Update domain
|
|
document.getElementById('domain').textContent = data.domain;
|
|
|
|
// Update version
|
|
document.getElementById('version').textContent = data.version;
|
|
} catch (error) {
|
|
console.error('Error loading status:', error);
|
|
document.getElementById('status-message').textContent = 'Error loading status';
|
|
document.getElementById('status-message').classList.remove('loading');
|
|
}
|
|
}
|
|
|
|
// Load status on page load
|
|
document.addEventListener('DOMContentLoaded', loadStatus);
|
|
|
|
// Refresh status every 30 seconds
|
|
setInterval(loadStatus, 30000);
|