985e51d25e
Tests · Go / test (push) Successful in 1m58s
Turn the console landing page into an operational dashboard. - new internal/opsstatus: read-only Postgres projection via go-jet — ping + per-status COUNT/GROUP BY on runtime_records, mail_deliveries, notification_routes, and a malformed-intent count; degrades per-probe into Snapshot.Errors rather than failing the page - dashboard renders backend readiness, database health, the three status tables, the malformed count, and any collection errors; falls back to a "monitoring not wired" note when no reader is injected - AdminConsoleHandlers now takes an AdminConsoleDeps struct (Monitor + Ready added) so later stages add service refs without churning the signature Tests: opsstatus store test against a Postgres testcontainer (empty schema + one enqueued delivery); dashboard render tests with a fake reader (with and without monitoring). Docs: ARCHITECTURE 14.1 + FUNCTIONAL 10.2.1 (+ru) describe the dashboard. (Prometheus /metrics exporters were already enabled in dev-deploy in Stage 1.)
70 lines
2.0 KiB
Go Template
70 lines
2.0 KiB
Go Template
{{define "content" -}}
|
|
<h1>Dashboard</h1>
|
|
<p class="lede">Signed in as <strong>{{.Username}}</strong>.</p>
|
|
{{with .Data}}
|
|
<section class="panel">
|
|
<h2>Health</h2>
|
|
<ul class="kv">
|
|
<li>Backend ready: {{if .BackendReady}}<span class="ok">yes</span>{{else}}<span class="bad">no</span>{{end}}</li>
|
|
<li>Postgres: {{if .PostgresHealthy}}<span class="ok">healthy</span>{{else}}<span class="bad">unreachable</span>{{end}}</li>
|
|
</ul>
|
|
</section>
|
|
{{if .MonitorAvailable}}
|
|
<div class="grid">
|
|
<section class="panel">
|
|
<h2>Game runtimes</h2>
|
|
{{template "statuscounts" .Runtimes}}
|
|
</section>
|
|
<section class="panel">
|
|
<h2>Mail deliveries</h2>
|
|
{{template "statuscounts" .MailDeliveries}}
|
|
</section>
|
|
<section class="panel">
|
|
<h2>Notification routes</h2>
|
|
{{template "statuscounts" .NotificationRoutes}}
|
|
</section>
|
|
<section class="panel">
|
|
<h2>Malformed notifications</h2>
|
|
<p class="bignum {{if gt .NotificationMalformed 0}}bad{{end}}">{{.NotificationMalformed}}</p>
|
|
</section>
|
|
</div>
|
|
{{if .Errors}}
|
|
<section class="panel errors">
|
|
<h2>Collection errors</h2>
|
|
<ul>{{range .Errors}}<li>{{.}}</li>{{end}}</ul>
|
|
</section>
|
|
{{end}}
|
|
{{else}}
|
|
<p class="note">Monitoring is not wired in this deployment.</p>
|
|
{{end}}
|
|
{{end}}
|
|
<section class="cards">
|
|
<a class="card" href="/_gm/users">
|
|
<h2>Users</h2>
|
|
<p>Accounts, sanctions, entitlements, soft-delete.</p>
|
|
</a>
|
|
<a class="card" href="/_gm/games">
|
|
<h2>Games & runtimes</h2>
|
|
<p>Lobby state, engine versions, turn control.</p>
|
|
</a>
|
|
<a class="card" href="/_gm/operators">
|
|
<h2>Operators</h2>
|
|
<p>Admin accounts: create, disable, reset password.</p>
|
|
</a>
|
|
<a class="card" href="/_gm/mail">
|
|
<h2>Mail & notifications</h2>
|
|
<p>Deliveries, dead-letters, broadcasts.</p>
|
|
</a>
|
|
</section>
|
|
{{- end}}
|
|
|
|
{{define "statuscounts" -}}
|
|
{{if .}}
|
|
<table class="counts"><tbody>
|
|
{{range .}}<tr><td>{{.Status}}</td><td class="num">{{.Count}}</td></tr>{{end}}
|
|
</tbody></table>
|
|
{{else}}
|
|
<p class="note">none</p>
|
|
{{end}}
|
|
{{- end}}
|