triflix commited on
Commit
ef07840
·
verified ·
1 Parent(s): b594187

Create templates/index.html

Browse files
Files changed (1) hide show
  1. templates/index.html +68 -0
templates/index.html ADDED
@@ -0,0 +1,68 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!-- templates/index.html -->
2
+ <!doctype html>
3
+ <html lang="en">
4
+ <head>
5
+ <meta charset="utf-8" />
6
+ <meta name="viewport" content="width=device-width,initial-scale=1" />
7
+ <title>Checkers — Uptime Monitor</title>
8
+ <script>
9
+ // minimal styles only
10
+ </script>
11
+ <style>
12
+ body { font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial; padding: 20px; background:#f7fafc; color:#111827; }
13
+ .card { background:white; padding:16px; border-radius:8px; box-shadow: 0 1px 3px rgba(0,0,0,0.06); margin-bottom:12px; }
14
+ .ok { color:green }
15
+ .fail { color:crimson }
16
+ .meta { font-size: 0.85rem; color:#6b7280 }
17
+ form { display:flex; gap:8px; align-items:center }
18
+ input[type=text] { padding:8px; border-radius:6px; border:1px solid #e5e7eb; width:320px }
19
+ button { padding:8px 12px; border-radius:6px; background:#0ea5a4; color:white; border:none }
20
+ .small { font-size:0.85rem }
21
+ </style>
22
+ </head>
23
+ <body>
24
+ <h1>Checkers — Uptime Monitor</h1>
25
+ <div class="card">
26
+ <form action="/add" method="post">
27
+ <input type="text" name="url" placeholder="https://example.com" required />
28
+ <input type="text" name="label" placeholder="Optional label" />
29
+ <button type="submit">Add site</button>
30
+ </form>
31
+ <p class="meta small">Add a site and Checkers will ping it every 15 minutes.</p>
32
+ </div>
33
+
34
+ <h2>Monitored Sites</h2>
35
+ {% if sites|length == 0 %}
36
+ <div class="card">No sites yet — add one above.</div>
37
+ {% else %}
38
+ {% for row in sites %}
39
+ {% set s = row.site %}
40
+ {% set last = row.last %}
41
+ <div class="card">
42
+ <div style="display:flex;justify-content:space-between;align-items:center">
43
+ <div>
44
+ <div style="font-weight:600">{{ s.label or s.url }}</div>
45
+ <div class="meta">{{ s.url }}</div>
46
+ </div>
47
+ <div style="text-align:right">
48
+ {% if last %}
49
+ {% if last.status_code and last.status_code >= 200 and last.status_code < 400 %}
50
+ <div class="ok">OK — {{ last.status_code }}</div>
51
+ {% else %}
52
+ <div class="fail">FAIL</div>
53
+ {% endif %}
54
+ <div class="meta small">Last checked: {{ last.timestamp }} — {{ last.latency_ms or '-' }} ms</div>
55
+ {% else %}
56
+ <div class="meta">No pings yet</div>
57
+ {% endif %}
58
+ <form action="/remove" method="post" style="margin-top:8px">
59
+ <input type="hidden" name="site_id" value="{{ s.id }}" />
60
+ <button type="submit" style="background:#ef4444">Remove</button>
61
+ </form>
62
+ </div>
63
+ </div>
64
+ </div>
65
+ {% endfor %}
66
+ {% endif %}
67
+ </body>
68
+ </html>