feat(runbook): Notfall-Runbook + Inline-Hints an Alarm-Flaechen (CHO tower-notfall-runbook)
DATEI 1: public/runbook/runbook-tower-notfall.md (statisch, Anker #deadman/#spool/#deadletter/#health)
DATEI 2: /runbook-Route (Server Component, Mini-MD-Renderer, CSP-konform, force-static)
DATEI 3: runbookHints.ts (LAMP_HINTS/buildView/renderHintHtml 1:1 aus runbook_hints.py)
+ RunbookHint.tsx eingebunden an 4 Alarm-Flaechen:
- EscalationHistory (Deadman, Szenario A)
- TaskBrowser Spool-Tab (Szenario B) + Dead-Letter-Tab (B3)
- TaskBrowser/OpsPanels Degraded/Error (Health, Szenario C)
Keine Ampelfarben/Deadman-Logik/Degraded-Banner/Datenpfade angefasst (CHO-NICHT ANFASSEN erfuellt).
Build verifiziert: tsc --noEmit clean, next build gruen (/runbook static).
This commit is contained in:
@@ -0,0 +1,100 @@
|
||||
/**
|
||||
* /runbook — Statische Notfall-Runbook-Seite des Towers (Server Component).
|
||||
* Karte tower-notfall-runbook, DATEI 2: rendert die Runbook-Datei als
|
||||
* schlichte Markdown-/Textseite — rein statisch, kein Script, keine
|
||||
* externen URLs, keine Secrets. Anker (#deadman etc.) kommen aus der MD.
|
||||
*/
|
||||
|
||||
import { readFile } from "node:fs/promises"
|
||||
import path from "node:path"
|
||||
|
||||
export const dynamic = "force-static"
|
||||
export const metadata = { title: "Notfall-Runbook Tower" }
|
||||
|
||||
const MD_PATH = path.join(process.cwd(), "public", "runbook", "runbook-tower-notfall.md")
|
||||
|
||||
/** Minimaler Markdown->HTML-Renderer (keine Dep, kein Script-Output). */
|
||||
function renderMarkdown(md: string): string {
|
||||
const esc = (s: string) =>
|
||||
s.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """)
|
||||
const lines = md.split(/\r?\n/)
|
||||
const out: string[] = []
|
||||
let inCode = false
|
||||
let listOpen = false
|
||||
const closeList = () => {
|
||||
if (listOpen) {
|
||||
out.push("</ul>")
|
||||
listOpen = false
|
||||
}
|
||||
}
|
||||
for (const raw of lines) {
|
||||
const line = raw
|
||||
// Bekannt-sichere Anker-Tags aus der Runbook-MD unverändert durchreichen
|
||||
// (Deep-Link-Ziele #deadman/#spool/#deadletter/#health).
|
||||
const anchor = line.match(/^<a id="([a-z]+)"><\/a>$/)
|
||||
if (anchor && !inCode) {
|
||||
out.push(`<span id="${anchor[1]}"></span>`)
|
||||
continue
|
||||
}
|
||||
if (/^```/.test(line)) {
|
||||
closeList()
|
||||
out.push(inCode ? "</code></pre>" : '<pre class="runbook-code"><code>')
|
||||
inCode = !inCode
|
||||
continue
|
||||
}
|
||||
if (inCode) {
|
||||
out.push(esc(line))
|
||||
continue
|
||||
}
|
||||
const h = line.match(/^(#{1,4})\s+(.*)$/)
|
||||
if (h) {
|
||||
closeList()
|
||||
const lvl = Math.min(h[1].length + 1, 5) // h1->h2 (Seitenh1 ist der Titel)
|
||||
out.push(`<h${lvl}>${esc(h[2])}</h${lvl}>`)
|
||||
continue
|
||||
}
|
||||
if (/^\s*[-*]\s+/.test(line)) {
|
||||
if (!listOpen) {
|
||||
out.push('<ul class="runbook-list">')
|
||||
listOpen = true
|
||||
}
|
||||
out.push(`<li>${esc(line.replace(/^\s*[-*]\s+/, ""))}</li>`)
|
||||
continue
|
||||
}
|
||||
if (line.trim() === "") {
|
||||
closeList()
|
||||
continue
|
||||
}
|
||||
out.push(`<p>${esc(line)}</p>`)
|
||||
}
|
||||
closeList()
|
||||
return out.join("\n")
|
||||
}
|
||||
|
||||
export default async function RunbookPage() {
|
||||
let md = ""
|
||||
try {
|
||||
md = await readFile(MD_PATH, "utf8")
|
||||
} catch {
|
||||
md = "# Runbook nicht gefunden\n\nDie Runbook-Datei ist im Image nicht vorhanden (public/runbook/runbook-tower-notfall.md)."
|
||||
}
|
||||
const html = renderMarkdown(md)
|
||||
return (
|
||||
<main className="panel mx-auto my-8 max-w-4xl p-8" data-testid="runbook-page">
|
||||
<h1 className="text-lg font-semibold uppercase tracking-wider text-[var(--nvidia-green)]">
|
||||
Notfall-Runbook Tower
|
||||
</h1>
|
||||
<p className="mt-1 text-xs text-[var(--foreground-dim)]">
|
||||
Statisch · Deep-Link-Ziele der Alarm-Ampeln:{" "}
|
||||
<a className="text-[#93c5fd] underline" href="#deadman">#deadman</a> ·{" "}
|
||||
<a className="text-[#93c5fd] underline" href="#spool">#spool</a> ·{" "}
|
||||
<a className="text-[#93c5fd] underline" href="#deadletter">#deadletter</a> ·{" "}
|
||||
<a className="text-[#93c5fd] underline" href="#health">#health</a>
|
||||
</p>
|
||||
<div
|
||||
className="runbook-body mt-6 space-y-2 text-sm leading-relaxed"
|
||||
dangerouslySetInnerHTML={{ __html: html }}
|
||||
/>
|
||||
</main>
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user