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
165 lines
4.6 KiB
Templ
165 lines
4.6 KiB
Templ
package web
|
|
|
|
import (
|
|
"strconv"
|
|
|
|
"git.zb-server.de/ZB-Server/uptimesebi/internal/i18n"
|
|
)
|
|
|
|
// CheckerView shows what a checker instance is doing.
|
|
type CheckerView struct {
|
|
ID string
|
|
Agent string
|
|
Region string
|
|
Platform bool
|
|
Release string
|
|
Started string
|
|
LastSeen string
|
|
Live bool
|
|
Queued int
|
|
Running []CheckerRun
|
|
OtherOrgs int
|
|
Checks int
|
|
Failed int
|
|
AvgLatency string
|
|
Recent []CheckerResult
|
|
Pager Pager
|
|
Siblings []CheckerLink
|
|
}
|
|
|
|
// CheckerRun is a check in progress.
|
|
type CheckerRun struct {
|
|
MonitorURL string
|
|
Monitor string
|
|
For string
|
|
}
|
|
|
|
// CheckerResult is a finished check of the instance.
|
|
type CheckerResult struct {
|
|
Time string
|
|
MonitorURL string
|
|
Monitor string
|
|
OK bool
|
|
Latency string
|
|
Detail string
|
|
}
|
|
|
|
// CheckerLink points to a checker instance.
|
|
type CheckerLink struct {
|
|
URL string
|
|
Label string
|
|
}
|
|
|
|
templ CheckerPage(p Page, me Me, v CheckerView) {
|
|
@consoleShell(p, me) {
|
|
<div class="mb-8">
|
|
<h1 class="flex items-center gap-2.5 text-lg font-semibold">
|
|
if v.Live {
|
|
@statusDot(StatusUp)
|
|
} else {
|
|
@statusDot(StatusUnknown)
|
|
}
|
|
{ v.Agent }
|
|
<span class="font-mono text-sm font-normal text-muted">{ v.ID[:8] }</span>
|
|
</h1>
|
|
<p class="mt-1 text-sm text-muted">
|
|
{ v.Region } ·
|
|
if v.Platform {
|
|
{ i18n.T(ctx, "regions.platform") }
|
|
} else {
|
|
{ i18n.T(ctx, "regions.own") }
|
|
}
|
|
·
|
|
if v.Live {
|
|
{ i18n.T(ctx, "checkers.live") }
|
|
} else {
|
|
{ i18n.T(ctx, "checkers.gone") }
|
|
}
|
|
</p>
|
|
</div>
|
|
<dl class="mb-10 grid grid-cols-2 gap-px border border-rule bg-rule sm:grid-cols-4">
|
|
@checkerFact("checkers.running", strconv.Itoa(len(v.Running)+v.OtherOrgs))
|
|
@checkerFact("checkers.queued", strconv.Itoa(v.Queued))
|
|
@checkerFact("checkers.last_hour", strconv.Itoa(v.Checks)+" / "+strconv.Itoa(v.Failed)+" ✕")
|
|
@checkerFact("checkers.avg_latency", v.AvgLatency)
|
|
@checkerFact("checkers.release", v.Release)
|
|
@checkerFact("checkers.started", v.Started)
|
|
@checkerFact("checkers.last_seen", v.LastSeen)
|
|
@checkerFact("checkers.instance", v.ID)
|
|
</dl>
|
|
<section class="mb-10">
|
|
@sectionHeading("checkers.now")
|
|
if len(v.Running) == 0 && v.OtherOrgs == 0 {
|
|
<p class="text-sm text-muted">{ i18n.T(ctx, "checkers.idle") }</p>
|
|
} else {
|
|
<ul class="divide-y divide-rule border-y border-rule text-sm">
|
|
for _, r := range v.Running {
|
|
<li class="flex justify-between gap-4 py-1.5">
|
|
<a href={ templ.SafeURL(r.MonitorURL) } class="hover:underline">{ r.Monitor }</a>
|
|
<span class="font-mono text-xs text-muted">{ i18n.T(ctx, "checkers.for", "Duration", r.For) }</span>
|
|
</li>
|
|
}
|
|
if v.OtherOrgs > 0 {
|
|
<li class="py-1.5 text-xs text-muted">{ i18n.T(ctx, "checkers.others", "Count", v.OtherOrgs) }</li>
|
|
}
|
|
</ul>
|
|
}
|
|
<p class="mt-2 text-xs text-muted">{ i18n.T(ctx, "checkers.refresh_hint") }</p>
|
|
</section>
|
|
<section class="mb-10">
|
|
@sectionHeading("checkers.recent")
|
|
if len(v.Recent) == 0 {
|
|
<p class="text-sm text-muted">{ i18n.T(ctx, "checkers.no_recent") }</p>
|
|
} else {
|
|
<div class="overflow-x-auto">
|
|
<table class="w-full text-left text-sm">
|
|
<tbody class="divide-y divide-rule border-y border-rule">
|
|
for _, r := range v.Recent {
|
|
<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"><a href={ templ.SafeURL(r.MonitorURL) } class="hover:underline">{ r.Monitor }</a></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 }</td>
|
|
</tr>
|
|
}
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
}
|
|
@pager(v.Pager, "newer", "older")
|
|
</section>
|
|
if len(v.Siblings) > 0 {
|
|
<section>
|
|
@sectionHeading("checkers.siblings")
|
|
<p class="flex flex-wrap gap-3 font-mono text-xs">
|
|
for _, sb := range v.Siblings {
|
|
<a href={ templ.SafeURL(sb.URL) } class="underline underline-offset-2">{ sb.Label }</a>
|
|
}
|
|
</p>
|
|
</section>
|
|
}
|
|
}
|
|
}
|
|
|
|
templ checkerFact(labelID, value string) {
|
|
<div class="bg-paper px-3 py-2">
|
|
<dt class="text-xs text-muted">{ i18n.T(ctx, labelID) }</dt>
|
|
<dd class="truncate font-mono text-sm" title={ value }>{ value }</dd>
|
|
</div>
|
|
}
|
|
|
|
templ checkerCell(l CheckerLink) {
|
|
if l.URL != "" {
|
|
<a href={ templ.SafeURL(l.URL) } class="hover:underline">{ l.Label }</a>
|
|
} else {
|
|
<span class="text-muted">{ l.Label }</span>
|
|
}
|
|
}
|