Skip to content
refs
History
25 lines · 1.2 KBRaw
1import type { Route } from "./+types/namespace-agents";
2import { HostedAgentsPage, agentsAction, editingFrom } from "../components/hosted-agents";
3import { AppShell, PageHeader } from "../components/shell";
4import { found, signedIn } from "../lib/session";
5
6export const meta: Route.MetaFunction = () => [{ title: "Agents · refs" }];
7
8export async function loader({ request, context }: Route.LoaderArgs) {
9 const agents = await found(signedIn(context).namespaceAgents());
10 const list = await agents.list();
11 return { list, canEdit: agents.canEdit, editing: editingFrom(request, list, "namespace") };
12}
13
14export async function action({ request, context }: Route.ActionArgs) {
15 return agentsAction(await found(signedIn(context).namespaceAgents()), request, "/settings/agents");
16}
17
18export default function NamespaceAgents({ loaderData, actionData }: Route.ComponentProps) {
19 return (
20 <AppShell>
21 <PageHeader title="Agents" description="Agents that refs runs for every repository in this namespace. A repository can customize one for itself." />
22 <HostedAgentsPage list={loaderData.list} canEdit={loaderData.canEdit} level="namespace" editing={loaderData.editing} error={actionData?.error ?? null} />
23 </AppShell>
24 );
25}