430 lines
25 KiB
TypeScript
430 lines
25 KiB
TypeScript
import Link from "next/link";
|
||
import { ExternalLink, PlugZap, Search } from "lucide-react";
|
||
import {
|
||
CATALOG_KIND_TEXT,
|
||
CATALOG_KINDS,
|
||
catalogService,
|
||
CONNECTION_CHECK_TEXT,
|
||
CONNECTION_REASON_TEXT,
|
||
connectionJournal,
|
||
JOURNAL_VERIFY_SCRIPT,
|
||
grantableAgents,
|
||
listConnections,
|
||
listUserProjects,
|
||
searchCatalog,
|
||
type CatalogKind,
|
||
type CatalogService,
|
||
type ConnectionGrantView,
|
||
type ConnectionLogView,
|
||
type ConnectionReason,
|
||
type ConnectionView,
|
||
type GrantMode,
|
||
} from "@peppa/core";
|
||
import { Hidden } from "@/components/cards";
|
||
import { ago, Empty, Flash, Notice, PageHeader, Section } from "@/components/common";
|
||
import { Badge } from "@/components/ui/badge";
|
||
import { Button } from "@/components/ui/button";
|
||
import { Card } from "@/components/ui/card";
|
||
import { Input, Textarea } from "@/components/ui/input";
|
||
import { Workspace } from "@/components/Workspace";
|
||
import { requireUser, uiMode } from "@/lib/auth";
|
||
import { db } from "@/lib/db";
|
||
import { getT } from "@/lib/i18n";
|
||
import type { Translator } from "@peppa/shared/i18n";
|
||
import { checkConnectionAction, createConnectionAction, deleteConnectionAction, grantConnectionAction, replaceConnectionSecretAction, revokeConnectionAction, revokeGrantAction } from "../actions";
|
||
|
||
export async function generateMetadata() {
|
||
const t = await getT();
|
||
return { title: t("Подключения — FORGE") };
|
||
}
|
||
|
||
type Params = { error?: string; created?: string; checked?: string; check?: string; service?: string; q?: string; kind?: string };
|
||
|
||
const SELECT = "h-9 rounded-md border border-input bg-background px-2 text-sm";
|
||
const BACK = "/connections";
|
||
|
||
function Decision({ row, t }: { row: ConnectionLogView; t: Translator }) {
|
||
// PEP-254: the call is written before the service answers; no result after a while — a crash in the middle.
|
||
if (row.state === "running") return <Badge variant="outline">{t("выполняется")}</Badge>;
|
||
if (row.state === "unfinished") return <Badge variant="warn">{t("начато, итога нет")}</Badge>;
|
||
if (row.decision === "allowed") return <Badge variant="ok">{t("разрешено")}</Badge>;
|
||
if (row.decision === "denied") return <Badge variant="danger">{t("запрещено")}</Badge>;
|
||
return <Badge variant="warn">{t("не выполнено")}</Badge>;
|
||
}
|
||
|
||
const reasonText = (r: string | null, t: Translator) => (r && r in CONNECTION_REASON_TEXT ? t.text(CONNECTION_REASON_TEXT[r as ConnectionReason]) : "");
|
||
const kindText = (k: CatalogKind, t: Translator) => t.text(CATALOG_KIND_TEXT[k]);
|
||
|
||
/** «ключ работает» / «ключ не подходит» / «сервис не отвечает» / «ещё не проверялся». */
|
||
function KeyState({ c, t }: { c: ConnectionView; t: Translator }) {
|
||
if (c.status !== "active") return <Badge variant="danger">{t("доступ отозван")}</Badge>;
|
||
if (!c.checkStatus) return <Badge variant="outline">{t("ключ ещё не проверялся")}</Badge>;
|
||
const text = t.text(CONNECTION_CHECK_TEXT[c.checkStatus]);
|
||
return <Badge variant={c.checkStatus === "ok" ? "ok" : c.checkStatus === "bad_key" ? "danger" : "warn"}>{text}</Badge>;
|
||
}
|
||
|
||
function modeText(m: GrantMode, t: Translator): string {
|
||
return m === "auto" ? t("сразу") : m === "ask" ? t("спрашивать меня") : t("нет");
|
||
}
|
||
|
||
function GrantLine({ g, engineer, t }: { g: ConnectionGrantView; engineer: boolean; t: Translator }) {
|
||
return (
|
||
<li className="flex flex-wrap items-center gap-2 rounded-md border bg-background/40 px-2.5 py-1.5">
|
||
<span className="font-medium">{g.projectKey}</span>
|
||
<span>· {g.agentName ? t("агент {name}", { name: g.agentName }) : t("любой агент проекта")}</span>
|
||
<span className="text-muted-foreground">
|
||
· {t("чтение: {mode}", { mode: modeText(g.readMode, t) })} · {t("запись: {mode}", { mode: modeText(g.writeMode, t) })}
|
||
</span>
|
||
{engineer && g.operations.length > 0 && <span className="font-mono text-xs text-muted-foreground">{g.operations.join(", ")}</span>}
|
||
<form action={revokeGrantAction} className="ml-auto">
|
||
<Hidden fields={{ grantId: g.id, back: BACK }} />
|
||
<Button variant="ghost" size="sm">{t("Убрать")}</Button>
|
||
</form>
|
||
</li>
|
||
);
|
||
}
|
||
|
||
function ModeSelect({ name, label, def, t }: { name: string; label: string; def: GrantMode; t: Translator }) {
|
||
return (
|
||
<label className="flex flex-col gap-1 text-sm">
|
||
<span className="text-muted-foreground">{label}</span>
|
||
<select name={name} defaultValue={def} className={SELECT}>
|
||
<option value="auto">{t("Выполнять сразу")}</option>
|
||
<option value="ask">{t("Спрашивать меня")}</option>
|
||
<option value="off">{t("Не разрешать")}</option>
|
||
</select>
|
||
</label>
|
||
);
|
||
}
|
||
|
||
function GrantForm({ c, projects, agents, engineer, t }: { c: ConnectionView; projects: Array<{ id: number; key: string; name: string }>; agents: Array<{ id: number; name: string }>; engineer: boolean; t: Translator }) {
|
||
return (
|
||
<form action={grantConnectionAction} className="flex flex-col gap-3 rounded-md border border-dashed p-3">
|
||
<Hidden fields={{ connectionId: c.id, back: BACK }} />
|
||
<div className="flex flex-wrap gap-2">
|
||
<label className="flex flex-col gap-1 text-sm">
|
||
<span className="text-muted-foreground">{t("Проект")}</span>
|
||
<select name="projectId" required className={SELECT}>
|
||
{projects.map((p) => (
|
||
<option key={p.id} value={p.id}>
|
||
{p.key} — {p.name}
|
||
</option>
|
||
))}
|
||
</select>
|
||
</label>
|
||
<label className="flex flex-col gap-1 text-sm">
|
||
<span className="text-muted-foreground">{t("Агент")}</span>
|
||
<select name="agentId" className={SELECT} defaultValue="">
|
||
<option value="">{t("Любой агент проекта")}</option>
|
||
{agents.map((a) => (
|
||
<option key={a.id} value={a.id}>
|
||
{a.name}
|
||
</option>
|
||
))}
|
||
</select>
|
||
</label>
|
||
<ModeSelect name="readMode" label={t("Чтение")} def="auto" t={t} />
|
||
<ModeSelect name="writeMode" label={t("Запись")} def="off" t={t} />
|
||
</div>
|
||
<p className="m-0 text-xs text-muted-foreground">
|
||
{t("Чтение — смотреть данные, ничего не меняя. Запись — создавать, менять, удалять и отправлять. «Спрашивать меня» пока означает отказ: подтверждение запросов появится позже.")}
|
||
</p>
|
||
{engineer && (
|
||
<details className="text-sm">
|
||
<summary className="cursor-pointer text-muted-foreground">{t("Тонкая настройка")}</summary>
|
||
<div className="mt-2 flex flex-col gap-1">
|
||
<Textarea name="operations" rows={2} placeholder={"GET /items\nPOST /orders"} aria-label={t("Разрешённые операции")} className="font-mono" spellCheck={false} />
|
||
<p className="m-0 text-xs text-muted-foreground">{t("По одной операции в строке: действие (GET — читать, POST — создавать, PUT и PATCH — менять, DELETE — удалять) и начало пути. «GET /items» разрешает читать /items и всё внутри, остальное запрещено.")}</p>
|
||
</div>
|
||
</details>
|
||
)}
|
||
<Button size="sm" className="self-start">{t("Разрешить")}</Button>
|
||
</form>
|
||
);
|
||
}
|
||
|
||
function ConnectionCard({ c, projects, agents, engineer, t }: { c: ConnectionView; projects: Array<{ id: number; key: string; name: string }>; agents: Array<{ id: number; name: string }>; engineer: boolean; t: Translator }) {
|
||
const active = c.status === "active";
|
||
const card = catalogService(c.catalogId);
|
||
return (
|
||
<Card id={`c${c.id}`} className="flex flex-col gap-4 p-4">
|
||
<div className="flex flex-wrap items-center gap-2">
|
||
<span className="text-base font-medium">{c.name}</span>
|
||
{card && card.name !== c.name && <Badge variant="outline">{card.name}</Badge>}
|
||
<KeyState c={c} t={t} />
|
||
{c.checkedAt && <span className="text-xs text-muted-foreground">{t("проверено {ago}", { ago: ago(c.checkedAt, t) })}</span>}
|
||
<span className="ml-auto text-xs text-muted-foreground">{c.lastUsedAt ? t("последний запрос {ago}", { ago: ago(c.lastUsedAt, t) }) : t("запросов ещё не было")}</span>
|
||
</div>
|
||
<div className="flex flex-wrap items-center gap-x-3 gap-y-1 text-xs text-muted-foreground">
|
||
<span className="truncate font-mono">{c.baseUrl}</span>
|
||
{engineer && <span>{t("имя для агентов: {slug}", { slug: c.slug })}</span>}
|
||
{card && (
|
||
<a href={card.docsUrl} target="_blank" rel="noreferrer noopener" className="inline-flex items-center gap-1 underline-offset-2 hover:underline">
|
||
{t("Документация сервиса")} <ExternalLink className="size-3" />
|
||
</a>
|
||
)}
|
||
{active && c.hasKey && (
|
||
<form action={checkConnectionAction} className="ml-auto">
|
||
<Hidden fields={{ connectionId: c.id, back: BACK }} />
|
||
<Button size="sm" variant="secondary">{t("Проверить")}</Button>
|
||
</form>
|
||
)}
|
||
</div>
|
||
|
||
<div className="flex flex-col gap-2">
|
||
<span className="text-sm font-medium">{t("Кому разрешено")}</span>
|
||
{c.grants.length === 0 ? (
|
||
<p className="m-0 text-sm text-muted-foreground">{t("Пока никому: агенты не могут пользоваться этим подключением.")}</p>
|
||
) : (
|
||
<ul className="m-0 flex list-none flex-col gap-1 p-0 text-sm">
|
||
{c.grants.map((g) => (
|
||
<GrantLine key={g.id} g={g} engineer={engineer} t={t} />
|
||
))}
|
||
</ul>
|
||
)}
|
||
{active && projects.length > 0 && <GrantForm c={c} projects={projects} agents={agents} engineer={engineer} t={t} />}
|
||
</div>
|
||
|
||
<div className="flex flex-wrap items-end gap-2 border-t pt-3">
|
||
<form action={replaceConnectionSecretAction} className="flex flex-1 flex-wrap items-center gap-2" autoComplete="off">
|
||
<Hidden fields={{ connectionId: c.id, back: BACK }} />
|
||
<Input name="secret" type="password" required placeholder={active ? t("Новый ключ доступа") : t("Новый ключ доступа, чтобы включить снова")} aria-label={t("Новый ключ доступа")} className="max-w-xs" autoComplete="new-password" />
|
||
<Button size="sm" variant="secondary">{active ? t("Заменить ключ") : t("Включить снова")}</Button>
|
||
</form>
|
||
{active && (
|
||
<form action={revokeConnectionAction}>
|
||
<Hidden fields={{ connectionId: c.id, back: BACK }} />
|
||
<Button size="sm" variant="destructive">{t("Отозвать доступ")}</Button>
|
||
</form>
|
||
)}
|
||
<form action={deleteConnectionAction}>
|
||
<Hidden fields={{ connectionId: c.id, back: BACK }} />
|
||
<Button size="sm" variant="ghost">{t("Удалить")}</Button>
|
||
</form>
|
||
</div>
|
||
</Card>
|
||
);
|
||
}
|
||
|
||
function CheckNotice({ check, created, t }: { check?: string; created: boolean; t: Translator }) {
|
||
const head = created ? t("Подключение сохранено. Ключ доступа больше не показывается никому.") : "";
|
||
const tail =
|
||
check === "ok"
|
||
? t("Ключ работает. Теперь решите, кому из агентов его разрешить.")
|
||
: check === "reachable"
|
||
? t("Сервис отвечает. Ключ проверится при первом запросе агента.")
|
||
: check === "bad_key"
|
||
? t("Сервис не принял ключ: проверьте, что скопировали его целиком, и замените ключ.")
|
||
: check === "down"
|
||
? t("Сервис сейчас не отвечает. Ключ сохранён — проверьте позже кнопкой «Проверить».")
|
||
: "";
|
||
if (!head && !tail) return null;
|
||
return (
|
||
<Notice>
|
||
{head} {tail}
|
||
</Notice>
|
||
);
|
||
}
|
||
|
||
/** Step 1–2 for a chosen service (catalog card or own). */
|
||
function AddSteps({ s, t }: { s: CatalogService | null; t: Translator }) {
|
||
const back = `/connections?service=${s?.id ?? "custom"}#add`;
|
||
return (
|
||
<Card className="flex flex-col gap-4 p-4">
|
||
<div className="flex flex-wrap items-center gap-2">
|
||
<span className="text-base font-medium">{s ? s.name : t("Свой сервис")}</span>
|
||
{s && <Badge variant="outline">{kindText(s.kind, t)}</Badge>}
|
||
<Link href="/connections#add" className="ml-auto text-sm text-muted-foreground underline-offset-2 hover:underline">
|
||
{t("← Другой сервис")}
|
||
</Link>
|
||
</div>
|
||
<ol className="m-0 flex list-decimal flex-col gap-4 pl-5 text-sm">
|
||
{s ? (
|
||
<li className="flex flex-col gap-1">
|
||
<span className="font-medium">{t("Возьмите ключ доступа")}</span>
|
||
<span className="text-muted-foreground">{t.text(s.keyHint)}</span>
|
||
<a href={s.keyUrl} target="_blank" rel="noreferrer noopener" className="inline-flex items-center gap-1 self-start text-primary underline-offset-2 hover:underline">
|
||
{t("Открыть страницу, где берут ключ")} <ExternalLink className="size-3" />
|
||
</a>
|
||
</li>
|
||
) : (
|
||
<li className="flex flex-col gap-1">
|
||
<span className="font-medium">{t("Возьмите адрес сервиса и ключ доступа")}</span>
|
||
<span className="text-muted-foreground">{t("Они есть в описании сервиса для разработчиков или у того, кто его сделал.")}</span>
|
||
</li>
|
||
)}
|
||
<li className="flex flex-col gap-2">
|
||
<span className="font-medium">{t("Вставьте его сюда")}</span>
|
||
<form action={createConnectionAction} className="flex max-w-xl flex-col gap-2" autoComplete="off">
|
||
<Hidden fields={{ back, catalogId: s?.id ?? "" }} />
|
||
<Input name="name" maxLength={60} defaultValue={s?.name ?? ""} required={!s} placeholder={t("Название, например «Магазин»")} aria-label={t("Название")} />
|
||
{(!s || s.baseEditable) && <Input name="baseUrl" required type="url" placeholder={s?.baseUrl ?? "https://api.example.com/v1"} aria-label={t("Адрес сервиса")} className="font-mono" spellCheck={false} />}
|
||
<Input name="secret" required type="password" placeholder={s?.auth === "basic" ? t("логин:пароль — после сохранения их не увидит никто") : t("Ключ доступа — после сохранения его не увидит никто")} aria-label={t("Ключ доступа")} autoComplete="new-password" />
|
||
{!s && (
|
||
<div className="flex flex-wrap items-center gap-2 text-sm">
|
||
<select name="authKind" aria-label={t("Как передавать ключ")} className={SELECT} defaultValue="bearer">
|
||
<option value="bearer">{t("Как «Authorization: Bearer …»")}</option>
|
||
<option value="header">{t("В своём заголовке")}</option>
|
||
<option value="query">{t("В адресе запроса (параметр)")}</option>
|
||
<option value="basic">{t("Логин и пароль")}</option>
|
||
</select>
|
||
<Input name="authHeader" placeholder="X-Api-Key" aria-label={t("Имя заголовка или параметра")} className="max-w-48 font-mono" spellCheck={false} />
|
||
</div>
|
||
)}
|
||
<Button size="sm" className="self-start">{t("Подключить и проверить")}</Button>
|
||
</form>
|
||
</li>
|
||
<li className="flex flex-col gap-1 text-muted-foreground">
|
||
<span className="font-medium text-foreground">{t("Проверим ключ и решите, кому разрешить")}</span>
|
||
<span>{t("После сохранения FORGE сам сделает проверочный запрос, а вы выберете проект, агента и что можно: читать или менять.")}</span>
|
||
</li>
|
||
</ol>
|
||
</Card>
|
||
);
|
||
}
|
||
|
||
function Catalog({ q, kind, t }: { q: string; kind: string | null; t: Translator }) {
|
||
const list = searchCatalog(q, { kind, kindText: (k) => kindText(k, t) });
|
||
const chip = (active: boolean) => `rounded-full border px-3 py-1 text-xs ${active ? "border-primary bg-primary/10 text-foreground" : "text-muted-foreground hover:text-foreground"}`;
|
||
const href = (k: string | null) => `/connections?${new URLSearchParams({ ...(q ? { q } : {}), ...(k ? { kind: k } : {}) })}#add`;
|
||
return (
|
||
<Card className="flex flex-col gap-3 p-4">
|
||
<form action="/connections#add" className="flex flex-wrap gap-2" role="search">
|
||
{kind && <input type="hidden" name="kind" value={kind} />}
|
||
<div className="relative max-w-sm flex-1">
|
||
<Search className="pointer-events-none absolute top-2.5 left-2.5 size-4 text-muted-foreground" />
|
||
<Input name="q" defaultValue={q} placeholder={t("Найти сервис: почта, платежи, Stripe…")} aria-label={t("Найти сервис")} className="pl-8" />
|
||
</div>
|
||
<Button size="sm" variant="secondary">{t("Найти")}</Button>
|
||
</form>
|
||
<div className="flex flex-wrap gap-1.5">
|
||
<Link href={href(null)} className={chip(!kind)}>
|
||
{t("Все")}
|
||
</Link>
|
||
{CATALOG_KINDS.map((k) => (
|
||
<Link key={k} href={href(k)} className={chip(kind === k)}>
|
||
{kindText(k, t)}
|
||
</Link>
|
||
))}
|
||
</div>
|
||
<div className="grid grid-cols-2 gap-2 sm:grid-cols-3 lg:grid-cols-4">
|
||
{list.map((s) => (
|
||
<Link key={s.id} href={`/connections?service=${s.id}#add`} className="flex flex-col gap-0.5 rounded-md border bg-background/40 px-3 py-2 hover:border-primary">
|
||
<span className="text-sm font-medium">{s.name}</span>
|
||
<span className="text-xs text-muted-foreground">{kindText(s.kind, t)}</span>
|
||
</Link>
|
||
))}
|
||
<Link href="/connections?service=custom#add" className="flex flex-col gap-0.5 rounded-md border border-dashed px-3 py-2 hover:border-primary">
|
||
<span className="text-sm font-medium">{t("Свой сервис")}</span>
|
||
<span className="text-xs text-muted-foreground">{t("Адрес и ключ вручную")}</span>
|
||
</Link>
|
||
</div>
|
||
{list.length === 0 && <p className="m-0 text-sm text-muted-foreground">{t("Такого сервиса в списке нет — подключите его как «Свой сервис».")}</p>}
|
||
</Card>
|
||
);
|
||
}
|
||
|
||
/** PEP-254: download the journal with hashes and how to check it yourself. */
|
||
function JournalExport({ t, engineer }: { t: Translator; engineer: boolean }) {
|
||
return (
|
||
<div className="mt-3 space-y-2 text-sm">
|
||
<p className="m-0 text-muted-foreground">
|
||
{t("Журнал нельзя незаметно изменить: каждая запись связана с предыдущей, и раз в сутки FORGE сохраняет отметку журнала отдельно. Если запись изменят, вы и администратор получите сообщение.")}
|
||
</p>
|
||
<div className="flex flex-wrap gap-2">
|
||
<Button asChild size="sm" variant="outline">
|
||
<a href="/api/connections/journal?format=csv" download>{t("Скачать журнал (таблица)")}</a>
|
||
</Button>
|
||
<Button asChild size="sm" variant="outline">
|
||
<a href="/api/connections/journal?format=jsonl" download>{t("Скачать журнал для проверки")}</a>
|
||
</Button>
|
||
</div>
|
||
<details open={engineer}>
|
||
<summary className="cursor-pointer text-muted-foreground">{t("Как проверить журнал самому")}</summary>
|
||
<div className="mt-2 space-y-2">
|
||
<p className="m-0">
|
||
{t("Скачайте журнал для проверки и сохраните программу ниже рядом с ним. Запустите её так, как написано в её первой строке. Ответ «ok» значит, что журнал не меняли; иначе программа назовёт первую изменённую запись.")}
|
||
</p>
|
||
<pre className="overflow-x-auto rounded-md bg-muted p-2 text-xs">{JOURNAL_VERIFY_SCRIPT}</pre>
|
||
</div>
|
||
</details>
|
||
</div>
|
||
);
|
||
}
|
||
|
||
/** PEP-234/249 Access Hub: «Подключения» — the user's own external services and who may use them. */
|
||
export default async function ConnectionsPage({ searchParams }: { searchParams: Promise<Params> }) {
|
||
const q = await searchParams;
|
||
const user = await requireUser();
|
||
const t = await getT();
|
||
const engineer = (await uiMode()) === "engineer";
|
||
const [list, journal, projects, agents] = await Promise.all([listConnections(db, user.id), connectionJournal(db, user.id, { limit: 50 }), listUserProjects(db, user.id), grantableAgents(db)]);
|
||
const chosen = q.service === "custom" ? "custom" : catalogService(q.service);
|
||
const kind = q.kind && (CATALOG_KINDS as string[]).includes(q.kind) ? q.kind : null;
|
||
return (
|
||
<Workspace>
|
||
<Flash error={q.error} />
|
||
{(q.created || q.checked) && <CheckNotice check={q.check} created={!!q.created} t={t} />}
|
||
<PageHeader title={<><PlugZap className="mr-1 inline size-5 text-primary" />{t("Подключения")}</>}>
|
||
<p className="m-0 text-sm text-muted-foreground">
|
||
{t("Подключите свои сервисы и решите, какие агенты и что в них могут делать. Агенты не видят ключ доступа: запросы выполняет FORGE и записывает их в журнал. Без вашего разрешения агент ничего не сделает, а «Отозвать доступ» действует сразу.")}
|
||
</p>
|
||
</PageHeader>
|
||
|
||
{list.length > 0 && (
|
||
<Section title={t("Ваши подключения")} count={list.length}>
|
||
{list.map((c) => (
|
||
<ConnectionCard key={c.id} c={c} projects={projects} agents={agents} engineer={engineer} t={t} />
|
||
))}
|
||
</Section>
|
||
)}
|
||
|
||
<Section id="add" title={t("Подключить сервис")}>
|
||
{chosen ? <AddSteps s={chosen === "custom" ? null : chosen} t={t} /> : <Catalog q={(q.q ?? "").slice(0, 80)} kind={kind} t={t} />}
|
||
</Section>
|
||
|
||
<Section title={t("Журнал запросов")} count={journal.length}>
|
||
{journal.length === 0 ? (
|
||
<Empty>{t("Агенты ещё не обращались к вашим подключениям.")}</Empty>
|
||
) : (
|
||
<div className="overflow-x-auto">
|
||
<table className="w-full text-sm">
|
||
<thead className="text-left text-xs text-muted-foreground">
|
||
<tr>
|
||
<th className="py-1 pr-3 font-normal">{t("Когда")}</th>
|
||
<th className="py-1 pr-3 font-normal">{t("Подключение")}</th>
|
||
<th className="py-1 pr-3 font-normal">{t("Проект и агент")}</th>
|
||
<th className="py-1 pr-3 font-normal">{t("Операция")}</th>
|
||
<th className="py-1 font-normal">{t("Решение")}</th>
|
||
</tr>
|
||
</thead>
|
||
<tbody>
|
||
{journal.map((r) => (
|
||
<tr key={r.id} className="border-t align-top">
|
||
<td className="py-1.5 pr-3 whitespace-nowrap text-muted-foreground">{ago(r.createdAt, t)}</td>
|
||
<td className="py-1.5 pr-3">{r.connectionName}</td>
|
||
<td className="py-1.5 pr-3">
|
||
{r.projectKey ?? "—"}
|
||
{r.agentName ? ` · ${r.agentName}` : ""}
|
||
</td>
|
||
<td className="py-1.5 pr-3 font-mono text-xs">
|
||
{r.method} {r.path}
|
||
</td>
|
||
<td className="py-1.5">
|
||
<span className="flex flex-wrap items-center gap-1.5">
|
||
<Decision row={r} t={t} />
|
||
<span className="text-xs text-muted-foreground">{reasonText(r.reason, t)}</span>
|
||
</span>
|
||
</td>
|
||
</tr>
|
||
))}
|
||
</tbody>
|
||
</table>
|
||
</div>
|
||
)}
|
||
<JournalExport t={t} engineer={engineer} />
|
||
</Section>
|
||
</Workspace>
|
||
);
|
||
}
|