feat: maintenance windows and Markdown descriptions
Monitors and groups get one-off or recurring maintenance. While it is in progress, failures neither open incidents nor alert, so the SLA is not affected; successes still resolve earlier incidents. The console shows monitors under maintenance and lists windows on a new page and on monitor pages. Status pages announce maintenance in progress and planned for the next two weeks and mark affected components; the occurrences are part of the snapshot and evaluated when the page is shown, so this also works from cache during an API outage. Maintenance and status page descriptions are rendered as Markdown. Closes #71 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017GpWAskjmYtZpuQ5JwYTX3
This commit is contained in:
1 parent
259b3b8e05
commit
43b0a35f20
28 files changed
+3918
-894
No files matched your search
@@ -1,6 +1,7 @@
|
||||
package web
|
||||
|
||||
import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"git.zb-server.de/ZB-Server/uptimesebi/internal/agentapi"
|
||||
@@ -35,7 +36,9 @@ templ PublicStatusPage(s agentapi.PageSnapshot, a PublicAssets) {
|
||||
}
|
||||
<h1 class="text-2xl font-semibold" style="color:var(--page-accent,inherit)">{ s.Title }</h1>
|
||||
if s.Description != "" {
|
||||
<p class="mt-2 text-muted">{ s.Description }</p>
|
||||
<div class="legal-text mt-2 text-muted">
|
||||
@templ.Raw(Markdown(s.Description))
|
||||
</div>
|
||||
}
|
||||
</header>
|
||||
if !a.StaleSince.IsZero() {
|
||||
@@ -48,10 +51,12 @@ templ PublicStatusPage(s agentapi.PageSnapshot, a PublicAssets) {
|
||||
templ.KV("border-up", s.Status == agentapi.PageOperational),
|
||||
templ.KV("border-degraded", s.Status == agentapi.PageDegraded),
|
||||
templ.KV("border-down", s.Status == agentapi.PageOutage),
|
||||
templ.KV("border-unknown", s.Status == agentapi.PageUnknown) }
|
||||
templ.KV("border-unknown", s.Status == agentapi.PageUnknown),
|
||||
templ.KV("border-maintenance", s.Status == agentapi.PageUnderMaintenance) }
|
||||
>
|
||||
<p class="text-lg font-medium">{ i18n.T(ctx, "page.status."+s.Status) }</p>
|
||||
</section>
|
||||
@pageMaintenance(i18n.T(ctx, "page.maintenance_ongoing"), s.Ongoing(a.Now))
|
||||
for _, sec := range s.Sections {
|
||||
<section class="mb-10">
|
||||
if sec.Name != "" {
|
||||
@@ -76,6 +81,7 @@ templ PublicStatusPage(s agentapi.PageSnapshot, a PublicAssets) {
|
||||
</ul>
|
||||
</section>
|
||||
}
|
||||
@pageMaintenance(i18n.T(ctx, "page.maintenance_upcoming"), s.Upcoming(a.Now))
|
||||
<section class="mb-12">
|
||||
<h2 class="mb-3 text-xs font-medium uppercase tracking-wider text-muted">{ i18n.T(ctx, "page.incidents") }</h2>
|
||||
if len(s.Incidents) == 0 {
|
||||
@@ -115,3 +121,32 @@ templ PublicStatusPage(s agentapi.PageSnapshot, a PublicAssets) {
|
||||
</body>
|
||||
</html>
|
||||
}
|
||||
|
||||
templ pageMaintenance(heading string, items []agentapi.PageMaintenance) {
|
||||
if len(items) > 0 {
|
||||
<section class="mb-12">
|
||||
<h2 class="mb-3 text-xs font-medium uppercase tracking-wider text-muted">{ heading }</h2>
|
||||
<ul class="divide-y divide-rule border-y border-rule text-sm">
|
||||
for _, m := range items {
|
||||
<li class="py-3">
|
||||
<div class="flex flex-wrap items-baseline gap-x-4 gap-y-1">
|
||||
<span class="flex items-center gap-2 font-medium">
|
||||
@statusDot(StatusMaintenance)
|
||||
{ m.Title }
|
||||
</span>
|
||||
<span class="ml-auto font-mono text-xs text-muted">
|
||||
{ m.Start.UTC().Format("2006-01-02 15:04") + " – " + m.End.UTC().Format("15:04") + " UTC" }
|
||||
</span>
|
||||
</div>
|
||||
<p class="ml-4 mt-1 text-xs text-muted">{ strings.Join(m.Components, ", ") }</p>
|
||||
if m.Description != "" {
|
||||
<div class="legal-text ml-4 mt-2 text-muted">
|
||||
@templ.Raw(Markdown(m.Description))
|
||||
</div>
|
||||
}
|
||||
</li>
|
||||
}
|
||||
</ul>
|
||||
</section>
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user