// PEP-218: the project's tab «Баги» — errors of its own Bugsink projects (`-web` / // `-api`), read on the server, in the same view as the superadmin's /observability. import Link from "next/link"; import { errorScope, listErrors } from "@peppa/core"; import { ErrorFilters, errorFilterFrom, ErrorRows, ErrorsDown } from "@/components/Errors"; import { Section } from "@/components/common"; import { requireUser } from "@/lib/auth"; import { db } from "@/lib/db"; import { getT } from "@/lib/i18n"; export type ErrorSearch = { bp?: string; state?: string; env?: string; rel?: string; q?: string; sort?: string; cursor?: string }; export async function ProjectErrors({ projectId, projectKey, sp }: { projectId: number; projectKey: string; sp: ErrorSearch }) { const user = await requireUser(); const t = await getT(); const scope = await errorScope(db, user, { projectId }); if (!scope.projects.length) return null; const f = errorFilterFrom(sp); const list = await listErrors(db, scope, f); const query = new URLSearchParams(Object.entries({ tab: "bugs", bp: sp.bp, state: sp.state, env: sp.env, rel: sp.rel, q: sp.q, sort: sp.sort }).filter((e): e is [string, string] => !!e[1])); const from = `/p/${projectKey}?${query}`; return (
{list.next ? ( {t("Дальше →")} ) : null}
); }