Something went wrong. Try again.
Identities for entities did.bot
agent llm did
Something went wrong. Try again.
1.4 kB · 38 lines
TypeScript
at commit 18ba4fe0
123456789101112131415161718192021222324252627282930313233343536373839import type { Problem, RevisionProblem } from "../checks.ts";import { h } from "../dom.ts";
/** "ok", or how many errors and warnings the checks found. */export function summary(problems: Problem[]): string { const errors = problems.filter((p) => p.severity === "error").length; const warnings = problems.length - errors; if (problems.length === 0) return "ok"; const parts = []; if (errors) parts.push(`${errors} ${errors === 1 ? "error" : "errors"}`); if (warnings) parts.push(`${warnings} ${warnings === 1 ? "warning" : "warnings"}`); return parts.join(", ");}
export function hasErrors(problems: Problem[]): boolean { return problems.some((p) => p.severity === "error");}
/** Each problem with its severity, the record it is in (if given), its path and message. */export function problemList(problems: (Problem | RevisionProblem)[]): HTMLElement { return h( "ul", { class: "problems" }, ...problems.map((problem) => h( "li", { class: problem.severity }, h("span", { class: "severity" }, problem.severity), " ", "rkey" in problem ? h("code", {}, `${problem.collection}/${problem.rkey}`) : null, "rkey" in problem ? " " : null, h("code", {}, problem.path || "(record)"), " ", h("span", { class: "message" }, problem.message), ), ), );}