feat: environments and production-to-staging relations (auth M6b)

- environment (production/staging/development) on source orbits and on restore targets;
  an unlabelled target fails closed and a production target is refused
- directed, versioned relations from a managed source orbit to a restore target: one
  active relation per pair, retargeting makes a new id and ends the old one
- refusals name the rule: unknown or unlabelled source/target, not a managed capture
  profile, not restore-ready, application or engine mismatch, inactive Outpost, and a
  target whose identity matches a database captured as production in any snapshot
- relations end in the same transaction when their target is relabelled production or an
  Outpost is revoked; usability is re-read live
- refresh.run is granted per relation id in its own table (user or group, expiry), never
  global, never carried to a new version, and never accepted by the orbit gate
- admin API under /api/v1/relations plus environment endpoints; people holding only a
  relation grant see names and environments, never identity, host, Outpost or application
- Relations console; sign-in form without SSO no longer shows a stray "Details" label

Tests extend the access matrix with relation fixtures and a caller that holds only a
relation grant.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-14 17:46:08 +07:00
parent e72b72111d
commit 5c4e0bf4a9
17 changed files with 1776 additions and 24 deletions

View File

@@ -7,8 +7,9 @@ import {
} from "./api";
import { OrbitInspector, OrbitRegister, TelemetryStrip } from "./components/hud/DiegeticHUD";
import { HUDPanel } from "./components/hud/HUDPanel";
import { accessItem, HUDRail, hudItems, type HUDMode } from "./components/hud/HUDRail";
import { accessItem, HUDRail, hudItems, relationsItem, type HUDMode } from "./components/hud/HUDRail";
import { AccessView } from "./components/access/AccessView";
import { RelationsView } from "./components/relations/RelationsView";
import { SearchIcon, VaultSearch } from "./components/hud/VaultSearch";
import { OperatorGate, type Caps } from "./components/operator/OperatorGate";
import { OrbitsView } from "./components/orbits/OrbitsView";
@@ -35,6 +36,7 @@ const panelTitles: Record<HUDMode, string> = {
wormhole: "Wormhole uplink",
activity: "Activity",
access: "Access",
relations: "Refresh relations",
reconstitute: "Restore snapshot",
snapshot: "Snapshot detail",
};
@@ -44,10 +46,11 @@ const panelLabels: Record<HUDMode, string> = {
wormhole: "Console 03 · Outposts",
activity: "Console 04 · Activity",
access: "Console 05 · Access",
relations: "Console 06 · Relations",
reconstitute: "Restore from a snapshot",
snapshot: "Recovery point",
};
const panelWidths: Record<HUDMode, number> = { scene: 640, orbits: 1120, wormhole: 760, activity: 1120, access: 1120, reconstitute: 760, snapshot: 640 };
const panelWidths: Record<HUDMode, number> = { scene: 640, orbits: 1120, wormhole: 760, activity: 1120, access: 1120, relations: 1120, reconstitute: 760, snapshot: 640 };
const LOOK_KEY = "tessera.look";
@@ -237,7 +240,7 @@ function VaultApp({ actor, onLogout, caps }: { actor?: string; onLogout?: () =>
const activity = useActivity(snaps.data, orbits.data, caps.admin);
// Consoles a non-administrator never sees: managing orbits and Outposts, restores, and access.
const railItems = useMemo(
() => (caps.admin ? [...hudItems, accessItem] : hudItems.filter((item) => item.id === "scene" || item.id === "activity")),
() => (caps.admin ? [...hudItems, relationsItem, accessItem] : hudItems.filter((item) => item.id === "scene" || item.id === "activity")),
[caps.admin],
);
const failedCount = sceneOrbits.filter(({ last_status }) => last_status === "failed").length;
@@ -429,6 +432,9 @@ function VaultApp({ actor, onLogout, caps }: { actor?: string; onLogout?: () =>
{mode === "wormhole" && caps.admin && (
<SpringPane key="wormhole"><WormholeView pairing={pairing} onPaired={setPairing} /></SpringPane>
)}
{mode === "relations" && caps.admin && (
<SpringPane key="relations"><RelationsView /></SpringPane>
)}
{mode === "access" && caps.admin && (
<SpringPane key="access"><AccessView orbits={orbits.data ?? []} /></SpringPane>
)}

View File

@@ -75,6 +75,56 @@ export async function fetchMe(signal?: AbortSignal): Promise<Me> {
return api<Me>("/api/v1/me", { signal });
}
export type Environment = "production" | "staging" | "development";
export type RelationView = {
id: string;
version: number;
source_orbit_id: string;
target_id: string;
engine: string;
verified: boolean;
active: boolean;
deactivated_reason: string | null;
source_name: string;
source_environment: Environment | null;
target_name: string;
target_environment: Environment | null;
usable: boolean;
unusable_reason: string | null;
};
export type OrbitSetup = {
id: string; name: string; environment: Environment | null; application_id: string | null;
engine: string | null; ready: boolean; reason: string | null;
};
export type TargetSetup = {
id: string; name: string; engine: string; identity: { instance: string; database: string };
application_id: string; environment: Environment | null; outpost_active: boolean;
};
export type RelationOverview = { relations: RelationView[]; orbits: OrbitSetup[]; targets: TargetSetup[] };
export type RelationGrant = { id: string; principal_type: "user" | "group"; principal: string; expires_at: number | null; created_at: number };
/** The rule a refused relation request names (`{"reason": "..."}`), if the error carries one. */
export function refusalReason(error: unknown): string | undefined {
try {
return JSON.parse((error as Error).message).reason;
} catch {
return undefined;
}
}
const json = (method: string, body: unknown) => ({ method, headers: { "Content-Type": "application/json" }, body: JSON.stringify(body) });
export const fetchRelations = () => api<RelationOverview>("/api/v1/relations");
export const setOrbitEnvironment = (id: string, environment: Environment) => api<void>(`/api/v1/orbits/${id}/environment`, json("PUT", { environment }));
export const setTargetEnvironment = (id: string, environment: Environment) =>
api<{ ended_relations: string[] }>(`/api/v1/restore-targets/${id}/environment`, json("PUT", { environment }));
export const createRelation = (source_orbit_id: string, target_id: string) => api<RelationView>("/api/v1/relations", json("POST", { source_orbit_id, target_id }));
export const retargetRelation = (id: string, target_id: string) => api<RelationView>(`/api/v1/relations/${id}`, json("PUT", { target_id }));
export const endRelation = (id: string) => api<void>(`/api/v1/relations/${id}`, { method: "DELETE" });
export const fetchRelationAccess = (id: string) => api<RelationGrant[]>(`/api/v1/relations/${id}/access`);
export const grantRelationAccess = (id: string, grant: { principal_type: "user" | "group"; principal: string; expires_at?: string }) =>
api<RelationGrant>(`/api/v1/relations/${id}/access`, json("POST", grant));
export const revokeRelationAccess = (id: string, grant: string) => api<void>(`/api/v1/relations/${id}/access/${grant}`, { method: "DELETE" });
export type Look = "window" | "radar";
/** The account's saved display choices. A hub without this endpoint, or an account without one, yields `{}`. */

View File

@@ -3,7 +3,7 @@ import { useCallback, useId, useLayoutEffect, useRef, type PointerEvent } from "
import { useScreenTransition } from "../../hooks/useScreenTransition";
import { uiSpring } from "../../lib/motion";
export type HUDMode = "scene" | "orbits" | "wormhole" | "activity" | "access" | "reconstitute" | "snapshot";
export type HUDMode = "scene" | "orbits" | "wormhole" | "activity" | "access" | "relations" | "reconstitute" | "snapshot";
export const hudItems = [
{ id: "scene", label: "Vault", icon: "M4 9l8-4 8 4v6l-8 4-8-4z M4 9l8 4 8-4 M12 13v6" },
@@ -20,6 +20,12 @@ export const accessItem: HUDItem = {
icon: "M12 3l7 3v5c0 4.5-3 8-7 10-4-2-7-5.5-7-10V6z M9.5 12l2 2 3.5-4",
};
/** Only for administrators: which source may overwrite which target. */
export const relationsItem: HUDItem = {
id: "relations", label: "Relations",
icon: "M6 6.5a2.5 2.5 0 1 0 0 .01z M18 17.5a2.5 2.5 0 1 0 0 .01z M8.5 6.5h5a4 4 0 0 1 4 4v4.5 M15 13l2.5 2.5L20 13",
};
type Slot = { center: number; width: number };
type Gesture = { pointer: number; x: number; y: number; origin?: number };

View File

@@ -124,22 +124,34 @@ export function OperatorGate({
</a>
)}
{session.data.login_enabled && (
<details open={!session.data.oidc_enabled} className="group">
{session.data.oidc_enabled && (
session.data.oidc_enabled ? (
<details className="group">
<summary className="cursor-pointer text-sm text-star-300">Emergency operator sign-in</summary>
)}
<form onSubmit={submit} className="mt-3 space-y-4">
<form onSubmit={submit} className="mt-3 space-y-4">
<label className="block text-sm text-star-300">
Operator password
<input type="password" name="password" autoComplete="current-password" required
maxLength={1024} className="mt-1 block w-full rounded-xl border border-space-700 bg-space-950 px-3 py-2 text-star-100" />
maxLength={1024} className="field" />
</label>
{error && <p role="alert" className="text-sm text-orbit-red">{error}</p>}
<Button type="submit" variant="primary" className="w-full" disabled={pending}>
{pending ? "Signing in…" : "Sign in"}
</Button>
</form>
</details>
</details>
) : (
<form onSubmit={submit} className="mt-3 space-y-4">
<label className="block text-sm text-star-300">
Operator password
<input type="password" name="password" autoComplete="current-password" required
maxLength={1024} className="field" />
</label>
{error && <p role="alert" className="text-sm text-orbit-red">{error}</p>}
<Button type="submit" variant="primary" className="w-full" disabled={pending}>
{pending ? "Signing in…" : "Sign in"}
</Button>
</form>
)
)}
</div>
) : <p className="mt-4 text-star-300">Browser sign-in is disabled on this hub.</p>}

View File

@@ -0,0 +1,290 @@
import { useState, type FormEvent } from "react";
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
import {
createRelation, endRelation, fetchAccessUsers, fetchRelationAccess, fetchRelations, grantRelationAccess, refusalReason,
retargetRelation, revokeRelationAccess, setOrbitEnvironment, setTargetEnvironment,
type AccessUser, type Environment, type OrbitSetup, type RelationOverview, type RelationView, type TargetSetup,
} from "../../api";
import { Button } from "../ui/Button";
import { Select } from "../ui/Select";
const ENVIRONMENTS: Environment[] = ["production", "staging", "development"];
const REFUSALS: Record<string, string> = {
unknown_source: "That source orbit no longer exists.",
unknown_target: "That target no longer exists.",
source_environment_unset: "Set the source orbit's environment first.",
source_not_managed: "The source is not a managed Outpost backup; only managed capture profiles can be refreshed from.",
source_not_restore_ready: "The source's backup format cannot be restored (filesystem backups are not databases).",
target_environment_unset: "Set the target's environment first. An unlabelled target is never used.",
target_is_production: "A production database can never be overwritten.",
application_mismatch: "That target was registered for a different application.",
engine_mismatch: "The target uses a different database engine than the source.",
target_matches_a_production_source: "The target looks like a database that is backed up as production. Check its environment and identity.",
outpost_inactive: "An Outpost on this path is no longer paired or its token has expired.",
relation_exists: "That relation already exists.",
};
const ENDED: Record<string, string> = {
deactivated_by_admin: "ended by an administrator",
replaced: "replaced by a newer version",
target_relabelled: "target was relabelled",
outpost_revoked: "an Outpost was revoked",
deactivated: "ended",
target_environment: "target environment changed",
outpost_inactive: "an Outpost is not available",
};
const reasonText = (error: unknown) => REFUSALS[refusalReason(error) ?? ""] ?? "That change was refused.";
const notSet = "Not set";
const label = (value: string | null) => (value ? value : notSet);
/** Which source may overwrite which target, and who may start it. Administrators only. */
export function RelationsView() {
const qc = useQueryClient();
const overview = useQuery({ queryKey: ["relations"], queryFn: fetchRelations, refetchInterval: 10_000 });
const data: RelationOverview | undefined =
overview.data && Array.isArray(overview.data.relations) && Array.isArray(overview.data.orbits) && Array.isArray(overview.data.targets)
? overview.data : undefined;
const refresh = () => void qc.invalidateQueries({ queryKey: ["relations"] });
const orbitEnv = useMutation({ mutationFn: (v: { id: string; environment: Environment }) => setOrbitEnvironment(v.id, v.environment), onSuccess: refresh });
const targetEnv = useMutation({ mutationFn: (v: { id: string; environment: Environment }) => setTargetEnvironment(v.id, v.environment), onSuccess: refresh });
const create = useMutation({ mutationFn: (v: { source: string; target: string }) => createRelation(v.source, v.target), onSuccess: refresh });
const end = useMutation({ mutationFn: endRelation, onSuccess: refresh });
const [source, setSource] = useState("");
if (overview.isPending) return <p role="status" className="p-6 text-star-300">Loading…</p>;
if (overview.isError || !data) {
return <p role="alert" className="p-6 text-star-300">Could not load relations. This hub may not support them.</p>;
}
const sources = data.orbits.filter((o) => o.ready);
const chosen = data.orbits.find((o) => o.id === source);
const targetsFor = (orbit?: OrbitSetup) =>
data.targets.filter((t) => t.environment === "staging" || t.environment === "development")
.filter((t) => !orbit || (t.application_id === orbit.application_id && t.engine === orbit.engine));
const active = data.relations.filter((r) => r.active);
const ended = data.relations.filter((r) => !r.active).slice(0, 8);
function submit(event: FormEvent<HTMLFormElement>) {
event.preventDefault();
const form = new FormData(event.currentTarget);
create.mutate({ source: String(form.get("source") ?? ""), target: String(form.get("target") ?? "") });
}
return (
<div className="space-y-10 p-6">
<section aria-labelledby="rel-intro">
<h3 id="rel-intro" className="text-lg font-semibold text-star-100">What a relation is</h3>
<p className="mt-1 text-sm text-star-300">
A relation says that one source orbit may overwrite one staging or development database, in that direction only.
Nothing is assumed: label each source and target below, then connect them. A production database can never be a target.
</p>
</section>
<section aria-labelledby="rel-env">
<h3 id="rel-env" className="text-lg font-semibold text-star-100">Environments</h3>
<div className="mt-3 grid gap-6 lg:grid-cols-2">
<div className="overflow-x-auto">
<h4 className="text-sm font-medium text-star-200">Source orbits</h4>
<table className="mt-2 w-full text-left text-sm">
<thead className="text-star-300"><tr><th className="py-2 pr-3">Orbit</th><th className="pr-3">Environment</th><th>Can be a source</th></tr></thead>
<tbody>
{data.orbits.map((o) => (
<tr key={o.id} className="border-t border-space-700 text-star-100">
<td className="py-2 pr-3">{o.name}</td>
<td className="pr-3" style={{ minWidth: 160 }}>
<Select aria-label={`Environment of ${o.name}`} value={o.environment ?? ""} onChange={(e) => orbitEnv.mutate({ id: o.id, environment: e.target.value as Environment })}>
<option value="" disabled>{notSet}</option>
{ENVIRONMENTS.map((env) => <option key={env} value={env}>{env}</option>)}
</Select>
</td>
<td className="text-star-300">{o.ready ? `Yes (${o.engine})` : o.reason === "not_managed" ? "No: not a managed Outpost backup" : o.reason === "not_restore_ready" ? "No: format cannot be restored" : "Set the environment"}</td>
</tr>
))}
</tbody>
</table>
</div>
<div className="overflow-x-auto">
<h4 className="text-sm font-medium text-star-200">Restore targets</h4>
{data.targets.length === 0 ? <p className="mt-2 text-sm text-star-300">No restore targets are registered yet. Register one from the Orbits console.</p> : (
<table className="mt-2 w-full text-left text-sm">
<thead className="text-star-300"><tr><th className="py-2 pr-3">Target</th><th className="pr-3">Database</th><th className="pr-3">Environment</th><th>Outpost</th></tr></thead>
<tbody>
{data.targets.map((t: TargetSetup) => (
<tr key={t.id} className="border-t border-space-700 text-star-100">
<td className="py-2 pr-3">{t.name}</td>
<td className="pr-3 text-star-300">{t.engine} · {t.identity.database}</td>
<td className="pr-3" style={{ minWidth: 160 }}>
<Select aria-label={`Environment of ${t.name}`} value={t.environment ?? ""} onChange={(e) => targetEnv.mutate({ id: t.id, environment: e.target.value as Environment })}>
<option value="" disabled>{notSet}</option>
{ENVIRONMENTS.map((env) => <option key={env} value={env}>{env}</option>)}
</Select>
</td>
<td className="text-star-300">{t.outpost_active ? "Paired" : "Not available"}</td>
</tr>
))}
</tbody>
</table>
)}
</div>
</div>
{targetEnv.data && targetEnv.data.ended_relations.length > 0 && (
<p role="status" className="mt-3 text-sm text-orbit-red">Relabelling that target ended {targetEnv.data.ended_relations.length} relation(s) into it.</p>
)}
{(orbitEnv.isError || targetEnv.isError) && <p role="alert" className="mt-3 text-sm text-orbit-red">That change was refused.</p>}
</section>
<section aria-labelledby="rel-new">
<h3 id="rel-new" className="text-lg font-semibold text-star-100">Connect a source to a target</h3>
{sources.length === 0 ? (
<p className="mt-2 text-sm text-star-300">No orbit can be a source yet. A source must be a managed Outpost database backup with an environment.</p>
) : (
<form onSubmit={submit} className="mt-3 grid gap-4 sm:grid-cols-2">
<label className="text-sm text-star-300">
Source orbit
<Select name="source" required value={source} onChange={(e) => setSource(e.target.value)}>
<option value="" disabled>Choose…</option>
{sources.map((o) => <option key={o.id} value={o.id}>{o.name} ({o.environment})</option>)}
</Select>
</label>
<label className="text-sm text-star-300">
Target database
<Select name="target" required key={source}>
<option value="" disabled>{chosen ? "Choose…" : "Pick a source first"}</option>
{targetsFor(chosen).map((t) => <option key={t.id} value={t.id}>{t.name} ({t.environment})</option>)}
</Select>
</label>
<div className="sm:col-span-2 flex items-center gap-4">
<Button type="submit" variant="primary" disabled={create.isPending}>{create.isPending ? "Connecting…" : "Create relation"}</Button>
<p className="text-xs text-star-300">Only staging and development targets registered for the same application and engine are offered.</p>
</div>
</form>
)}
{create.isError && <p role="alert" className="mt-3 text-sm text-orbit-red">{reasonText(create.error)}</p>}
{create.isSuccess && !create.data.verified && (
<p role="status" className="mt-3 text-sm text-star-300">Created. The source has no backup yet, so the target could not be compared with it; that check repeats before a refresh runs.</p>
)}
</section>
<section aria-labelledby="rel-list">
<h3 id="rel-list" className="text-lg font-semibold text-star-100">Relations</h3>
{active.length === 0 ? <p className="mt-2 text-sm text-star-300">No active relations.</p> : (
<div className="mt-3 space-y-4">
{active.map((relation) => (
<RelationCard key={relation.id} relation={relation} targets={targetsFor({ id: relation.source_orbit_id, name: relation.source_name, application_id: data.targets.find((t) => t.id === relation.target_id)?.application_id ?? null, engine: relation.engine, environment: relation.source_environment, ready: true, reason: null })}
onEnd={() => end.mutate(relation.id)} ending={end.isPending} onChanged={refresh} />
))}
</div>
)}
{ended.length > 0 && (
<details className="mt-4 text-sm text-star-300">
<summary className="cursor-pointer">Ended relations</summary>
<ul className="mt-2 space-y-1">
{ended.map((r) => <li key={r.id}>{r.source_name} → {r.target_name} (version {r.version}): {ENDED[r.deactivated_reason ?? ""] ?? "ended"}</li>)}
</ul>
</details>
)}
</section>
</div>
);
}
function RelationCard({ relation, targets, onEnd, ending, onChanged }: {
relation: RelationView; targets: TargetSetup[]; onEnd: () => void; ending: boolean; onChanged: () => void;
}) {
const qc = useQueryClient();
const retarget = useMutation({ mutationFn: (target: string) => retargetRelation(relation.id, target), onSuccess: onChanged });
const others = targets.filter((t) => t.id !== relation.target_id);
return (
<div className="rounded-xl border border-space-700 p-4">
<div className="flex flex-wrap items-center justify-between gap-3">
<p className="text-star-100">
<strong>{relation.source_name}</strong> <span className="text-star-300">({label(relation.source_environment)})</span>
<span aria-hidden="true"> → </span><span className="sr-only"> may overwrite </span>
<strong>{relation.target_name}</strong> <span className="text-star-300">({label(relation.target_environment)})</span>
</p>
<p className="text-sm text-star-300">
Version {relation.version} · {relation.usable ? "Ready" : `Not usable: ${ENDED[relation.unusable_reason ?? ""] ?? "unavailable"}`}
{!relation.verified && " · not yet compared with the source"}
</p>
</div>
<div className="mt-3 flex flex-wrap items-end gap-3">
{others.length > 0 && (
<form className="flex items-end gap-2" onSubmit={(e) => { e.preventDefault(); const t = String(new FormData(e.currentTarget).get("target") ?? ""); if (t) retarget.mutate(t); }}>
<label className="text-sm text-star-300">
Point at another target
<Select name="target" key={relation.id}>
<option value="" disabled>Choose…</option>
{others.map((t) => <option key={t.id} value={t.id}>{t.name}</option>)}
</Select>
</label>
<Button type="submit" disabled={retarget.isPending}>Retarget</Button>
</form>
)}
<Button disabled={ending} onClick={onEnd}>End relation</Button>
</div>
{retarget.isError && <p role="alert" className="mt-2 text-sm text-orbit-red">{reasonText(retarget.error)}</p>}
{retarget.isSuccess && <p role="status" className="mt-2 text-sm text-star-300">A new version was created. It starts with nobody allowed to use it; grant access again.</p>}
<RelationAccess relationId={relation.id} onChange={() => void qc.invalidateQueries({ queryKey: ["relation-access", relation.id] })} />
</div>
);
}
/** Who may start a refresh through this one relation. Access never carries over to a new version. */
function RelationAccess({ relationId, onChange }: { relationId: string; onChange: () => void }) {
const qc = useQueryClient();
const grants = useQuery({ queryKey: ["relation-access", relationId], queryFn: () => fetchRelationAccess(relationId) });
const users = useQuery({ queryKey: ["access-users"], queryFn: fetchAccessUsers });
const [kind, setKind] = useState<"user" | "group">("user");
const list = Array.isArray(grants.data) ? grants.data : [];
const people: AccessUser[] = Array.isArray(users.data) ? users.data : [];
const nameOf = (id: string) => people.find((u) => u.id === id)?.display_name ?? id;
const refresh = () => { onChange(); void qc.invalidateQueries({ queryKey: ["relation-access", relationId] }); };
const add = useMutation({ mutationFn: (v: { principal_type: "user" | "group"; principal: string }) => grantRelationAccess(relationId, v), onSuccess: refresh });
const remove = useMutation({ mutationFn: (grant: string) => revokeRelationAccess(relationId, grant), onSuccess: refresh });
return (
<div className="mt-4 border-t border-space-700 pt-3">
<h5 className="text-sm font-medium text-star-200">Who may refresh through this relation</h5>
{list.length === 0 ? <p className="mt-1 text-sm text-star-300">Nobody yet.</p> : (
<ul className="mt-1 space-y-1 text-sm text-star-100">
{list.map((g) => (
<li key={g.id} className="flex items-center justify-between gap-3">
<span>{g.principal_type === "group" ? `Group ${g.principal}` : nameOf(g.principal)}</span>
<Button disabled={remove.isPending} onClick={() => remove.mutate(g.id)} aria-label={`Remove access for ${g.principal_type === "group" ? g.principal : nameOf(g.principal)}`}>Remove</Button>
</li>
))}
</ul>
)}
<form className="mt-3 flex flex-wrap items-end gap-2" onSubmit={(e) => {
e.preventDefault();
const principal = String(new FormData(e.currentTarget).get("principal") ?? "").trim();
if (principal) add.mutate({ principal_type: kind, principal });
}}>
<label className="text-sm text-star-300">
Add
<Select value={kind} onChange={(e) => setKind(e.target.value as "user" | "group")}>
<option value="user">A person</option>
<option value="group">A group</option>
</Select>
</label>
{kind === "user" ? (
<label className="text-sm text-star-300">
Person
<Select name="principal" key="user">
<option value="" disabled>Choose…</option>
{people.filter((u) => !u.is_emergency && u.active).map((u) => <option key={u.id} value={u.id}>{u.display_name}</option>)}
</Select>
</label>
) : (
<label className="text-sm text-star-300">
Group name
<input name="principal" required maxLength={128} className="field" autoComplete="off" />
</label>
)}
<Button type="submit" disabled={add.isPending}>Allow</Button>
</form>
{add.isError && <p role="alert" className="mt-2 text-sm text-orbit-red">Could not add that. It may already be allowed.</p>}
</div>
);
}