mirror of
https://github.com/sstent/GarminSync.git
synced 2026-01-25 16:42:20 +00:00
python v2 - added feartures 1 and 2 - daemon hsa errors
This commit is contained in:
47
garminsync/web/static/app.js
Normal file
47
garminsync/web/static/app.js
Normal file
@@ -0,0 +1,47 @@
|
||||
// Auto-refresh dashboard data
|
||||
setInterval(updateStatus, 30000); // Every 30 seconds
|
||||
|
||||
async function updateStatus() {
|
||||
try {
|
||||
const response = await fetch('/api/status');
|
||||
const data = await response.json();
|
||||
|
||||
// Update daemon status
|
||||
document.getElementById('daemon-status').innerHTML = `
|
||||
<p>Status: <span class="badge ${data.daemon.running ? 'badge-success' : 'badge-danger'}">
|
||||
${data.daemon.running ? 'Running' : 'Stopped'}
|
||||
</span></p>
|
||||
<p>Next Run: ${data.daemon.next_run || 'Not scheduled'}</p>
|
||||
<p>Schedule: ${data.daemon.schedule || 'Not configured'}</p>
|
||||
`;
|
||||
|
||||
// Update recent logs
|
||||
const logsHtml = data.recent_logs.map(log => `
|
||||
<div class="log-entry">
|
||||
<small class="text-muted">${log.timestamp}</small>
|
||||
<span class="badge badge-${log.status === 'success' ? 'success' : 'danger'}">
|
||||
${log.status}
|
||||
</span>
|
||||
${log.operation}: ${log.message || ''}
|
||||
</div>
|
||||
`).join('');
|
||||
|
||||
document.getElementById('recent-logs').innerHTML = logsHtml;
|
||||
|
||||
} catch (error) {
|
||||
console.error('Failed to update status:', error);
|
||||
}
|
||||
}
|
||||
|
||||
async function triggerSync() {
|
||||
try {
|
||||
await fetch('/api/sync/trigger', { method: 'POST' });
|
||||
alert('Sync triggered successfully');
|
||||
updateStatus();
|
||||
} catch (error) {
|
||||
alert('Failed to trigger sync');
|
||||
}
|
||||
}
|
||||
|
||||
// Initialize on page load
|
||||
document.addEventListener('DOMContentLoaded', updateStatus);
|
||||
32
garminsync/web/static/style.css
Normal file
32
garminsync/web/static/style.css
Normal file
@@ -0,0 +1,32 @@
|
||||
body {
|
||||
font-family: Arial, sans-serif;
|
||||
background-color: #f8f9fa;
|
||||
}
|
||||
|
||||
.card {
|
||||
margin-bottom: 20px;
|
||||
box-shadow: 0 2px 10px rgba(0,0,0,0.1);
|
||||
}
|
||||
|
||||
.card-header {
|
||||
font-weight: bold;
|
||||
background-color: #f1f1f1;
|
||||
}
|
||||
|
||||
.btn {
|
||||
margin-right: 5px;
|
||||
}
|
||||
|
||||
.log-entry {
|
||||
margin-bottom: 10px;
|
||||
padding: 5px;
|
||||
border-left: 3px solid #ddd;
|
||||
}
|
||||
|
||||
.log-entry .badge-success {
|
||||
background-color: #28a745;
|
||||
}
|
||||
|
||||
.log-entry .badge-error {
|
||||
background-color: #dc3545;
|
||||
}
|
||||
Reference in New Issue
Block a user