feat(BIT-247): consolidate error reporting repo from OTT

Merge ingest-api, collector-worker, admin-ui, database/error_reporting, deploy/lxc,
docker-compose, and deployment docs into the dedicated repository. Paths updated
for repo root (ER_REPO_ROOT, systemd WorkingDirectory). Root README documents layout.

Co-Authored-By: Paperclip <[email protected]>
This commit is contained in:
1sonhadorandPaperclip committed 2026-03-22 18:20:27 +00:00
1 parent eeb5039a3c
commit b0b733d5e1
88 files changed
+19321

No files matched your search

+58
View File
@@ -0,0 +1,58 @@
import Link from "next/link";
import type { ReactNode } from "react";
export function AppShell({
children,
title,
breadcrumb,
}: {
children: ReactNode;
title: string;
breadcrumb?: { label: string; href?: string }[];
}) {
return (
<div className="er-app d-flex min-vh-100">
<aside className="er-sidebar text-white d-flex flex-column flex-shrink-0 p-3">
<Link href="/" className="text-white text-decoration-none fs-5 fw-semibold mb-4">
BitReport
<span className="d-block small text-white-50 fw-normal">Error reporting</span>
</Link>
<nav className="nav flex-column gap-1">
<Link className="nav-link text-white-50 er-nav-link" href="/">
Painel
</Link>
<Link className="nav-link text-white-50 er-nav-link" href="/incidents">
Incidentes
</Link>
</nav>
<div className="mt-auto small text-white-50 pt-4">
UI shell ·{" "}
<abbr title="Consistência visual com template Velzon (Bootstrap 5)">Velzon base</abbr>
</div>
</aside>
<div className="flex-grow-1 d-flex flex-column min-vw-0">
<header className="er-topbar border-bottom bg-body px-4 py-3 d-flex align-items-center justify-content-between">
<div>
<h1 className="h5 mb-1">{title}</h1>
{breadcrumb && breadcrumb.length > 0 ? (
<nav aria-label="breadcrumb">
<ol className="breadcrumb mb-0 small">
{breadcrumb.map((b, idx) => (
<li
key={`${b.label}-${idx}`}
className={`breadcrumb-item${b.href ? "" : " active"}`}
{...(!b.href ? { "aria-current": "page" } : {})}
>
{b.href ? <Link href={b.href}>{b.label}</Link> : b.label}
</li>
))}
</ol>
</nav>
) : null}
</div>
</header>
<main className="flex-grow-1 p-4 er-main">{children}</main>
</div>
</div>
);
}
+16
View File
@@ -0,0 +1,16 @@
export function DataAlert({
variant,
title,
body,
}: {
variant: "warning" | "danger" | "info";
title: string;
body: string;
}) {
return (
<div className={`alert alert-${variant}`} role="status">
<strong className="d-block mb-1">{title}</strong>
{body}
</div>
);
}
+45
View File
@@ -0,0 +1,45 @@
"use client";
import { useEffect, useId, useState } from "react";
const _storageKey = (id: string) => `er-incident-notes:${id}`;
export function IncidentNotes({ incidentId }: { incidentId: string }) {
const _id = useId();
const [value, setValue] = useState("");
useEffect(() => {
if (typeof window === "undefined") {
return;
}
const _stored = window.sessionStorage.getItem(_storageKey(incidentId));
setValue(_stored ?? "");
}, [incidentId]);
useEffect(() => {
if (typeof window === "undefined") {
return;
}
window.sessionStorage.setItem(_storageKey(incidentId), value);
}, [incidentId, value]);
return (
<div>
<label className="form-label" htmlFor={_id}>
Notas do operador
</label>
<textarea
id={_id}
className="form-control font-monospace small"
rows={5}
value={value}
onChange={(e) => setValue(e.target.value)}
placeholder="Rascunho local (sessionStorage). A persistência no servidor chega com a API admin (BIT-179)."
/>
<p className="form-text mb-0">
Estas notas não são enviadas ao servidor nesta fase — apenas para acompanhamento na sessão do
browser.
</p>
</div>
);
}
+20
View File
@@ -0,0 +1,20 @@
export function KpiCard({
label,
value,
variant,
}: {
label: string;
value: number;
variant: "primary" | "danger" | "warning" | "success" | "secondary" | "dark";
}) {
return (
<div className="col-sm-6 col-xl-3">
<div className={`card border-${variant} border-opacity-25 h-100`}>
<div className="card-body">
<p className="text-muted text-uppercase small mb-1">{label}</p>
<p className={`display-6 fw-semibold text-${variant} mb-0`}>{value}</p>
</div>
</div>
</div>
);
}
+21
View File
@@ -0,0 +1,21 @@
import type { Severity } from "@/lib/types";
const _labels: Record<Severity, string> = {
critical: "Crítico",
high: "Alto",
medium: "Médio",
low: "Baixo",
info: "Info",
};
const _class: Record<Severity, string> = {
critical: "text-bg-dark",
high: "text-bg-danger",
medium: "text-bg-warning",
low: "text-bg-info",
info: "text-bg-light text-dark border",
};
export function SeverityBadge({ severity }: { severity: Severity }) {
return <span className={`badge ${_class[severity]}`}>{_labels[severity]}</span>;
}
+19
View File
@@ -0,0 +1,19 @@
import type { IncidentState } from "@/lib/types";
const _labels: Record<IncidentState, string> = {
open: "Aberto",
investigating: "Em investigação",
resolved: "Resolvido",
ignored: "Ignorado",
};
const _class: Record<IncidentState, string> = {
open: "text-bg-danger",
investigating: "text-bg-warning",
resolved: "text-bg-success",
ignored: "text-bg-secondary",
};
export function StateBadge({ state }: { state: IncidentState }) {
return <span className={`badge ${_class[state]}`}>{_labels[state]}</span>;
}