Files
HomeBase/public/app.js
Spencer ea6cc3fc85
Some checks failed
Deploy to BeePC / deploy (push) Has been cancelled
Add frontend components and API for system status display
2026-02-05 11:02:05 -05:00

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);