-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdashboard.html
More file actions
47 lines (44 loc) · 2.02 KB
/
Copy pathdashboard.html
File metadata and controls
47 lines (44 loc) · 2.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
<!DOCTYPE html>
<html>
<head>
<title>Job Queue Dashboard</title>
<style>
body { font-family: sans-serif; padding: 20px; background: #f4f4f9; }
.card { background: white; padding: 20px; border-radius: 8px; box-shadow: 0 2px 10px rgba(0,0,0,0.1); margin-bottom: 20px; }
.progress-bar { width: 100%; background: #eee; border-radius: 10px; height: 20px; overflow: hidden; }
.progress-fill { background: #4caf50; height: 100%; transition: width 0.5s; }
.stats { display: flex; gap: 20px; }
.stat-box { flex: 1; text-align: center; padding: 10px; border-radius: 5px; color: white; }
</style>
</head>
<body>
<h1> System Monitor</h1>
<div id="stats-summary" class="stats"></div>
<h2>Active Jobs</h2>
<div id="active-jobs"></div>
<script>
async function updateStats() {
const res = await fetch('http://localhost:3000/api/stats');
const data = await res.json();
// Render Summary
const s = data.summary;
document.getElementById('stats-summary').innerHTML = `
<div class="stat-box" style="background: #2196f3;">Pending: ${s.pending}</div>
<div class="stat-box" style="background: #ff9800;">Running: ${s.running}</div>
<div class="stat-box" style="background: #4caf50;">Success: ${s.completed}</div>
<div class="stat-box" style="background: #f44336;">Failed: ${s.failed}</div>
`;
// Render Progress Bars
document.getElementById('active-jobs').innerHTML = data.active_jobs.map(job => `
<div class="card">
<strong>Job #${job.id} (${job.type})</strong>
<div class="progress-bar"><div class="progress-fill" style="width: ${job.progress}%"></div></div>
<small>${job.progress}% Complete</small>
</div>
`).join('');
}
setInterval(updateStats, 1000);
updateStats();
</script>
</body>
</html>