🪢 Open source agent evals & observability: Trace, evaluate, and improve LLM applications with one open platform.
TypeScript analyticsautogenevaluationlangchainlarge-language-modelsllama-indexllmllm-evaluationllm-observabilityllmopsmonitoringobservabilityopen-sourceopenaiplaygroundprompt-engineeringprompt-managementself-hostedycombinator
refactor(web): Migrate verified domains settings table to design system (#17823)
Ben Bachem3c5a5b70d132
diff --git a/web/src/components/design-system/Button/Button.stories.tsx b/web/src/components/design-system/Button/Button.stories.tsxindex a3ee5d3f67..6b0c71cd70 100644--- a/web/src/components/design-system/Button/Button.stories.tsx+++ b/web/src/components/design-system/Button/Button.stories.tsx@@ -17,6 +17,25 @@ export const Primary = meta.story({},});+export const VariantMatrix = meta.story({+ parameters: { controls: { disable: true } },+ render: () => (+ <div className="grid grid-cols-2 items-center gap-3">+ {(["primary", "secondary", "destructive", "ghost"] as const).map(+ (variant) =>+ (["default", "sm"] as const).map((size) => (+ <Button+ key={`${variant}-${size}`}+ text={`${variant} / ${size}`}+ variant={variant}+ size={size}+ />+ )),+ )}+ </div>+ ),+});+export const ExternalLangfuseLink = meta.story({name: "(Test) External Langfuse Link",args: {diff --git a/web/src/components/design-system/Button/Button.tsx b/web/src/components/design-system/Button/Button.tsxindex c68bcda89d..74fef5a2c0 100644--- a/web/src/components/design-system/Button/Button.tsx+++ b/web/src/components/design-system/Button/Button.tsx@@ -6,7 +6,7 @@ import { type MouseEventHandler, type Ref } from "react";import { Spinner } from "@/src/components/design-system/Spinner/Spinner";const buttonVariants = cva(- "inline-flex h-8 items-center justify-center gap-1.5 whitespace-nowrap rounded-md px-3 py-1 text-sm ring-offset-background transition-colors focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",+ "inline-flex items-center justify-center gap-1.5 whitespace-nowrap rounded-md ring-offset-background transition-colors focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",{variants: {variant: {@@ -17,9 +17,14 @@ const buttonVariants = cva("bg-destructive text-destructive-foreground hover:bg-destructive/90",ghost: "hover:bg-accent hover:text-accent-foreground",},+ size: {+ default: "h-8 px-3 py-1 text-sm",+ sm: "h-7 px-2 text-xs",+ },},defaultVariants: {variant: "primary",+ size: "default",},},);@@ -27,6 +32,7 @@ const buttonVariants = cva(type ButtonProps = {text: string;variant?: "primary" | "secondary" | "destructive" | "ghost";+ size?: "default" | "sm";} & (| {href: string;@@ -51,7 +57,10 @@ type ButtonProps = {);export function Button(props: ButtonProps) {- const className = buttonVariants({ variant: props.variant });+ const className = buttonVariants({+ variant: props.variant,+ size: props.size,+ });if (props.href !== undefined) {const Icon = props.icon;diff --git a/web/src/components/design-system/table/columns/createButtonTableColumn.stories.tsx b/web/src/components/design-system/table/columns/createButtonTableColumn.stories.tsxnew file mode 100644index 0000000000..5055e14c3d--- /dev/null+++ b/web/src/components/design-system/table/columns/createButtonTableColumn.stories.tsx@@ -0,0 +1,47 @@+import { fn } from "storybook/test";+import preview from "../../../../../.storybook/preview";++import { Table } from "@/src/components/design-system/table/Table";+import { createButtonTableColumn } from "./createButtonTableColumn";++const onVerify = fn();++function ButtonTableColumnStory() {+ return (+ <Table+ tableName="Button column"+ columns={[+ createButtonTableColumn<+ {+ id: string;+ verified: boolean;+ loading: boolean;+ },+ string+ >({+ accessorFn: (row) => row.id,+ id: "verify",+ header: "",+ getButton: ({ row }) => ({+ text: "Verify",+ onClick: () => onVerify(row.original.id),+ disabled: row.original.verified,+ loading: row.original.loading,+ }),+ }),+ ]}+ data={{+ status: "success",+ data: [+ { id: "pending", verified: false, loading: false },+ { id: "verified", verified: true, loading: false },+ { id: "verifying", verified: false, loading: true },+ ],+ }}+ />+ );+}++const meta = preview.meta({ component: ButtonTableColumnStory });++export const Default = meta.story();diff --git a/web/src/components/design-system/table/columns/createButtonTableColumn.tsx b/web/src/components/design-system/table/columns/createButtonTableColumn.tsxnew file mode 100644index 0000000000..5a96995415--- /dev/null+++ b/web/src/components/design-system/table/columns/createButtonTableColumn.tsx@@ -0,0 +1,35 @@+/* eslint-disable boundaries/dependencies */+import { type CellContext, type RowData } from "@tanstack/react-table";++import { Button } from "@/src/components/design-system/Button/Button";+import { Skeleton } from "@/src/components/ui/skeleton";+import {+ createTableColumn,+ type TableColumnOptions,+} from "./utils/createTableColumn";++export function createButtonTableColumn<TData extends RowData, TValue>({+ getButton,+ ...options+}: TableColumnOptions<TData, TValue> & {+ getButton: (context: CellContext<TData, TValue | null | undefined>) => {+ text: string;+ onClick: () => void;+ disabled?: boolean;+ loading?: boolean;+ };+}) {+ return createTableColumn<TData, TValue>({+ ...options,+ enableResizing: false,+ loadingCell: <Skeleton className="h-8 w-16" />,+ renderCell: (_, context) => {+ const buttonProps = getButton(context);+ return (+ <div className="ml-auto">+ <Button size="sm" {...buttonProps} />+ </div>+ );+ },+ });+}diff --git a/web/src/ee/features/verified-domains/components/DnsRecordTable/DnsRecordTable.stories.tsx b/web/src/ee/features/verified-domains/components/DnsRecordTable/DnsRecordTable.stories.tsxnew file mode 100644index 0000000000..51e4fdcb15--- /dev/null+++ b/web/src/ee/features/verified-domains/components/DnsRecordTable/DnsRecordTable.stories.tsx@@ -0,0 +1,11 @@+import preview from "../../../../../../.storybook/preview";+import { DnsRecordTable } from "./DnsRecordTable";++const meta = preview.meta({ component: DnsRecordTable });++export const Default = meta.story({+ args: {+ recordHost: "_langfuse.example.com",+ recordValue: "langfuse-verification=example-token",+ },+});diff --git a/web/src/ee/features/verified-domains/components/DnsRecordTable/DnsRecordTable.tsx b/web/src/ee/features/verified-domains/components/DnsRecordTable/DnsRecordTable.tsxnew file mode 100644index 0000000000..ea570db37d--- /dev/null+++ b/web/src/ee/features/verified-domains/components/DnsRecordTable/DnsRecordTable.tsx@@ -0,0 +1,47 @@+import { SettingsTable } from "@/src/components/SettingsTable/SettingsTable";+import { type LangfuseColumnDef } from "@/src/components/table/types";+import { createTextTableColumn } from "@/src/components/design-system/table/columns/createTextTableColumn";++export function DnsRecordTable({+ recordHost,+ recordValue,+}: {+ recordHost: string;+ recordValue: string;+}) {+ const columns: LangfuseColumnDef<{+ type: string;+ host: string;+ value: string;+ }>[] = [+ createTextTableColumn({+ accessorKey: "type",+ header: "Type",+ size: 64,+ enableResizing: false,+ }),+ createTextTableColumn({+ accessorKey: "host",+ header: "Host",+ size: 216,+ enableResizing: false,+ trailingAction: { type: "copy-to-clipboard" },+ }),+ createTextTableColumn({+ accessorKey: "value",+ header: "Value",+ enableResizing: false,+ trailingAction: { type: "copy-to-clipboard" },+ }),+ ];+ return (+ <SettingsTable+ tableName="DNS record"+ columns={columns}+ data={{+ status: "success",+ data: [{ type: "TXT", host: recordHost, value: recordValue }],+ }}+ />+ );+}diff --git a/web/src/ee/features/verified-domains/components/VerifiedDomainsSettings.tsx b/web/src/ee/features/verified-domains/components/VerifiedDomainsSettings.tsxindex 959bf38d95..22318f0c0c 100644--- a/web/src/ee/features/verified-domains/components/VerifiedDomainsSettings.tsx+++ b/web/src/ee/features/verified-domains/components/VerifiedDomainsSettings.tsx@@ -1,13 +1,8 @@/* eslint-disable @repo/no-abstracted-overlay-trigger */-import { showErrorToast, showSuccessToast } from "@/src/features/notifications";+import { showSuccessToast } from "@/src/features/notifications";import { Alert } from "@/src/components/design-system/Alert/Alert";-import { ConfirmationDialogController } from "@/src/components/design-system/ConfirmationDialogController/ConfirmationDialogController";-import { Badge } from "@/src/components/ui/badge";import { Button } from "@/src/components/ui/button";-import { Card } from "@/src/components/ui/card";-import { SimpleDataTable } from "@/src/components/table/simple-data-table";-import { type LangfuseColumnDef } from "@/src/components/table/types";-import { createTextTableColumn } from "@/src/components/design-system/table/columns/createTextTableColumn";+import { ConnectedVerifiedDomainsSettingsTable } from "./VerifiedDomainsSettingsTable/ConnectedVerifiedDomainsSettingsTable";import {Dialog,DialogBody,@@ -31,18 +26,10 @@ import { useHasEntitlement } from "@/src/features/entitlements";import { useHasOrganizationAccess } from "@/src/features/rbac";import { api } from "@/src/utils/api";import { zodResolver } from "@hookform/resolvers/zod";-import { type Row } from "@tanstack/react-table";-import {- AlertCircle,- Check,- ChevronRight,- Copy,- TrashIcon,-} from "lucide-react";-import { useMemo, useState } from "react";+import { AlertCircle } from "lucide-react";+import { useState } from "react";import { useForm } from "react-hook-form";import { z } from "zod";-import { useCopyToClipboard } from "@/src/hooks/useCopyToClipboard";const addDomainSchema = z.object({domain: z@@ -119,240 +106,11 @@ export const VerifiedDomainsSettings = ({ orgId }: { orgId: string }) => {You can only configure SSO for domains your organization owns. Verify adomain via DNS to enable SSO for it.</p>- <DomainsTable orgId={orgId} />+ <ConnectedVerifiedDomainsSettingsTable orgId={orgId} /></div>);};-function DomainsTable({ orgId }: { orgId: string }) {- const query = api.verifiedDomain.list.useQuery({ orgId });- const [collapsedRows, setCollapsedRows] = useState<Set<string>>(new Set());-- const columns = useMemo<LangfuseColumnDef<DomainRowData>[]>(- () => [- {- accessorKey: "domain",- header: "Domain",- cell: ({ row }) =>- !row.original.verifiedAt ? (- <button- type="button"- onClick={() =>- setCollapsedRows((current) => {- const next = new Set(current);- if (next.has(row.original.id)) next.delete(row.original.id);- else next.add(row.original.id);- return next;- })- }- className="flex items-center gap-1"- >- <ChevronRight- className={`h-3 w-3 transition-transform ${- collapsedRows.has(row.original.id) ? "" : "rotate-90"- }`}- />- {row.original.domain}- </button>- ) : (- row.original.domain- ),- },- {- accessorKey: "verifiedAt",- header: "Status",- cell: ({ row }) =>- row.original.verifiedAt ? (- <Badge variant="default">Verified</Badge>- ) : (- <Badge variant="secondary">Pending verification</Badge>- ),- },- {- accessorKey: "createdAt",- header: "Added",- hideBelowMd: true,- cell: ({ row }) => row.original.createdAt.toLocaleDateString(),- },- {- accessorKey: "id",- id: "actions",- header: "",- cell: ({ row }) => (- <div className="flex items-center justify-end gap-2">- <DomainActions orgId={orgId} row={row.original} />- </div>- ),- },- ],- [collapsedRows, orgId],- );-- const renderDetailRow = (row: Row<DomainRowData>) =>- !row.original.verifiedAt && !collapsedRows.has(row.original.id) ? (- <tr className="bg-muted/30 hover:bg-muted/50 data-[state=selected]:bg-muted border-b transition-colors">- <td- colSpan={4}- className="h-full border-b px-2 py-4 align-middle [&:has([role=checkbox])]:pr-0 [:last-child_>_&]:border-b-0"- >- <DnsInstructions- recordHost={row.original.recordHost}- recordValue={row.original.recordValue}- />- </td>- </tr>- ) : null;-- return (- <Card className="mb-4 overflow-hidden">- <SimpleDataTable- columns={columns}- data={query.data ?? []}- isLoading={query.isLoading}- noResults={- query.isError ? (- <div className="text-destructive py-10 text-sm">- Failed to load verified domains. Please try again.- </div>- ) : (- <div className="py-10 text-sm">No domains added yet</div>- )- }- bodyTone="muted"- rowVariant="primary-hover"- renderDetailRow={renderDetailRow}- />- </Card>- );-}--type DomainRowData = {- id: string;- domain: string;- verifiedAt: Date | null;- createdAt: Date;- recordHost: string;- recordValue: string;-};--function DomainActions({ orgId, row }: { orgId: string; row: DomainRowData }) {- const utils = api.useUtils();-- const verifyMutation = api.verifiedDomain.verify.useMutation({- onSuccess: () => {- utils.verifiedDomain.list.invalidate({ orgId });- utils.ssoConfig.get.invalidate({ orgId });- showSuccessToast({- title: "Domain verified",- description: `${row.domain} is now verified.`,- });- },- onError: (err) => {- showErrorToast("Verification failed", err.message);- },- });-- return (- <>- {!row.verifiedAt && (- <Button- size="sm"- onClick={() => verifyMutation.mutate({ orgId, id: row.id })}- loading={verifyMutation.isPending}- >- Verify- </Button>- )}- <DeleteDomainButton- orgId={orgId}- id={row.id}- domain={row.domain}- verified={Boolean(row.verifiedAt)}- />- </>- );-}--function DnsInstructions({- recordHost,- recordValue,-}: {- recordHost: string;- recordValue: string;-}) {- const columns: LangfuseColumnDef<{- type: string;- host: string;- value: string;- }>[] = [- createTextTableColumn({- accessorKey: "type",- header: "Type",- size: 64,- }),- {- accessorKey: "host",- header: "Host",- size: 216,- cell: ({ getValue }) => <CopyableText value={getValue<string>()} />,- },- {- accessorKey: "value",- header: "Value",- cell: ({ getValue }) => <CopyableText value={getValue<string>()} />,- },- ];-- return (- <div className="space-y-3">- <p className="text-sm font-bold">- Add the following TXT record to your DNS provider:- </p>- <Card className="overflow-hidden">- <SimpleDataTable- columns={columns}- data={[{ type: "TXT", host: recordHost, value: recordValue }]}- isLoading={false}- noResults={null}- />- </Card>- <p className="text-muted-foreground text-xs">- DNS changes may take up to 24h to propagate. After adding the record,- click <span className="font-bold">Verify</span>.- </p>- </div>- );-}--function CopyableText({ value }: { value: string }) {- const { copy, isCopied } = useCopyToClipboard();-- return (- <div className="relative min-w-0 pr-8 font-mono break-all">- <span title={value}>{value}</span>- <Button- variant="ghost"- size="icon-xs"- className="absolute top-1/2 right-2 -translate-y-1/2"- title="Copy to clipboard"- aria-label="Copy to clipboard"- onClick={async (event) => {- event.preventDefault();- const button = event.currentTarget;- await copy(value).catch(() => undefined);- button.focus();- }}- >- {isCopied ? (- <Check className="h-3 w-3" />- ) : (- <Copy className="h-3 w-3" />- )}- </Button>- </div>- );-}-function AddDomainButton({ orgId }: { orgId: string }) {const [open, setOpen] = useState(false);const utils = api.useUtils();@@ -368,7 +126,7 @@ function AddDomainButton({ orgId }: { orgId: string }) {showSuccessToast({title: "Domain added",description:- "Add the DNS TXT record shown in the table, then click Verify.",+ "Click Verify to view the DNS TXT record, then confirm after adding it.",});form.reset();setOpen(false);@@ -426,58 +184,3 @@ function AddDomainButton({ orgId }: { orgId: string }) {</Dialog>);}--function DeleteDomainButton({- orgId,- id,- domain,- verified,-}: {- orgId: string;- id: string;- domain: string;- verified: boolean;-}) {- const utils = api.useUtils();-- const deleteMutation = api.verifiedDomain.delete.useMutation({- onSuccess: () => {- utils.verifiedDomain.list.invalidate({ orgId });- showSuccessToast({- title: "Domain removed",- description: `${domain} has been removed.`,- });- },- onError: (err) => {- showErrorToast("Failed to remove domain", err.message);- },- });-- return (- <ConfirmationDialogController- title={`Remove ${domain}?`}- text={- verified- ? "If an SSO configuration exists for this domain, you must remove it first. The domain can be re-verified later."- : "This removes the pending claim. The domain can be re-added and verified later."- }- confirmLabel="Remove"- variant="destructive"- loading={deleteMutation.isPending}- onConfirm={async () => {- await deleteMutation.mutateAsync({ orgId, id });- }}- >- {({ openDialog }) => (- <Button- variant="ghost"- size="icon-xs"- aria-label={`Delete ${domain}`}- onClick={openDialog}- >- <TrashIcon className="h-4 w-4" />- </Button>- )}- </ConfirmationDialogController>- );-}diff --git a/web/src/ee/features/verified-domains/components/VerifiedDomainsSettingsTable/ConnectedVerifiedDomainsSettingsTable.tsx b/web/src/ee/features/verified-domains/components/VerifiedDomainsSettingsTable/ConnectedVerifiedDomainsSettingsTable.tsxnew file mode 100644index 0000000000..806d682fdf--- /dev/null+++ b/web/src/ee/features/verified-domains/components/VerifiedDomainsSettingsTable/ConnectedVerifiedDomainsSettingsTable.tsx@@ -0,0 +1,96 @@+import { useState } from "react";+import { ConfirmationDialogController } from "@/src/components/design-system/ConfirmationDialogController/ConfirmationDialogController";+import { type AsyncTableData } from "@/src/components/design-system/table/Table";+import { showErrorToast, showSuccessToast } from "@/src/features/notifications";+import { api } from "@/src/utils/api";+import {+ VerifiedDomainsSettingsTable,+ type DomainRowData,+} from "./VerifiedDomainsSettingsTable";+import { VerifyDomainDialogController } from "../VerifyDomainDialogController/VerifyDomainDialogController";++export function ConnectedVerifiedDomainsSettingsTable({+ orgId,+}: {+ orgId: string;+}) {+ const query = api.verifiedDomain.list.useQuery({ orgId });+ const utils = api.useUtils();+ const [verifyingDomainId, setVerifyingDomainId] = useState<string | null>(+ null,+ );++ const verifyMutation = api.verifiedDomain.verify.useMutation({+ onSuccess: (_, variables) => {+ utils.verifiedDomain.list.invalidate({ orgId });+ utils.ssoConfig.get.invalidate({ orgId });+ const domain = query.data?.find((row) => row.id === variables.id);+ showSuccessToast({+ title: "Domain verified",+ description: `${domain?.domain ?? "Domain"} is now verified.`,+ });+ },+ onError: (err) => showErrorToast("Verification failed", err.message),+ onSettled: () => setVerifyingDomainId(null),+ });++ const deleteMutation = api.verifiedDomain.delete.useMutation({+ onSuccess: (_, variables) => {+ utils.verifiedDomain.list.invalidate({ orgId });+ const domain = query.data?.find((row) => row.id === variables.id);+ showSuccessToast({+ title: "Domain removed",+ description: `${domain?.domain ?? "Domain"} has been removed.`,+ });+ },+ onError: (err) => showErrorToast("Failed to remove domain", err.message),+ });++ let data: AsyncTableData<DomainRowData[]> = {+ status: "success",+ data: query.data ?? [],+ };+ if (query.isLoading) data = { status: "loading" };+ if (query.isError) {+ data = {+ status: "error",+ error: "Failed to load verified domains. Please try again.",+ };+ }++ return (+ <ConfirmationDialogController<DomainRowData>+ title={(row) => `Remove ${row.domain}?`}+ text={(row) =>+ row.verifiedAt+ ? "If an SSO configuration exists for this domain, you must remove it first. The domain can be re-verified later."+ : "This removes the pending claim. The domain can be re-added and verified later."+ }+ confirmLabel="Remove"+ variant="destructive"+ loading={deleteMutation.isPending}+ onConfirm={async (row) => {+ await deleteMutation.mutateAsync({ orgId, id: row.id });+ }}+ >+ {({ openDialog: openDeleteDialog }) => (+ <VerifyDomainDialogController+ verifyingDomainId={verifyingDomainId}+ onVerify={async (row) => {+ setVerifyingDomainId(row.id);+ await verifyMutation.mutateAsync({ orgId, id: row.id });+ }}+ >+ {({ openDialog: openVerifyDialog }) => (+ <VerifiedDomainsSettingsTable+ data={data}+ verifyingDomainId={verifyingDomainId}+ onViewInstructions={openVerifyDialog}+ onDelete={openDeleteDialog}+ />+ )}+ </VerifyDomainDialogController>+ )}+ </ConfirmationDialogController>+ );+}diff --git a/web/src/ee/features/verified-domains/components/VerifiedDomainsSettingsTable/VerifiedDomainsSettingsTable.stories.tsx b/web/src/ee/features/verified-domains/components/VerifiedDomainsSettingsTable/VerifiedDomainsSettingsTable.stories.tsxnew file mode 100644index 0000000000..83ebca975e--- /dev/null+++ b/web/src/ee/features/verified-domains/components/VerifiedDomainsSettingsTable/VerifiedDomainsSettingsTable.stories.tsx@@ -0,0 +1,56 @@+import { fn } from "storybook/test";+import preview from "../../../../../../.storybook/preview";+import { VerifiedDomainsSettingsTable } from "./VerifiedDomainsSettingsTable";++const meta = preview.meta({ component: VerifiedDomainsSettingsTable });++const actions = {+ verifyingDomainId: null,+ onViewInstructions: fn(),+ onDelete: fn(),+};++export const Default = meta.story({+ args: {+ ...actions,+ data: {+ status: "success",+ data: [+ {+ id: "pending",+ domain: "example.com",+ verifiedAt: null,+ createdAt: new Date("2026-09-01"),+ recordHost: "_langfuse.example.com",+ recordValue: "langfuse-verification=example-token",+ },+ {+ id: "verified",+ domain: "verified.example.com",+ verifiedAt: new Date("2026-09-02"),+ createdAt: new Date("2026-09-01"),+ recordHost: "_langfuse.verified.example.com",+ recordValue: "langfuse-verification=verified-token",+ },+ ],+ },+ },+});++export const Loading = meta.story({+ args: { ...actions, data: { status: "loading" } },+});++export const Empty = meta.story({+ args: { ...actions, data: { status: "success", data: [] } },+});++export const Error = meta.story({+ args: {+ ...actions,+ data: {+ status: "error",+ error: "Failed to load verified domains. Please try again.",+ },+ },+});diff --git a/web/src/ee/features/verified-domains/components/VerifiedDomainsSettingsTable/VerifiedDomainsSettingsTable.tsx b/web/src/ee/features/verified-domains/components/VerifiedDomainsSettingsTable/VerifiedDomainsSettingsTable.tsxnew file mode 100644index 0000000000..653181a7f1--- /dev/null+++ b/web/src/ee/features/verified-domains/components/VerifiedDomainsSettingsTable/VerifiedDomainsSettingsTable.tsx@@ -0,0 +1,94 @@+import { useMemo } from "react";+import { TrashIcon } from "lucide-react";+import { SettingsTable } from "@/src/components/SettingsTable/SettingsTable";+import { type LangfuseColumnDef } from "@/src/components/table/types";+import { createTextTableColumn } from "@/src/components/design-system/table/columns/createTextTableColumn";+import { createButtonTableColumn } from "@/src/components/design-system/table/columns/createButtonTableColumn";+import { createBadgeTableColumn } from "@/src/components/design-system/table/columns/createBadgeTableColumn";+import { createDateTableColumn } from "@/src/components/design-system/table/columns/createDateTableColumn";+import {+ type AsyncTableData,+ type TableProps,+} from "@/src/components/design-system/table/Table";++export type DomainRowData = {+ id: string;+ domain: string;+ verifiedAt: Date | null;+ createdAt: Date;+ recordHost: string;+ recordValue: string;+};++export function VerifiedDomainsSettingsTable({+ data,+ verifyingDomainId,+ onDelete,+ onViewInstructions,+}: {+ data: AsyncTableData<DomainRowData[]>;+ verifyingDomainId: string | null;+ onDelete: (row: DomainRowData) => void;+ onViewInstructions: (row: DomainRowData) => void;+}) {+ const columns = useMemo<LangfuseColumnDef<DomainRowData>[]>(+ () => [+ createTextTableColumn<DomainRowData>({+ accessorKey: "domain",+ header: "Domain",+ enableResizing: false,+ }),+ createBadgeTableColumn<DomainRowData>({+ accessorFn: (row) =>+ row.verifiedAt ? "Verified" : "Pending verification",+ id: "status",+ header: "Status",+ enableResizing: false,+ range: "semantic",+ getBadge: (value) => ({+ value,+ variant: value === "Verified" ? "success" : "warning",+ }),+ }),+ createDateTableColumn<DomainRowData>({+ accessorKey: "createdAt",+ header: "Added",+ hideBelowMd: true,+ enableResizing: false,+ }),+ createButtonTableColumn<DomainRowData, string>({+ accessorFn: (row) => row.id,+ id: "verify",+ header: "",+ getButton: ({ row }) => ({+ text: "Verify",+ onClick: () => onViewInstructions(row.original),+ loading: verifyingDomainId === row.original.id,+ disabled: Boolean(row.original.verifiedAt),+ }),+ }),+ ],+ [onViewInstructions, verifyingDomainId],+ );++ const actions: NonNullable<TableProps<DomainRowData>["actions"]> = (row) => [+ {+ id: "delete",+ type: "item",+ title: "Delete",+ icon: TrashIcon,+ variant: "destructive",+ onClick: () => onDelete(row),+ },+ ];++ return (+ <SettingsTable+ tableName="Verified domains"+ columns={columns}+ actions={actions}+ data={data}+ noResultsMessage="No domains added yet"+ />+ );+}diff --git a/web/src/ee/features/verified-domains/components/VerifyDomainDialogController/VerifyDomainDialogController.tsx b/web/src/ee/features/verified-domains/components/VerifyDomainDialogController/VerifyDomainDialogController.tsxnew file mode 100644index 0000000000..c424e6f13e--- /dev/null+++ b/web/src/ee/features/verified-domains/components/VerifyDomainDialogController/VerifyDomainDialogController.tsx@@ -0,0 +1,59 @@+import { DialogController } from "@/src/components/design-system/DialogController/DialogController";+import { Dialog } from "@/src/components/design-system/Dialog/Dialog";+import { type ReactNode } from "react";+import { type DomainRowData } from "../VerifiedDomainsSettingsTable/VerifiedDomainsSettingsTable";+import { DnsRecordTable } from "../DnsRecordTable/DnsRecordTable";++export function VerifyDomainDialogController({+ children,+ verifyingDomainId,+ onVerify,+}: {+ children: (control: {+ openDialog: (row: DomainRowData) => void;+ }) => ReactNode;+ verifyingDomainId: string | null;+ onVerify: (row: DomainRowData) => Promise<void>;+}) {+ return (+ <DialogController<DomainRowData>+ onBeforeClose={() => verifyingDomainId === null}+ renderDialog={({ state: row, closeDialog }) => (+ <Dialog+ size="lg"+ title={`Verify ${row.domain}`}+ actions={[+ {+ label: "Verify domain",+ loading: verifyingDomainId === row.id,+ onClick: async () => {+ try {+ await onVerify(row);+ closeDialog();+ } catch {+ // The connected table reports the mutation error.+ }+ },+ },+ ]}+ >+ <Dialog.Body>+ <p className="text-sm font-bold">+ Add the following TXT record to your DNS provider:+ </p>+ <DnsRecordTable+ recordHost={row.recordHost}+ recordValue={row.recordValue}+ />+ <p className="text-muted-foreground text-xs">+ DNS changes may take up to 24h to propagate. After adding the+ record, click <span className="font-bold">Verify</span>.+ </p>+ </Dialog.Body>+ </Dialog>+ )}+ >+ {({ openDialog }) => children({ openDialog })}+ </DialogController>+ );+}