// Project page section «Ошибки» (PEP-58): connect Bugsink, incident policy, incidents list. import { Bug, CircleCheck, EyeOff, Inbox, MapPin, Play } from "lucide-react"; import { INCIDENT_STATUS_RU, incidentPolicies, POLICY_RU, type ErrorSource, type Incident, type IncidentSettings } from "@peppa/core"; import { connectErrorTrackingAction, decideIncidentAction, resolveIncidentAction, saveIncidentSettings } from "@/app/(app)/actions"; import { Hidden } from "@/components/cards"; import { ago, Disclosure, Empty, Key, Section } from "@/components/common"; import { Badge } from "@/components/ui/badge"; import { Button } from "@/components/ui/button"; import { Input, Label, NativeSelect, Textarea } from "@/components/ui/input"; const STATUS_TONE: Record = { new: "danger", open: "warn", pending: "warn", task: "info", ignored: "muted", resolved: "ok", regressed: "danger" }; function Code({ children }: { children: React.ReactNode }) { return {children}; } export function IncidentsSection(props: { projectId: number; projectKey: string; back: string; isOwner: boolean; settings: IncidentSettings | null; sources: ErrorSource[]; incidents: Incident[]; taskKeys: Map; webhookUrl: string | null; }) { const { projectId, back, settings: s } = props; if (!s) { return (

Ошибки фронта и бэка из прода (Bugsink, SDK Sentry) приходят сюда и становятся задачами по политике проекта.

{props.isOwner ? (
) : ( Не подключено — подключает владелец проекта. )}
); } const active = props.incidents.filter((i) => !["ignored", "resolved"].includes(i.status)); const rest = props.incidents.filter((i) => ["ignored", "resolved"].includes(i.status)); return (
политика: {POLICY_RU[s.policy]}}> {active.length === 0 ? Открытых ошибок нет. : active.map((i) => )} {rest.length > 0 && (
{rest.map((i) => ( ))}
)}
{props.sources.map((src) => (
DSN {src.kind === "web" ? "фронта (web)" : "бэка (api)"} {src.dsn}
))}

В коде: NEXT_PUBLIC_SENTRY_DSN / SENTRY_DSN из окружения, release = SHA деплоя,{" "} environment = prod, sendDefaultPii: false.

{!s.webhookAuto && props.webhookUrl && (
Вебхук не настроен автоматически. В Bugsink: проект → Alerts → Custom webhook: {props.webhookUrl} Пока его нет, Пеппа опрашивает Bugsink раз в 2 минуты.
)}