Add frontend components and API for system status display
Some checks failed
Deploy to BeePC / deploy (push) Has been cancelled
Some checks failed
Deploy to BeePC / deploy (push) Has been cancelled
This commit is contained in:
34
public/app.js
Normal file
34
public/app.js
Normal file
@@ -0,0 +1,34 @@
|
||||
// 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);
|
||||
Reference in New Issue
Block a user