import type { RefObject, ReactNode } from "react"; import { ArrowLeft, Database, History, RefreshCw, Save, TestTube2, Trash2, } from "lucide-react"; import { Button } from "../../components/ui/button"; import type { CatalogDatabase, CatalogSecretName, CatalogSyncRun, DatabaseBinding, DatabaseTransport, } from "../../api/catalog-databases"; import type { DatabaseBusyAction, DatabaseFormDraft, DatabaseFormMode, } from "./model"; import { statusLabel } from "./model"; import { DatabaseSyncMenu, type DatabaseSyncScope } from "./DatabaseSyncMenu"; const inputClass = "h-9 w-full rounded-md border border-input bg-card px-3 text-sm outline-none transition focus:border-primary/60 focus:ring-3 focus:ring-ring/15 read-only:bg-muted/40 read-only:text-muted-foreground disabled:bg-muted disabled:text-muted-foreground"; const labelClass = "grid min-w-0 gap-1.5 text-xs font-medium text-foreground"; interface FieldProps { label: string; hint?: string; children: ReactNode; } function Field({ label, hint, children }: FieldProps) { return ( ); } interface SecretFieldProps { label: string; name: CatalogSecretName; row: CatalogDatabase; draft: DatabaseFormDraft; readOnly: boolean; canManageSecrets: boolean; onChange: (name: CatalogSecretName, value: string) => void; multiline?: boolean; } function SecretField({ label, name, row, draft, readOnly, canManageSecrets, onChange, multiline = false, }: SecretFieldProps) { if (readOnly) { return ( ); } const permissionHint = canManageSecrets ? undefined : "You do not have permission to replace secret values."; return ( {multiline ? (