feat: report Gitea event stream freshness
This commit is contained in:
1 parent
1e17771840
commit
5a3f0128c4
2 files changed
+15
No files matched your search
@@ -102,6 +102,7 @@ textarea { resize: vertical; min-height: 120px; }
|
||||
<details class="panel" data-panel-key="gitea-events" open>
|
||||
<summary><h2>Gitea event stream</h2></summary>
|
||||
<div id="gitea-events" class="muted" aria-live="polite">Loading…</div>
|
||||
<div id="gitea-events-status" class="small" aria-live="polite">Waiting for activity…</div>
|
||||
</details>
|
||||
<details class="panel" data-panel-key="widgets" open>
|
||||
<summary><h2>Live Widgets</h2></summary>
|
||||
@@ -245,11 +246,17 @@ textarea { resize: vertical; min-height: 120px; }
|
||||
).join('') : '<div class="muted">No recent Gitea activity.</div>';
|
||||
}
|
||||
|
||||
function setEventStreamStatus(message) {
|
||||
qs('#gitea-events-status').textContent = message;
|
||||
}
|
||||
|
||||
async function loadEventStream() {
|
||||
setEventStreamStatus('Updating…');
|
||||
try {
|
||||
const res = await fetch('/api/v1/events', { headers: { Accept: 'application/json' } });
|
||||
if (!res.ok) throw new Error('HTTP ' + res.status);
|
||||
paintEventStream(await res.json());
|
||||
setEventStreamStatus('Updated ' + fmt(new Date()));
|
||||
} catch (e) {
|
||||
qs('#gitea-events').innerHTML = '<div class="muted">Event stream unavailable.</div>';
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user