feat(web): fit the console and status pages to phones and tablets
ci / lint (push) Skipped
ci / test (push) Skipped
ci / build (push) Skipped
ci / image (push) Skipped
ci / lint (pull_request) Successful in 6m4s
ci / test (pull_request) Successful in 11m52s
ci / build (pull_request) Successful in 17m48s
ci / image (pull_request) Successful in 5m28s

- The console header folds its navigation into a menu below 1024px.
- Pages use narrower gutters on phones.
- Monitor rows keep name and uptime in place on narrow screens.
- Toolbars and the range switch wrap.
- Tables scroll sideways instead of squeezing their columns.
- Form fields keep 16px text on touch screens so iOS does not zoom in.
- The status page footer wraps.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017GpWAskjmYtZpuQ5JwYTX3
This commit is contained in:
Sebastian UnterschützandClaude Opus 5.5 committed 2026-11-24 17:09:50 +01:00
1 parent 442b45b974
commit 670dde40b6
22 files changed
+1353 -1276

No files matched your search

+60 -58
View File
@@ -1,8 +1,8 @@
package web
import (
"slices"
"context"
"slices"
"strconv"
"strings"
@@ -57,8 +57,8 @@ type DashboardView struct {
Search string
Results []MonitorRow
// Focus, if set, names the one group Root holds, paged by Pager.
Focus string
Pager Pager
Focus string
Pager Pager
Empty bool
CanWrite bool
Counts map[Status]int
@@ -93,7 +93,7 @@ type RegionHistory struct {
}
templ rangeSwitch(opts []RangeOption) {
<nav class="flex border border-rule font-mono text-xs" aria-label={ i18n.T(ctx, "monitors.range") }>
<nav class="flex min-w-0 max-w-full overflow-x-auto border border-rule font-mono text-xs" aria-label={ i18n.T(ctx, "monitors.range") }>
for _, o := range opts {
if o.Active {
<span class="bg-ink px-2 py-1 text-paper" aria-current="true">{ o.Key }</span>
@@ -130,7 +130,7 @@ templ bars(bs []Bar, height int) {
>
for i, b := range bs {
<rect
x={ strconv.Itoa(i*4) }
x={ strconv.Itoa(i * 4) }
y="0"
width="3"
height={ strconv.Itoa(height) }
@@ -147,9 +147,9 @@ templ bars(bs []Bar, height int) {
templ Dashboard(p Page, me Me, v DashboardView) {
@consoleShell(p, me) {
<div class="mb-6 flex items-baseline justify-between gap-4">
<div class="mb-6 flex flex-wrap items-center justify-between gap-x-4 gap-y-3">
<h1 class="text-lg font-semibold">{ i18n.T(ctx, "console.monitors.title") }</h1>
<div class="flex items-center gap-5 font-mono text-xs text-muted">
<div class="flex flex-wrap items-center gap-x-5 gap-y-3 font-mono text-xs text-muted">
@rangeSwitch(v.Ranges)
for _, s := range []Status{StatusUp, StatusDegraded, StatusDown, StatusMaintenance, StatusPaused} {
if v.Counts[s] > 0 {
@@ -160,7 +160,7 @@ templ Dashboard(p Page, me Me, v DashboardView) {
}
}
if v.CanWrite {
<a href="/monitors/new" class="bg-ink px-3 py-1.5 font-sans text-sm text-paper hover:opacity-90">{ i18n.T(ctx, "monitors.new") }</a>
<a href="/monitors/new" class="whitespace-nowrap bg-ink px-3 py-1.5 font-sans text-sm text-paper hover:opacity-90">{ i18n.T(ctx, "monitors.new") }</a>
}
</div>
</div>
@@ -180,7 +180,7 @@ templ Dashboard(p Page, me Me, v DashboardView) {
<button type="submit" class="border border-ink px-3 py-1.5 text-sm hover:bg-ink hover:text-paper">{ i18n.T(ctx, "moderation.search_button") }</button>
</form>
}
switch {
switch {
case v.Empty:
<p class="border-y border-rule py-10 text-center text-sm text-muted">{ i18n.T(ctx, "console.monitors.empty") }</p>
case v.Search != "":
@@ -230,7 +230,7 @@ templ monitorList(ms []MonitorRow) {
</span>
<span class="col-span-2 md:col-span-1">@bars(m.Bars, 18)</span>
<span class="hidden text-right font-mono text-xs text-muted md:block">{ m.Latency }</span>
<span class="row-start-1 text-right font-mono text-sm md:row-auto">{ m.Uptime }</span>
<span class="col-start-2 row-start-1 text-right font-mono text-sm md:col-auto md:row-auto">{ m.Uptime }</span>
</a>
</li>
}
@@ -312,7 +312,7 @@ type MonitorDetailView struct {
MoreIncidents bool
// MoreResults is set when the monitor has more results than shown.
MoreResults bool
CanWrite bool
CanWrite bool
// Maintenance lists current and upcoming maintenance.
Maintenance []MaintenanceItem
// PingURL is set for heartbeat monitors the viewer may change.
@@ -333,12 +333,12 @@ templ MonitorDetail(p Page, me Me, v MonitorDetailView) {
@consoleShell(p, me) {
<p class="mb-4 text-sm"><a href="/" class="text-muted hover:text-ink">← { i18n.T(ctx, "console.monitors.title") }</a></p>
<div class="mb-8 flex flex-wrap items-start justify-between gap-4">
<div>
<div class="min-w-0">
<h1 class="flex items-center gap-2.5 text-lg font-semibold">
@statusDot(v.Row.Status)
<span>{ v.Row.Name }</span>
<span class="break-words">{ v.Row.Name }</span>
</h1>
<p class="mt-1 font-mono text-xs text-muted">
<p class="mt-1 font-mono text-xs break-all text-muted">
{ i18n.T(ctx, "monitors.type_"+v.Row.Type) }
if v.Row.Target != "" {
{ " · " + v.Row.Target }
@@ -351,7 +351,7 @@ templ MonitorDetail(p Page, me Me, v MonitorDetailView) {
}
</div>
<section class="mb-10">
<div class="mb-3 flex items-center justify-between gap-4">
<div class="mb-3 flex flex-wrap items-center justify-between gap-x-4 gap-y-2">
<h2 class="text-xs font-medium uppercase tracking-wider text-muted">{ i18n.T(ctx, "monitors.history", "Range", v.Range) }</h2>
@rangeSwitch(v.Ranges)
</div>
@@ -449,33 +449,35 @@ templ MonitorDetail(p Page, me Me, v MonitorDetailView) {
}
templ resultTable(rows []ResultRow) {
<table class="w-full text-left text-sm">
<tbody class="divide-y divide-rule border-y border-rule">
for _, r := range rows {
<tr>
<td class="py-1.5 pr-4 font-mono text-xs whitespace-nowrap text-muted">{ r.Time }</td>
<td class="py-1.5 pr-4">{ r.Region }</td>
<td class="py-1.5 pr-4 font-mono text-xs">
@checkerCell(r.Checker)
</td>
<td class="py-1.5 pr-4">
if r.OK {
<span class="text-up">●</span>
} else {
<span class="text-down">●</span>
}
</td>
<td class="py-1.5 pr-4 font-mono text-xs">{ r.Latency }</td>
<td class="py-1.5 font-mono text-xs text-muted">
{ r.Detail }
if r.EvidenceURL != "" {
<a href={ templ.SafeURL(r.EvidenceURL) } class="ml-2 underline underline-offset-2 hover:text-ink">{ i18n.T(ctx, "evidence.show") }</a>
}
</td>
</tr>
}
</tbody>
</table>
<div class="overflow-x-auto">
<table class="w-full min-w-[40rem] text-left text-sm">
<tbody class="divide-y divide-rule border-y border-rule">
for _, r := range rows {
<tr>
<td class="py-1.5 pr-4 font-mono text-xs whitespace-nowrap text-muted">{ r.Time }</td>
<td class="py-1.5 pr-4">{ r.Region }</td>
<td class="py-1.5 pr-4 font-mono text-xs">
@checkerCell(r.Checker)
</td>
<td class="py-1.5 pr-4">
if r.OK {
<span class="text-up">●</span>
} else {
<span class="text-down">●</span>
}
</td>
<td class="py-1.5 pr-4 font-mono text-xs">{ r.Latency }</td>
<td class="py-1.5 font-mono text-xs text-muted">
{ r.Detail }
if r.EvidenceURL != "" {
<a href={ templ.SafeURL(r.EvidenceURL) } class="ml-2 underline underline-offset-2 hover:text-ink">{ i18n.T(ctx, "evidence.show") }</a>
}
</td>
</tr>
}
</tbody>
</table>
</div>
}
// ResultsView is a page of a monitor's check results.
@@ -527,7 +529,7 @@ templ incidentList(rows []IncidentRow, showMonitor bool, custom []CustomIncident
// quickStatus sets an incident's status right in the list, with an
// optional message.
templ quickStatus(r IncidentRow, custom []CustomIncidentStatus) {
<details class="group w-full sm:w-auto">
<details class="group w-full sm:w-auto sm:open:w-full">
<summary class="cursor-pointer list-none border border-ink px-2 py-0.5 text-xs hover:bg-ink hover:text-paper">{ i18n.T(ctx, "incident.set_status") }</summary>
<form data-api={ "/org/incidents/" + r.ID + "/updates" } data-next="/incidents" class="mt-3 grid gap-2 border border-rule p-3 sm:w-80">
@formError()
@@ -600,9 +602,9 @@ type MonitorForm struct {
GroupID string
Groups []GroupOption
// TopLevel is set when the monitor may live outside any group.
TopLevel bool
Regions []RegionOption
MinInterval int
TopLevel bool
Regions []RegionOption
MinInterval int
// Type-specific settings.
Method string
ExpectStatus string
@@ -617,12 +619,12 @@ type MonitorForm struct {
TLSServerName string
GraceSeconds int
// Headers are "Name: value" lines, shared by HTTP and JSON checks.
Headers string
JSONMethod string
JSONBody string
JSONExpect string
JSONVerify bool
Assertions []AssertionRow
Headers string
JSONMethod string
JSONBody string
JSONExpect string
JSONVerify bool
Assertions []AssertionRow
PromQuery string
PromOp string
PromThreshold string
@@ -650,11 +652,11 @@ type BrokerForm struct {
// Secrets are never filled in; the *Set fields tell the form one is
// stored.
type ProtocolForm struct {
Service, TLS string
ImplicitTLS bool
User, NASIdentifier string
SecretSet, PasswordSet, CommunitySet bool
Version, OID, Condition, Value string
Service, TLS string
ImplicitTLS bool
User, NASIdentifier string
SecretSet, PasswordSet, CommunitySet bool
Version, OID, Condition, Value string
}
// GameForm holds the settings of game server checks.
@@ -1175,7 +1177,7 @@ templ providerField(f ProviderField) {
<span class="normal-case tracking-normal">{ " · " + i18n.T(ctx, "channels.optional") }</span>
}
</span>
switch {
switch {
case f.Kind == "select":
<select name={ "settings." + f.Name } class="w-full border border-rule bg-transparent px-2 py-1.5 font-mono text-sm">
for _, o := range f.Options {