import Link from "next/link"; import { ContentHeader } from "@/components/layout/ContentHeader"; import { HostFilterLeiste } from "@/components/hosts/HostFilterLeiste"; import { AblaufBadge, KeineMeldungBadge, StatusBadge } from "@/components/ui/Badges"; import { Card } from "@/components/ui/Card"; import { CopyableCode } from "@/components/ui/CopyableCode"; import { PRODUKT_TEXT } from "@/lib/anzeige"; import { formatDatumZeit } from "@/lib/format"; import { filterOptionen, hostListe, type HostFilter } from "@/server/queries/hostliste"; export const metadata = { title: "Hosts" }; type SuchParameter = Promise>; function einzeln(wert: string | string[] | undefined): string | undefined { const text = Array.isArray(wert) ? wert[0] : wert; return text && text.length > 0 ? text : undefined; } /** Baut eine Adresse mit geänderten Parametern – für Sortierung, Blättern und Export. */ function mitParametern( basis: Record, aenderung: Record = {}, pfad = "/hosts", ) { const params = new URLSearchParams(); for (const [schluessel, wert] of Object.entries({ ...basis, ...aenderung })) { if (wert) params.set(schluessel, wert); } const text = params.toString(); return text ? `${pfad}?${text}` : pfad; } /** Spaltenkopf, der beim Klick die Sortierung umschaltet. */ function SortierKopf({ titel, feld, basis, sortierung, }: { titel: string; feld: string; basis: Record; sortierung: string | undefined; }) { const aktiv = (sortierung ?? "hostname").startsWith(feld); const absteigend = sortierung === `${feld}-ab`; return ( {titel} {aktiv ? (