Open-source status page, incident response and uptime monitoring
TypeScript alertingincident-managementmcpmcp-servermonitoringmonitoring-as-codeobservabilityon-callopen-sourcesrestatus-pagestatuspagesynthetic-monitoringterraformtinybirdtursouptimeuptime-checkeruptime-monitor
feat(dashboard): bordered data tables with in-table pagination (#2932)
Maximilian Kaske228495cad325
diff --git a/apps/dashboard/src/app/(dashboard)/notifications/client.tsx b/apps/dashboard/src/app/(dashboard)/notifications/client.tsxindex 2b353346e..e1a7e112a 100644--- a/apps/dashboard/src/app/(dashboard)/notifications/client.tsx+++ b/apps/dashboard/src/app/(dashboard)/notifications/client.tsx@@ -25,6 +25,7 @@ import {import { columns } from "@/components/data-table/notifications/columns";import { FormSheetNotifier } from "@/components/forms/notifications/sheet";import { DataTable } from "@/components/ui/data-table/data-table";+import { DataTablePaginationSimple } from "@/components/ui/data-table/data-table-pagination";import { config, hiddenProviders } from "@/data/notifications.client";import { useTRPC } from "@/lib/trpc/client";@@ -69,7 +70,11 @@ export function Client() {<EmptyStateTitle>No notifier found</EmptyStateTitle></EmptyStateContainer>) : (- <DataTable columns={columns} data={notifications} />+ <DataTable+ paginationComponent={DataTablePaginationSimple}+ columns={columns}+ data={notifications}+ />)}</Section><Section>diff --git a/apps/dashboard/src/app/(dashboard)/overview/page.tsx b/apps/dashboard/src/app/(dashboard)/overview/page.tsxindex 2a853478d..8ccf285c4 100644--- a/apps/dashboard/src/app/(dashboard)/overview/page.tsx+++ b/apps/dashboard/src/app/(dashboard)/overview/page.tsx@@ -28,6 +28,7 @@ import {MetricCardValue,} from "@/components/metric/metric-card";import { DataTable } from "@/components/ui/data-table/data-table";+import { DataTablePaginationSimple } from "@/components/ui/data-table/data-table-pagination";import { buildOverviewData } from "@/data/overview-events.client";import { useTRPC } from "@/lib/trpc/client";@@ -134,6 +135,7 @@ export default function Page() {</SectionHeader>{needsAttention.length > 0 ? (<DataTable+ paginationComponent={DataTablePaginationSimple}columns={columns}data={needsAttention}defaultSorting={[{ id: "startedAt", desc: true }]}@@ -156,6 +158,7 @@ export default function Page() {</SectionDescription></SectionHeader><DataTable+ paginationComponent={DataTablePaginationSimple}columns={columns}data={upcomingMaintenances}defaultSorting={[{ id: "startedAt", desc: false }]}@@ -173,6 +176,7 @@ export default function Page() {</SectionHeader>{recentlyResolved.length > 0 ? (<DataTable+ paginationComponent={DataTablePaginationSimple}columns={columns}data={recentlyResolved}defaultSorting={[{ id: "startedAt", desc: true }]}diff --git a/apps/dashboard/src/app/(dashboard)/settings/audit-logs/client.tsx b/apps/dashboard/src/app/(dashboard)/settings/audit-logs/client.tsxindex 965734b4f..cdb5ab7c3 100644--- a/apps/dashboard/src/app/(dashboard)/settings/audit-logs/client.tsx+++ b/apps/dashboard/src/app/(dashboard)/settings/audit-logs/client.tsx@@ -118,6 +118,7 @@ export function Client() {{isLimited ? (<BillingOverlayContainer><DataTable+ paginationComponent={DataTablePaginationSimple}columns={columns}data={[...EXAMPLES, ...EXAMPLES, ...EXAMPLES]}defaultColumnVisibility={{diff --git a/apps/dashboard/src/app/(dashboard)/settings/integrations/connected-apps-card.tsx b/apps/dashboard/src/app/(dashboard)/settings/integrations/connected-apps-card.tsxindex 155102328..fa8df6777 100644--- a/apps/dashboard/src/app/(dashboard)/settings/integrations/connected-apps-card.tsx+++ b/apps/dashboard/src/app/(dashboard)/settings/integrations/connected-apps-card.tsx@@ -1,16 +1,6 @@"use client";-import type { RouterOutputs } from "@openstatus/api";-import { Badge } from "@openstatus/ui/components/ui/badge";-import {- Table,- TableBody,- TableCell,- TableHead,- TableHeader,- TableRow,-} from "@openstatus/ui/components/ui/table";-import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";+import { useQuery } from "@tanstack/react-query";import { Link } from "@/components/common/link";import {@@ -18,8 +8,7 @@ import {EmptyStateDescription,EmptyStateTitle,} from "@/components/content/empty-state";-import { TableCellEmpty } from "@/components/data-table/table-cell-empty";-import { QuickActions } from "@/components/dropdowns/quick-actions";+import { columns } from "@/components/data-table/settings/connected-apps/columns";import {FormCard,FormCardContent,@@ -29,37 +18,16 @@ import {FormCardHeader,FormCardTitle,} from "@/components/forms/form-card";-import { formatDate } from "@/lib/formatter";+import { DataTable } from "@/components/ui/data-table/data-table";+import { DataTablePaginationSimple } from "@/components/ui/data-table/data-table-pagination";import { useTRPC } from "@/lib/trpc/client";-type Grant = RouterOutputs["oauth"]["listGrants"][number];--function scopeLabel(scope: Grant["scope"]): string {- return scope.includes("write") ? "Read & write" : "Read-only";-}--function userLabel(user: Grant["user"]): string {- if (!user) return "Removed user";- const name = [user.firstName, user.lastName].filter(Boolean).join(" ");- return name || user.email || `User ${user.id}`;-}-/** OAuth grants minted through `/oauth/authorize` (Claude, Cursor, ChatGPT and other MCP clients). */export function ConnectedAppsCard() {const trpc = useTRPC();- const queryClient = useQueryClient();const query = useQuery(trpc.oauth.listGrants.queryOptions());const grants = query.data ?? [];- const revoke = useMutation(- trpc.oauth.revokeGrant.mutationOptions({- onSuccess: () =>- queryClient.invalidateQueries({- queryKey: trpc.oauth.listGrants.queryKey(),- }),- }),- );-return (<FormCard id="connected-apps"><FormCardHeader>@@ -87,64 +55,11 @@ export function ConnectedAppsCard() {</EmptyStateDescription></EmptyStateContainer>) : (- <div className="overflow-x-auto">- <Table>- <TableHeader>- <TableRow>- <TableHead>App</TableHead>- <TableHead>Access</TableHead>- <TableHead>Connected by</TableHead>- <TableHead>Connected</TableHead>- <TableHead>Last used</TableHead>- <TableHead>- <span className="sr-only">Actions</span>- </TableHead>- </TableRow>- </TableHeader>- <TableBody>- {grants.map((grant) => (- <TableRow key={grant.id}>- <TableCell className="font-medium">- {grant.clientName}- </TableCell>- <TableCell>- <Badge variant="secondary">- {scopeLabel(grant.scope)}- </Badge>- </TableCell>- <TableCell className="text-muted-foreground max-w-[200px] truncate">- {userLabel(grant.user)}- </TableCell>- <TableCell className="text-sm">- {grant.createdAt ? (- formatDate(grant.createdAt)- ) : (- <TableCellEmpty>Unknown</TableCellEmpty>- )}- </TableCell>- <TableCell className="text-sm">- {grant.lastUsedAt ? (- formatDate(grant.lastUsedAt)- ) : (- <TableCellEmpty>Never</TableCellEmpty>- )}- </TableCell>- <TableCell>- <div className="flex justify-end">- <QuickActions- deleteAction={{- confirmationValue: grant.clientName,- submitAction: async () =>- await revoke.mutateAsync({ grantId: grant.id }),- }}- />- </div>- </TableCell>- </TableRow>- ))}- </TableBody>- </Table>- </div>+ <DataTable+ columns={columns}+ data={grants}+ paginationComponent={DataTablePaginationSimple}+ />)}</FormCardContent><FormCardFooter>diff --git a/apps/dashboard/src/app/(dashboard)/settings/private-locations/client.tsx b/apps/dashboard/src/app/(dashboard)/settings/private-locations/client.tsxindex bb993d46b..3e7c26319 100644--- a/apps/dashboard/src/app/(dashboard)/settings/private-locations/client.tsx+++ b/apps/dashboard/src/app/(dashboard)/settings/private-locations/client.tsx@@ -21,6 +21,7 @@ import {import { columns } from "@/components/data-table/private-locations/columns";import { UpgradeDialog } from "@/components/dialogs/upgrade";import { DataTable } from "@/components/ui/data-table/data-table";+import { DataTablePaginationSimple } from "@/components/ui/data-table/data-table-pagination";import { useTRPC } from "@/lib/trpc/client";const EXAMPLES = [@@ -74,6 +75,7 @@ export function Client() {{workspace.limits["private-locations"] === false ? (<BillingOverlayContainer><DataTable+ paginationComponent={DataTablePaginationSimple}columns={columns}data={[...EXAMPLES, ...EXAMPLES, ...EXAMPLES]}/>@@ -105,7 +107,11 @@ export function Client() {/></BillingOverlayContainer>) : (- <DataTable columns={columns} data={privateLocations} />+ <DataTable+ paginationComponent={DataTablePaginationSimple}+ columns={columns}+ data={privateLocations}+ />)}</Section></SectionGroup>diff --git a/apps/dashboard/src/app/(dashboard)/status-pages/(list)/client.tsx b/apps/dashboard/src/app/(dashboard)/status-pages/(list)/client.tsxindex 7723dbce2..c44665ace 100644--- a/apps/dashboard/src/app/(dashboard)/status-pages/(list)/client.tsx+++ b/apps/dashboard/src/app/(dashboard)/status-pages/(list)/client.tsx@@ -7,6 +7,7 @@ import Link from "next/link";import { NoteButton } from "@/components/common/note";import { NoteDismissible } from "@/components/common/note-dismissible";import {+ Section,SectionDescription,SectionGroup,SectionHeader,@@ -35,17 +36,19 @@ export function Client() {</Link></NoteButton></NoteDismissible>- <SectionHeader>- <SectionTitle>Status Pages</SectionTitle>- <SectionDescription>- Create and manage your status pages.- </SectionDescription>+ <Section>+ <SectionHeader>+ <SectionTitle>Status Pages</SectionTitle>+ <SectionDescription>+ Create and manage your status pages.+ </SectionDescription>+ </SectionHeader><DataTablecolumns={columns}data={statusPages}paginationComponent={DataTablePaginationSimple}/>- </SectionHeader>+ </Section></SectionGroup>);}diff --git a/apps/dashboard/src/app/(dashboard)/status-pages/[id]/history/client.tsx b/apps/dashboard/src/app/(dashboard)/status-pages/[id]/history/client.tsxindex bbf4188fe..45eed1e1a 100644--- a/apps/dashboard/src/app/(dashboard)/status-pages/[id]/history/client.tsx+++ b/apps/dashboard/src/app/(dashboard)/status-pages/[id]/history/client.tsx@@ -47,6 +47,7 @@ import {MetricCardValue,} from "@/components/metric/metric-card";import { DataTable } from "@/components/ui/data-table/data-table";+import { DataTablePaginationSimple } from "@/components/ui/data-table/data-table-pagination";import {HISTORY_WINDOWS,getColumnVisibility,@@ -162,10 +163,10 @@ export function Client() {<BillingOverlayContainer><div className="overflow-x-auto"><DataTable+ paginationComponent={DataTablePaginationSimple}columns={columns}data={history.rows}columnVisibility={columnVisibility}- defaultPagination={{ pageIndex: 0, pageSize: 100 }}/></div><BillingOverlay>@@ -190,10 +191,10 @@ export function Client() {) : hasAnyData ? (<div className="overflow-x-auto"><DataTable+ paginationComponent={DataTablePaginationSimple}columns={columns}data={history.rows}columnVisibility={columnVisibility}- defaultPagination={{ pageIndex: 0, pageSize: 100 }}/></div>) : (diff --git a/apps/dashboard/src/app/(dashboard)/status-pages/[id]/maintenances/(list)/page.tsx b/apps/dashboard/src/app/(dashboard)/status-pages/[id]/maintenances/(list)/page.tsxindex f9983a7f2..5f633c506 100644--- a/apps/dashboard/src/app/(dashboard)/status-pages/[id]/maintenances/(list)/page.tsx+++ b/apps/dashboard/src/app/(dashboard)/status-pages/[id]/maintenances/(list)/page.tsx@@ -18,6 +18,7 @@ import { columns } from "@/components/data-table/maintenances/columns";import { FormSheetMaintenance } from "@/components/forms/maintenance/sheet";import { toCheckboxTreeItems } from "@/components/ui/checkbox-tree";import { DataTable } from "@/components/ui/data-table/data-table";+import { DataTablePaginationSimple } from "@/components/ui/data-table/data-table-pagination";import { useTRPC } from "@/lib/trpc/client";import { errorMessage } from "@/lib/trpc/error";@@ -96,7 +97,11 @@ export default function Page() {</FormSheetMaintenance></div></SectionHeaderRow>- <DataTable columns={columns} data={maintenances} />+ <DataTable+ paginationComponent={DataTablePaginationSimple}+ columns={columns}+ data={maintenances}+ /></Section></SectionGroup>);diff --git a/apps/dashboard/src/app/(dashboard)/status-pages/[id]/status-reports/(list)/page.tsx b/apps/dashboard/src/app/(dashboard)/status-pages/[id]/status-reports/(list)/page.tsxindex 4ce21a964..113f2f073 100644--- a/apps/dashboard/src/app/(dashboard)/status-pages/[id]/status-reports/(list)/page.tsx+++ b/apps/dashboard/src/app/(dashboard)/status-pages/[id]/status-reports/(list)/page.tsx@@ -21,6 +21,7 @@ import { columns } from "@/components/data-table/status-reports/columns";import { FormSheetStatusReport } from "@/components/forms/status-report/sheet";import { toCheckboxTreeItems } from "@/components/ui/checkbox-tree";import { DataTable } from "@/components/ui/data-table/data-table";+import { DataTablePaginationSimple } from "@/components/ui/data-table/data-table-pagination";import { useTRPC } from "@/lib/trpc/client";export default function Page() {@@ -134,7 +135,11 @@ export default function Page() {</FormSheetStatusReport></div></SectionHeaderRow>- <DataTable columns={columns} data={statusReports} />+ <DataTable+ paginationComponent={DataTablePaginationSimple}+ columns={columns}+ data={statusReports}+ /></Section></SectionGroup>);diff --git a/apps/dashboard/src/app/(dashboard)/status-pages/[id]/subscribers/page.tsx b/apps/dashboard/src/app/(dashboard)/status-pages/[id]/subscribers/page.tsxindex 16125fe5d..d6a687885 100644--- a/apps/dashboard/src/app/(dashboard)/status-pages/[id]/subscribers/page.tsx+++ b/apps/dashboard/src/app/(dashboard)/status-pages/[id]/subscribers/page.tsx@@ -158,6 +158,7 @@ export default function Page() {{isLimited ? (<BillingOverlayContainer><DataTable+ paginationComponent={DataTablePaginationSimple}columns={columns}toolbarComponent={SubscribersDataTableToolbar}data={[...EXAMPLES, ...EXAMPLES, ...EXAMPLES]}diff --git a/apps/dashboard/src/components/content/empty-state.tsx b/apps/dashboard/src/components/content/empty-state.tsxindex 76710b56e..830ec1bbb 100644--- a/apps/dashboard/src/components/content/empty-state.tsx+++ b/apps/dashboard/src/components/content/empty-state.tsx@@ -7,6 +7,7 @@ export function EmptyStateContainer({}: React.ComponentProps<"div">) {return (<div+ data-slot="empty-state-container"className={cn("border-border flex h-full flex-col items-center justify-center gap-2 rounded-lg border border-dashed p-4",className,@@ -24,7 +25,11 @@ export function EmptyStateTitle({...props}: React.ComponentProps<"p">) {return (- <p className={cn("text-foreground", className)} {...props}>+ <p+ data-slot="empty-state-title"+ className={cn("text-foreground", className)}+ {...props}+ >{children}</p>);@@ -37,6 +42,7 @@ export function EmptyStateDescription({}: React.ComponentProps<"p">) {return (<p+ data-slot="empty-state-description"className={cn("text-muted-foreground text-center text-sm", className)}{...props}>diff --git a/apps/dashboard/src/components/content/section.tsx b/apps/dashboard/src/components/content/section.tsxindex 3c3b068a5..0684a4ce0 100644--- a/apps/dashboard/src/components/content/section.tsx+++ b/apps/dashboard/src/components/content/section.tsx@@ -6,7 +6,11 @@ export function Section({...props}: React.ComponentProps<"section">) {return (- <section className={cn("space-y-4", className)} {...props}>+ <section+ data-slot="section"+ className={cn("space-y-4", className)}+ {...props}+ >{children}</section>);@@ -18,7 +22,11 @@ export function SectionHeader({...props}: React.ComponentProps<"div">) {return (- <div className={cn("flex min-w-0 flex-col gap-1.5", className)} {...props}>+ <div+ data-slot="section-header"+ className={cn("flex min-w-0 flex-col gap-1.5", className)}+ {...props}+ >{children}</div>);@@ -31,6 +39,7 @@ export function SectionHeaderRow({}: React.ComponentProps<"div">) {return (<div+ data-slot="section-header-row"className={cn("flex flex-col gap-1.5 sm:flex-row sm:items-end sm:justify-between",className,@@ -49,6 +58,7 @@ export function SectionDescription({}: React.ComponentProps<"p">) {return (<p+ data-slot="section-description"className={cn("font-commit-mono text-muted-foreground text-sm tracking-tight",className,@@ -66,7 +76,11 @@ export function SectionTitle({...props}: React.ComponentProps<"p">) {return (- <p className={cn("text-lg font-medium", className)} {...props}>+ <p+ data-slot="section-title"+ className={cn("text-lg font-medium", className)}+ {...props}+ >{children}</p>);@@ -79,6 +93,7 @@ export function SectionGroup({}: React.ComponentProps<"div">) {return (<div+ data-slot="section-group"className={cn("mx-auto w-full max-w-6xl space-y-8 px-4 py-8", className)}{...props}>@@ -93,7 +108,11 @@ export function SectionGroupHeader({...props}: React.ComponentProps<"div">) {return (- <div className={cn("space-y-1.5", className)} {...props}>+ <div+ data-slot="section-group-header"+ className={cn("space-y-1.5", className)}+ {...props}+ >{children}</div>);@@ -105,7 +124,11 @@ export function SectionGroupTitle({...props}: React.ComponentProps<"p">) {return (- <p className={cn("text-4xl font-bold", className)} {...props}>+ <p+ data-slot="section-group-title"+ className={cn("text-4xl font-bold", className)}+ {...props}+ >{children}</p>);diff --git a/apps/dashboard/src/components/data-table/monitors/data-table-toolbar.tsx b/apps/dashboard/src/components/data-table/monitors/data-table-toolbar.tsxindex 69c90e3fa..064170b8d 100644--- a/apps/dashboard/src/components/data-table/monitors/data-table-toolbar.tsx+++ b/apps/dashboard/src/components/data-table/monitors/data-table-toolbar.tsx@@ -29,7 +29,7 @@ export function MonitorDataTableToolbar({placeholder="Filter by name, url, type..."value={(table.getState().globalFilter as string) ?? ""}onChange={(event) => table.setGlobalFilter(event.target.value)}- className="h-8 w-[150px] lg:w-[250px]"+ className="h-8 w-[150px] shadow-none lg:w-[250px]"/>{table.getColumn("tags") && (<DataTableFacetedFilterdiff --git a/apps/dashboard/src/components/data-table/response-logs/regions/data-table.tsx b/apps/dashboard/src/components/data-table/response-logs/regions/data-table.tsxindex b02da9e40..4dddab44b 100644--- a/apps/dashboard/src/components/data-table/response-logs/regions/data-table.tsx+++ b/apps/dashboard/src/components/data-table/response-logs/regions/data-table.tsx@@ -9,6 +9,7 @@ import {RangePlotLegendItem,} from "@/components/content/range-plot";import { DataTable } from "@/components/ui/data-table/data-table";+import { DataTablePaginationSimple } from "@/components/ui/data-table/data-table-pagination";import { getRegionAxisMax } from "@/data/metrics.client";import type { RegionMetric } from "@/data/region-metrics";@@ -61,8 +62,6 @@ export function RegionsDataTable({// A hovered or keyboard-focused row lifts: the others fade.<divclassName={cn(- // flush with the section text instead of inset by the cell padding- "[&_tr>*:first-child]:pl-0 [&_tr>*:last-child]:pr-0",// the plot hover area bleeds past the last row; clip it instead of scrolling"[&_[data-slot=table-container]]:overflow-y-hidden","[&_tbody_tr]:transition-[opacity,background-color] [&_tbody_tr]:duration-150 [&_tbody_tr]:ease-out",@@ -70,9 +69,10 @@ export function RegionsDataTable({)}><DataTable+ paginationComponent={DataTablePaginationSimple}+ defaultPagination={{ pageIndex: 0, pageSize: 50 }}data={data}columns={columns}- pagination={{ pageIndex: 0, pageSize: Math.max(data.length, 1) }}defaultSorting={[{ id: "p50", desc: false }]}/></div>diff --git a/apps/dashboard/src/components/data-table/settings/api-key/columns.tsx b/apps/dashboard/src/components/data-table/settings/api-key/columns.tsxnew file mode 100644index 000000000..18ff576e4--- /dev/null+++ b/apps/dashboard/src/components/data-table/settings/api-key/columns.tsx@@ -0,0 +1,83 @@+"use client";++import type { RouterOutputs } from "@openstatus/api";+import { Badge } from "@openstatus/ui/components/ui/badge";+import type { ColumnDef } from "@tanstack/react-table";++import { formatDate } from "@/lib/formatter";++import { TableCellEmpty } from "../../table-cell-empty";+import { DataTableRowActions } from "./data-table-row-actions";++type ApiKey = RouterOutputs["apiKey"]["list"][number];++/**+ * Map a key's `scopes` array to a single human label. v1 keys carry one+ * value (`['read']` or `['write']`); legacy rows backfilled to+ * `['write']` show as "Read & write." `'*'` is super-admin (synthesized+ * by middleware, never settable through any public API). Seeing it on+ * a row indicates someone hand-edited the DB or a bug bypassed the+ * input enum — surface drift instead of silently mislabeling it.+ */+function scopeLabel(scopes: ApiKey["scopes"]): string {+ if (scopes.includes("*")) {+ if (typeof console !== "undefined") {+ console.warn(+ "[api-key table] row carries '*' scope — should never happen via the public API",+ );+ }+ return "Admin";+ }+ if (scopes.includes("write")) return "Read & write";+ if (scopes.includes("read")) return "Read-only";+ return "Unknown";+}++export const columns: ColumnDef<ApiKey>[] = [+ {+ accessorKey: "name",+ header: "Name",+ meta: { cellClassName: "font-medium" },+ },+ {+ accessorKey: "description",+ header: "Description",+ meta: { cellClassName: "text-muted-foreground max-w-[200px] truncate" },+ cell: ({ row }) =>+ row.original.description ? (+ row.original.description+ ) : (+ <TableCellEmpty>No description</TableCellEmpty>+ ),+ },+ {+ accessorKey: "prefix",+ header: "Prefix",+ cell: ({ row }) => (+ <code className="text-xs">{row.original.prefix}...</code>+ ),+ },+ {+ accessorKey: "scopes",+ header: "Access",+ cell: ({ row }) => (+ <Badge variant="secondary">{scopeLabel(row.original.scopes)}</Badge>+ ),+ },+ {+ accessorKey: "expiresAt",+ header: "Expires",+ meta: { cellClassName: "text-sm" },+ cell: ({ row }) =>+ row.original.expiresAt ? (+ formatDate(row.original.expiresAt)+ ) : (+ <TableCellEmpty>Never</TableCellEmpty>+ ),+ },+ {+ id: "actions",+ header: () => <span className="sr-only">Actions</span>,+ cell: ({ row }) => <DataTableRowActions row={row} />,+ },+];diff --git a/apps/dashboard/src/components/data-table/settings/api-key/data-table-row-actions.tsx b/apps/dashboard/src/components/data-table/settings/api-key/data-table-row-actions.tsxnew file mode 100644index 000000000..7ed6f926d--- /dev/null+++ b/apps/dashboard/src/components/data-table/settings/api-key/data-table-row-actions.tsx@@ -0,0 +1,40 @@+"use client";++import type { RouterOutputs } from "@openstatus/api";+import { useMutation, useQueryClient } from "@tanstack/react-query";+import type { Row } from "@tanstack/react-table";++import { QuickActions } from "@/components/dropdowns/quick-actions";+import { useTRPC } from "@/lib/trpc/client";++type ApiKey = RouterOutputs["apiKey"]["list"][number];++interface DataTableRowActionsProps {+ row: Row<ApiKey>;+}++export function DataTableRowActions({ row }: DataTableRowActionsProps) {+ const trpc = useTRPC();+ const queryClient = useQueryClient();+ const revokeApiKeyMutation = useMutation(+ trpc.apiKey.revoke.mutationOptions({+ onSuccess: () =>+ queryClient.invalidateQueries({+ queryKey: trpc.apiKey.list.queryKey(),+ }),+ }),+ );++ return (+ <div className="flex justify-end">+ <QuickActions+ deleteAction={{+ confirmationValue: row.original.name ?? "api key",+ submitAction: async () => {+ await revokeApiKeyMutation.mutateAsync({ keyId: row.original.id });+ },+ }}+ />+ </div>+ );+}diff --git a/apps/dashboard/src/components/data-table/settings/api-key/data-table.tsx b/apps/dashboard/src/components/data-table/settings/api-key/data-table.tsxindex 6dbbe597d..568e07f77 100644--- a/apps/dashboard/src/components/data-table/settings/api-key/data-table.tsx+++ b/apps/dashboard/src/components/data-table/settings/api-key/data-table.tsx@@ -1,115 +1,18 @@import type { RouterOutputs } from "@openstatus/api";-import { Badge } from "@openstatus/ui/components/ui/badge";-import {- Table,- TableBody,- TableCell,- TableHead,- TableHeader,- TableRow,-} from "@openstatus/ui/components/ui/table";-import { useMutation } from "@tanstack/react-query";-import { QuickActions } from "@/components/dropdowns/quick-actions";-import { formatDate } from "@/lib/formatter";-import { useTRPC } from "@/lib/trpc/client";+import { DataTable as DataTableBase } from "@/components/ui/data-table/data-table";+import { DataTablePaginationSimple } from "@/components/ui/data-table/data-table-pagination";-import { TableCellEmpty } from "../../table-cell-empty";+import { columns } from "./columns";type ApiKey = RouterOutputs["apiKey"]["list"][number];-/**- * Map a key's `scopes` array to a single human label. v1 keys carry one- * value (`['read']` or `['write']`); legacy rows backfilled to- * `['write']` show as "Read & write." `'*'` is super-admin (synthesized- * by middleware, never settable through any public API). Seeing it on- * a row indicates someone hand-edited the DB or a bug bypassed the- * input enum — surface drift instead of silently mislabeling it.- */-function scopeLabel(scopes: ApiKey["scopes"]): string {- if (scopes.includes("*")) {- if (typeof console !== "undefined") {- console.warn(- "[api-key table] row carries '*' scope — should never happen via the public API",- );- }- return "Admin";- }- if (scopes.includes("write")) return "Read & write";- if (scopes.includes("read")) return "Read-only";- return "Unknown";-}--export function DataTable({- apiKeys,- refetch,-}: {- apiKeys: ApiKey[];- refetch: () => void;-}) {- const trpc = useTRPC();- const revokeApiKeyMutation = useMutation(- trpc.apiKey.revoke.mutationOptions({- onSuccess: () => refetch(),- }),- );-+export function DataTable({ apiKeys }: { apiKeys: ApiKey[] }) {return (- <div className="overflow-x-auto">- <Table>- <TableHeader>- <TableRow>- <TableHead>Name</TableHead>- <TableHead>Description</TableHead>- <TableHead>Prefix</TableHead>- <TableHead>Access</TableHead>- <TableHead>Expires</TableHead>- <TableHead>- <span className="sr-only">Actions</span>- </TableHead>- </TableRow>- </TableHeader>- <TableBody>- {apiKeys.map((apiKey) => (- <TableRow key={apiKey.id}>- <TableCell className="font-medium">{apiKey.name}</TableCell>- <TableCell className="text-muted-foreground max-w-[200px] truncate">- {apiKey.description ? (- apiKey.description- ) : (- <TableCellEmpty>No description</TableCellEmpty>- )}- </TableCell>- <TableCell>- <code className="text-xs">{apiKey.prefix}...</code>- </TableCell>- <TableCell>- <Badge variant="secondary">{scopeLabel(apiKey.scopes)}</Badge>- </TableCell>- <TableCell className="text-sm">- {apiKey.expiresAt ? (- formatDate(apiKey.expiresAt)- ) : (- <TableCellEmpty>Never</TableCellEmpty>- )}- </TableCell>- <TableCell>- <div className="flex justify-end">- <QuickActions- deleteAction={{- confirmationValue: apiKey.name ?? "api key",- submitAction: async () =>- await revokeApiKeyMutation.mutateAsync({- keyId: apiKey.id,- }),- }}- />- </div>- </TableCell>- </TableRow>- ))}- </TableBody>- </Table>- </div>+ <DataTableBase+ columns={columns}+ data={apiKeys}+ paginationComponent={DataTablePaginationSimple}+ />);}diff --git a/apps/dashboard/src/components/data-table/settings/connected-apps/columns.tsx b/apps/dashboard/src/components/data-table/settings/connected-apps/columns.tsxnew file mode 100644index 000000000..849232277--- /dev/null+++ b/apps/dashboard/src/components/data-table/settings/connected-apps/columns.tsx@@ -0,0 +1,70 @@+"use client";++import type { RouterOutputs } from "@openstatus/api";+import { Badge } from "@openstatus/ui/components/ui/badge";+import type { ColumnDef } from "@tanstack/react-table";++import { formatDate } from "@/lib/formatter";++import { TableCellEmpty } from "../../table-cell-empty";+import { DataTableRowActions } from "./data-table-row-actions";++type Grant = RouterOutputs["oauth"]["listGrants"][number];++function scopeLabel(scope: Grant["scope"]): string {+ return scope.includes("write") ? "Read & write" : "Read-only";+}++function userLabel(user: Grant["user"]): string {+ if (!user) return "Removed user";+ const name = [user.firstName, user.lastName].filter(Boolean).join(" ");+ return name || user.email || `User ${user.id}`;+}++export const columns: ColumnDef<Grant>[] = [+ {+ accessorKey: "clientName",+ header: "App",+ meta: { cellClassName: "font-medium" },+ },+ {+ accessorKey: "scope",+ header: "Access",+ cell: ({ row }) => (+ <Badge variant="secondary">{scopeLabel(row.original.scope)}</Badge>+ ),+ },+ {+ id: "user",+ header: "Connected by",+ meta: { cellClassName: "text-muted-foreground max-w-[200px] truncate" },+ cell: ({ row }) => userLabel(row.original.user),+ },+ {+ accessorKey: "createdAt",+ header: "Connected",+ meta: { cellClassName: "text-sm" },+ cell: ({ row }) =>+ row.original.createdAt ? (+ formatDate(row.original.createdAt)+ ) : (+ <TableCellEmpty>Unknown</TableCellEmpty>+ ),+ },+ {+ accessorKey: "lastUsedAt",+ header: "Last used",+ meta: { cellClassName: "text-sm" },+ cell: ({ row }) =>+ row.original.lastUsedAt ? (+ formatDate(row.original.lastUsedAt)+ ) : (+ <TableCellEmpty>Never</TableCellEmpty>+ ),+ },+ {+ id: "actions",+ header: () => <span className="sr-only">Actions</span>,+ cell: ({ row }) => <DataTableRowActions row={row} />,+ },+];diff --git a/apps/dashboard/src/components/data-table/settings/connected-apps/data-table-row-actions.tsx b/apps/dashboard/src/components/data-table/settings/connected-apps/data-table-row-actions.tsxnew file mode 100644index 000000000..b7e65f176--- /dev/null+++ b/apps/dashboard/src/components/data-table/settings/connected-apps/data-table-row-actions.tsx@@ -0,0 +1,40 @@+"use client";++import type { RouterOutputs } from "@openstatus/api";+import { useMutation, useQueryClient } from "@tanstack/react-query";+import type { Row } from "@tanstack/react-table";++import { QuickActions } from "@/components/dropdowns/quick-actions";+import { useTRPC } from "@/lib/trpc/client";++type Grant = RouterOutputs["oauth"]["listGrants"][number];++interface DataTableRowActionsProps {+ row: Row<Grant>;+}++export function DataTableRowActions({ row }: DataTableRowActionsProps) {+ const trpc = useTRPC();+ const queryClient = useQueryClient();+ const revokeGrantMutation = useMutation(+ trpc.oauth.revokeGrant.mutationOptions({+ onSuccess: () =>+ queryClient.invalidateQueries({+ queryKey: trpc.oauth.listGrants.queryKey(),+ }),+ }),+ );++ return (+ <div className="flex justify-end">+ <QuickActions+ deleteAction={{+ confirmationValue: row.original.clientName,+ submitAction: async () => {+ await revokeGrantMutation.mutateAsync({ grantId: row.original.id });+ },+ }}+ />+ </div>+ );+}diff --git a/apps/dashboard/src/components/data-table/settings/invitations/columns.tsx b/apps/dashboard/src/components/data-table/settings/invitations/columns.tsxnew file mode 100644index 000000000..793385d93--- /dev/null+++ b/apps/dashboard/src/components/data-table/settings/invitations/columns.tsx@@ -0,0 +1,36 @@+"use client";++import type { RouterOutputs } from "@openstatus/api";+import type { ColumnDef } from "@tanstack/react-table";++import { formatDate } from "@/lib/formatter";++import { TableCellEmpty } from "../../table-cell-empty";+import { DataTableRowActions } from "./data-table-row-actions";++type Invitation = RouterOutputs["invitation"]["list"][number];++export const columns: ColumnDef<Invitation>[] = [+ { accessorKey: "email", header: "Email" },+ { accessorKey: "role", header: "Role" },+ {+ accessorKey: "createdAt",+ header: "Created At",+ cell: ({ row }) =>+ row.original.createdAt ? (+ formatDate(row.original.createdAt)+ ) : (+ <TableCellEmpty>Unknown</TableCellEmpty>+ ),+ },+ {+ accessorKey: "expiresAt",+ header: "Expires At",+ cell: ({ row }) => formatDate(row.original.expiresAt),+ },+ {+ id: "actions",+ header: () => <span className="sr-only">Actions</span>,+ cell: ({ row }) => <DataTableRowActions row={row} />,+ },+];diff --git a/apps/dashboard/src/components/data-table/settings/invitations/data-table-row-actions.tsx b/apps/dashboard/src/components/data-table/settings/invitations/data-table-row-actions.tsxnew file mode 100644index 000000000..e8f0ddd18--- /dev/null+++ b/apps/dashboard/src/components/data-table/settings/invitations/data-table-row-actions.tsx@@ -0,0 +1,40 @@+"use client";++import type { RouterOutputs } from "@openstatus/api";+import { useMutation, useQueryClient } from "@tanstack/react-query";+import type { Row } from "@tanstack/react-table";++import { QuickActions } from "@/components/dropdowns/quick-actions";+import { useTRPC } from "@/lib/trpc/client";++type Invitation = RouterOutputs["invitation"]["list"][number];++interface DataTableRowActionsProps {+ row: Row<Invitation>;+}++export function DataTableRowActions({ row }: DataTableRowActionsProps) {+ const trpc = useTRPC();+ const queryClient = useQueryClient();+ const deleteInvitationMutation = useMutation(+ trpc.invitation.delete.mutationOptions({+ onSuccess: () =>+ queryClient.invalidateQueries({+ queryKey: trpc.invitation.list.queryKey(),+ }),+ }),+ );++ return (+ <div className="flex justify-end">+ <QuickActions+ deleteAction={{+ confirmationValue: row.original.email ?? "invitation",+ submitAction: async () => {+ await deleteInvitationMutation.mutateAsync({ id: row.original.id });+ },+ }}+ />+ </div>+ );+}diff --git a/apps/dashboard/src/components/data-table/settings/invitations/data-table.tsx b/apps/dashboard/src/components/data-table/settings/invitations/data-table.tsxindex 769b40e7e..1d25d173a 100644--- a/apps/dashboard/src/components/data-table/settings/invitations/data-table.tsx+++ b/apps/dashboard/src/components/data-table/settings/invitations/data-table.tsx@@ -1,34 +1,19 @@-import {- Table,- TableBody,- TableCell,- TableHead,- TableHeader,- TableRow,-} from "@openstatus/ui/components/ui/table";-import { useMutation, useQuery } from "@tanstack/react-query";+import { useQuery } from "@tanstack/react-query";import {EmptyStateContainer,EmptyStateDescription,EmptyStateTitle,} from "@/components/content/empty-state";-import { QuickActions } from "@/components/dropdowns/quick-actions";-import { formatDate } from "@/lib/formatter";+import { DataTable as DataTableBase } from "@/components/ui/data-table/data-table";+import { DataTablePaginationSimple } from "@/components/ui/data-table/data-table-pagination";import { useTRPC } from "@/lib/trpc/client";-import { TableCellEmpty } from "../../table-cell-empty";+import { columns } from "./columns";export function DataTable() {const trpc = useTRPC();- const { data: invitations, refetch } = useQuery(- trpc.invitation.list.queryOptions(),- );- const deleteInvitationMutation = useMutation(- trpc.invitation.delete.mutationOptions({- onSuccess: () => refetch(),- }),- );+ const { data: invitations } = useQuery(trpc.invitation.list.queryOptions());if (!invitations) return null;@@ -44,53 +29,10 @@ export function DataTable() {}return (- <Table>- <TableHeader>- <TableRow>- <TableHead>Email</TableHead>- <TableHead>Role</TableHead>- <TableHead>Created At</TableHead>- <TableHead>Expires At</TableHead>- <TableHead>Accepted At</TableHead>- <TableHead>- <span className="sr-only">Actions</span>- </TableHead>- </TableRow>- </TableHeader>- <TableBody>- {invitations.map((item) => (- <TableRow key={item.id}>- <TableCell>{item.email}</TableCell>- <TableCell>{item.role}</TableCell>- <TableCell>- {item.createdAt ? (- formatDate(item.createdAt)- ) : (- <TableCellEmpty>Unknown</TableCellEmpty>- )}- </TableCell>- <TableCell>{formatDate(item.expiresAt)}</TableCell>- <TableCell>- {item.acceptedAt ? (- formatDate(item.acceptedAt)- ) : (- <TableCellEmpty>Pending</TableCellEmpty>- )}- </TableCell>- <TableCell>- <div className="flex justify-end">- <QuickActions- deleteAction={{- confirmationValue: item.email ?? "invitation",- submitAction: async () =>- deleteInvitationMutation.mutateAsync({ id: item.id }),- }}- />- </div>- </TableCell>- </TableRow>- ))}- </TableBody>- </Table>+ <DataTableBase+ columns={columns}+ data={invitations}+ paginationComponent={DataTablePaginationSimple}+ />);}diff --git a/apps/dashboard/src/components/data-table/settings/members/columns.tsx b/apps/dashboard/src/components/data-table/settings/members/columns.tsxnew file mode 100644index 000000000..158628ad4--- /dev/null+++ b/apps/dashboard/src/components/data-table/settings/members/columns.tsx@@ -0,0 +1,63 @@+"use client";++import type { RouterOutputs } from "@openstatus/api";+import { Badge } from "@openstatus/ui/components/ui/badge";+import { useQuery } from "@tanstack/react-query";+import type { ColumnDef } from "@tanstack/react-table";++import { formatDate } from "@/lib/formatter";+import { useTRPC } from "@/lib/trpc/client";++import { TableCellEmpty } from "../../table-cell-empty";+import { DataTableRowActions } from "./data-table-row-actions";++type Member = RouterOutputs["member"]["list"][number];++export const columns: ColumnDef<Member>[] = [+ {+ id: "name",+ header: "Name",+ cell: ({ row }) => <MemberName member={row.original} />,+ },+ {+ id: "email",+ header: "Email",+ cell: ({ row }) => row.original.user.email,+ },+ {+ accessorKey: "role",+ header: "Role",+ cell: ({ row }) => (+ <Badge+ variant={row.original.role === "owner" ? "default" : "outline"}+ className="capitalize"+ >+ {row.original.role}+ </Badge>+ ),+ },+ {+ id: "createdAt",+ header: "Created",+ cell: ({ row }) =>+ formatDate(row.original.user.createdAt ?? row.original.createdAt),+ },+ {+ id: "actions",+ header: () => <span className="sr-only">Actions</span>,+ cell: ({ row }) => <DataTableRowActions row={row} />,+ },+];++function MemberName({ member }: { member: Member }) {+ const trpc = useTRPC();+ const { data: user } = useQuery(trpc.user.get.queryOptions());+ const isMe = Boolean(user?.id && member.user.id === user.id);++ return (+ <div className="flex items-center gap-2">+ {member.user.name || <TableCellEmpty>No name</TableCellEmpty>}+ {isMe ? <Badge variant="secondary">You</Badge> : null}+ </div>+ );+}diff --git a/apps/dashboard/src/components/data-table/settings/members/data-table-row-actions.tsx b/apps/dashboard/src/components/data-table/settings/members/data-table-row-actions.tsxnew file mode 100644index 000000000..b1fa7b39a--- /dev/null+++ b/apps/dashboard/src/components/data-table/settings/members/data-table-row-actions.tsx@@ -0,0 +1,83 @@+"use client";++import type { RouterOutputs } from "@openstatus/api";+import { ShieldUser } from "@openstatus/icons";+import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";+import type { Row } from "@tanstack/react-table";+import { useState } from "react";++import { QuickActions } from "@/components/dropdowns/quick-actions";+import { useTRPC } from "@/lib/trpc/client";++import { TransferOwnershipDialog } from "./transfer-ownership-dialog";++type Member = RouterOutputs["member"]["list"][number];++interface DataTableRowActionsProps {+ row: Row<Member>;+}++export function DataTableRowActions({ row }: DataTableRowActionsProps) {+ const trpc = useTRPC();+ const queryClient = useQueryClient();+ const { data: members } = useQuery(trpc.member.list.queryOptions());+ const { data: currentUser } = useQuery(trpc.user.get.queryOptions());+ const { data: workspace } = useQuery(trpc.workspace.get.queryOptions());+ const deleteMemberMutation = useMutation(+ trpc.member.delete.mutationOptions({+ onSuccess: () =>+ queryClient.invalidateQueries({+ queryKey: trpc.member.list.queryKey(),+ }),+ }),+ );+ const [transferOpen, setTransferOpen] = useState(false);++ const member = row.original;+ const { user } = member;+ const isOwner =+ members?.find((m) => m.user.id === currentUser?.id)?.role === "owner";+ const isMe = Boolean(currentUser?.id && user.id === currentUser.id);+ const canTransfer =+ member.role !== "owner" && !user.deletedAt && !!user.email;++ // The server rejects non-owners; don't offer what will fail.+ if (!isOwner || isMe) return null;++ return (+ <div className="flex justify-end">+ <QuickActions+ actions={+ canTransfer+ ? [+ {+ id: "transfer",+ label: "Make owner",+ icon: ShieldUser,+ variant: "default",+ onClick: () => setTransferOpen(true),+ },+ ]+ : undefined+ }+ deleteAction={{+ confirmationValue: user.email ?? "user",+ description: workspace?.ssoEnabled+ ? "This workspace uses SSO. They can sign in again and rejoin automatically unless you also remove them from your identity provider."+ : undefined,+ submitAction: async () => {+ await deleteMemberMutation.mutateAsync({ id: user.id });+ },+ }}+ />+ {/* Outside `QuickActions`: its dropdown item unmounts with the menu. */}+ {canTransfer && user.email ? (+ <TransferOwnershipDialog+ member={{ id: user.id, name: user.name, email: user.email }}+ open={transferOpen}+ onOpenChange={setTransferOpen}+ />+ ) : null}+ </div>+ );+}diff --git a/apps/dashboard/src/components/data-table/settings/members/data-table.tsx b/apps/dashboard/src/components/data-table/settings/members/data-table.tsxindex 6fa1ebc45..9b3a58692 100644--- a/apps/dashboard/src/components/data-table/settings/members/data-table.tsx+++ b/apps/dashboard/src/components/data-table/settings/members/data-table.tsx@@ -1,154 +1,22 @@-import { ShieldUser } from "@openstatus/icons";-import { Badge } from "@openstatus/ui/components/ui/badge";-import {- Table,- TableBody,- TableCell,- TableHead,- TableHeader,- TableRow,-} from "@openstatus/ui/components/ui/table";-import { useMutation, useQuery } from "@tanstack/react-query";-import { useState } from "react";+import { useQuery } from "@tanstack/react-query";-import { QuickActions } from "@/components/dropdowns/quick-actions";-import { formatDate } from "@/lib/formatter";+import { DataTable as DataTableBase } from "@/components/ui/data-table/data-table";+import { DataTablePaginationSimple } from "@/components/ui/data-table/data-table-pagination";import { useTRPC } from "@/lib/trpc/client";-import { TableCellEmpty } from "../../table-cell-empty";-import { TransferOwnershipDialog } from "./transfer-ownership-dialog";+import { columns } from "./columns";export function DataTable() {const trpc = useTRPC();- const { data: members, refetch } = useQuery(trpc.member.list.queryOptions());- const { data: user } = useQuery(trpc.user.get.queryOptions());- const { data: workspace } = useQuery(trpc.workspace.get.queryOptions());- const deleteMemberMutation = useMutation(- trpc.member.delete.mutationOptions({- onSuccess: () => refetch(),- }),- );+ const { data: members } = useQuery(trpc.member.list.queryOptions());if (!members) return null;- const currentUserId = user?.id;- const isOwner =- members.find((m) => m.user.id === currentUserId)?.role === "owner";-- return (- <Table>- <TableHeader>- <TableRow>- <TableHead>Name</TableHead>- <TableHead>Email</TableHead>- <TableHead>Role</TableHead>- <TableHead>Created</TableHead>- <TableHead>- <span className="sr-only">Actions</span>- </TableHead>- </TableRow>- </TableHeader>- <TableBody>- {members.map((item) => {- const isMe = Boolean(currentUserId && item.user.id === currentUserId);- // The server rejects non-owners; don't offer what will fail.- const canDelete = isOwner && !isMe;-- return (- <TableRow key={item.user.id}>- <TableCell>- <div className="flex items-center gap-2">- {item.user.name ?? <TableCellEmpty>No name</TableCellEmpty>}- {isMe ? <Badge variant="secondary">You</Badge> : null}- </div>- </TableCell>- <TableCell>{item.user.email}</TableCell>- <TableCell>- <Badge- variant={item.role === "owner" ? "default" : "outline"}- className="capitalize"- >- {item.role}- </Badge>- </TableCell>- <TableCell>- {formatDate(item.user.createdAt ?? item.createdAt)}- </TableCell>- <TableCell>- {canDelete ? (- <MemberRowActions- member={item}- ssoEnabled={!!workspace?.ssoEnabled}- onDelete={async () =>- await deleteMemberMutation.mutateAsync({- id: item.user.id,- })- }- />- ) : null}- </TableCell>- </TableRow>- );- })}- </TableBody>- </Table>- );-}--function MemberRowActions({- member,- ssoEnabled,- onDelete,-}: {- member: {- role: string;- user: {- id: number;- name: string | null;- email: string | null;- deletedAt: Date | null;- };- };- ssoEnabled: boolean;- onDelete: () => Promise<void>;-}) {- const [transferOpen, setTransferOpen] = useState(false);- const { user } = member;- const canTransfer =- member.role !== "owner" && !user.deletedAt && !!user.email;-return (- <div className="flex justify-end">- <QuickActions- actions={- canTransfer- ? [- {- id: "transfer",- label: "Make owner",- icon: ShieldUser,- variant: "default",- onClick: () => setTransferOpen(true),- },- ]- : undefined- }- deleteAction={{- confirmationValue: user.email ?? "user",- description: ssoEnabled- ? "This workspace uses SSO. They can sign in again and rejoin automatically unless you also remove them from your identity provider."- : undefined,- submitAction: onDelete,- }}- />- {/* Outside `QuickActions`: its dropdown item unmounts with the menu. */}- {canTransfer && user.email ? (- <TransferOwnershipDialog- member={{ id: user.id, name: user.name, email: user.email }}- open={transferOpen}- onOpenChange={setTransferOpen}- />- ) : null}- </div>+ <DataTableBase+ columns={columns}+ data={members}+ paginationComponent={DataTablePaginationSimple}+ />);}diff --git a/apps/dashboard/src/components/forms/settings/form-api-key.tsx b/apps/dashboard/src/components/forms/settings/form-api-key.tsxindex 3d002a0ab..ee60e6817 100644--- a/apps/dashboard/src/components/forms/settings/form-api-key.tsx+++ b/apps/dashboard/src/components/forms/settings/form-api-key.tsx@@ -26,9 +26,7 @@ import { useTRPC } from "@/lib/trpc/client";export function FormApiKey() {const trpc = useTRPC();- const { data: apiKeys = [], refetch } = useQuery(- trpc.apiKey.list.queryOptions(),- );+ const { data: apiKeys = [] } = useQuery(trpc.apiKey.list.queryOptions());return (<FormCard id="api-keys">@@ -47,7 +45,7 @@ export function FormApiKey() {</EmptyStateDescription></EmptyStateContainer>) : (- <DataTable apiKeys={apiKeys} refetch={refetch} />+ <DataTable apiKeys={apiKeys} />)}</FormCardContent><FormCardFooter>diff --git a/apps/dashboard/src/components/onboarding/checks-table.tsx b/apps/dashboard/src/components/onboarding/checks-table.tsxindex 14f825ab4..97267e47a 100644--- a/apps/dashboard/src/components/onboarding/checks-table.tsx+++ b/apps/dashboard/src/components/onboarding/checks-table.tsx@@ -92,10 +92,7 @@ export function OnboardingChecksTable({if (rows.length === 0 && isStreaming) {return (<div- className={cn(- "border-border bg-background overflow-auto rounded-md border md:min-h-0 md:flex-1",- className,- )}+ className={cn("overflow-auto md:min-h-0 md:flex-1", className)}{...props}><DataTableSkeleton rows={Math.min(totalRegions, 8)} />diff --git a/apps/dashboard/src/components/ui/data-table/data-table-faceted-filter.tsx b/apps/dashboard/src/components/ui/data-table/data-table-faceted-filter.tsxindex 8c4863d3c..b9bceb830 100644--- a/apps/dashboard/src/components/ui/data-table/data-table-faceted-filter.tsx+++ b/apps/dashboard/src/components/ui/data-table/data-table-faceted-filter.tsx@@ -48,7 +48,7 @@ export function DataTableFacetedFilter<TData, TValue>({variant="outline"size="sm"className={cn(- "h-8 border-dashed",+ "h-8 border-dashed shadow-none",selectedValues?.size > 0 && "border-solid",)}>diff --git a/apps/dashboard/src/components/ui/data-table/data-table-pagination.tsx b/apps/dashboard/src/components/ui/data-table/data-table-pagination.tsxindex fded59948..33eaafca4 100644--- a/apps/dashboard/src/components/ui/data-table/data-table-pagination.tsx+++ b/apps/dashboard/src/components/ui/data-table/data-table-pagination.tsx@@ -95,53 +95,121 @@ export function DataTablePagination<TData>({);}+/** First, last and the current page's neighbours; "…" never hides a single page. */+function getPageItems(current: number, count: number): (number | "ellipsis")[] {+ if (count <= 5) return Array.from({ length: count }, (_, i) => i);+ const last = count - 1;+ const pages = new Set([0, last, current - 1, current, current + 1]);+ if (current <= 2) [1, 2, 3].forEach((p) => pages.add(p));+ if (current >= last - 2)+ [last - 3, last - 2, last - 1].forEach((p) => pages.add(p));+ const sorted = [...pages]+ .filter((p) => p >= 0 && p <= last)+ .sort((x, y) => x - y);++ const items: (number | "ellipsis")[] = [];+ for (const page of sorted) {+ const prev = items.at(-1);+ if (typeof prev === "number" && page - prev === 2) items.push(prev + 1);+ else if (typeof prev === "number" && page - prev > 2)+ items.push("ellipsis");+ items.push(page);+ }+ return items;+}++const PAGE_SIZES = [10, 20, 50, 100];+export function DataTablePaginationSimple<TData>({table,}: DataTablePaginationProps<TData>) {+ const { pageIndex, pageSize } = table.getState().pagination;+ const total = table.getFilteredRowModel().rows.length;+ const pageCount = table.getPageCount();+ const from = pageIndex * pageSize + 1;+ const to = Math.min(total, (pageIndex + 1) * pageSize);++ if (total <= table.initialState.pagination.pageSize) return null;++ const pageSizes = [...new Set([...PAGE_SIZES, pageSize])].sort(+ (a, b) => a - b,+ );+return (- <div className="flex items-center justify-between">- <div className="text-muted-foreground flex-1 text-sm">- {table.getFilteredRowModel().rows.length} of{" "}- {table.getPreFilteredRowModel().rows.length} row(s) filtered.- </div>- <div className="flex items-center space-x-2">- <Button- variant="outline"- className="hidden h-8 w-8 p-0 lg:flex"- onClick={() => table.setPageIndex(0)}- disabled={!table.getCanPreviousPage()}- >- <span className="sr-only">Go to first page</span>- <ChevronsLeft />- </Button>- <Button- variant="outline"- className="h-8 w-8 p-0"- onClick={() => table.previousPage()}- disabled={!table.getCanPreviousPage()}- >- <span className="sr-only">Go to previous page</span>- <ChevronLeft />- </Button>- <Button- variant="outline"- className="h-8 w-8 p-0"- onClick={() => table.nextPage()}- disabled={!table.getCanNextPage()}- >- <span className="sr-only">Go to next page</span>- <ChevronRight />- </Button>- <Button- variant="outline"- className="hidden h-8 w-8 p-0 lg:flex"- onClick={() => table.setPageIndex(table.getPageCount() - 1)}- disabled={!table.getCanNextPage()}+ <div className="bg-muted/40 flex min-h-10 flex-wrap items-center justify-between gap-x-2 gap-y-1 border-t px-2 py-1.5">+ <div className="flex items-center gap-3">+ <div className="text-muted-foreground text-sm tabular-nums">+ {from}–{to} of {total}+ </div>+ <Select+ value={`${pageSize}`}+ onValueChange={(value) => table.setPageSize(Number(value))}>- <span className="sr-only">Go to last page</span>- <ChevronsRight />- </Button>+ <SelectTrigger+ size="sm"+ aria-label="Rows per page"+ className="bg-background hidden h-7 gap-1 px-2 tabular-nums shadow-none sm:flex"+ >+ <SelectValue />+ </SelectTrigger>+ <SelectContent side="top">+ {pageSizes.map((size) => (+ <SelectItem key={size} value={`${size}`}>+ {size} / page+ </SelectItem>+ ))}+ </SelectContent>+ </Select></div>+ {pageCount > 1 ? (+ <nav aria-label="Pagination" className="flex items-center gap-0.5">+ <Button+ type="button"+ variant="ghost"+ size="icon-sm"+ className="size-7"+ onClick={() => table.previousPage()}+ disabled={!table.getCanPreviousPage()}+ >+ <span className="sr-only">Go to previous page</span>+ <ChevronLeft />+ </Button>+ {getPageItems(pageIndex, pageCount).map((item, i) =>+ item === "ellipsis" ? (+ <span+ key={`ellipsis-${i}`}+ className="text-muted-foreground w-7 text-center text-sm"+ >+ …+ </span>+ ) : (+ <Button+ key={item}+ type="button"+ aria-label={`Page ${item + 1}`}+ variant={item === pageIndex ? "outline" : "ghost"}+ size="icon-sm"+ className="size-7 tabular-nums"+ aria-current={item === pageIndex ? "page" : undefined}+ onClick={() => table.setPageIndex(item)}+ >+ {item + 1}+ </Button>+ ),+ )}+ <Button+ type="button"+ variant="ghost"+ size="icon-sm"+ className="size-7"+ onClick={() => table.nextPage()}+ disabled={!table.getCanNextPage()}+ >+ <span className="sr-only">Go to next page</span>+ <ChevronRight />+ </Button>+ </nav>+ ) : null}</div>);}diff --git a/apps/dashboard/src/components/ui/data-table/data-table-skeleton.tsx b/apps/dashboard/src/components/ui/data-table/data-table-skeleton.tsxindex 7298f07de..334ea6be7 100644--- a/apps/dashboard/src/components/ui/data-table/data-table-skeleton.tsx+++ b/apps/dashboard/src/components/ui/data-table/data-table-skeleton.tsx@@ -18,45 +18,47 @@ interface DataTableSkeletonProps {export function DataTableSkeleton({ rows = 3 }: DataTableSkeletonProps) {return (- <Table>- <TableHeader className="bg-muted/50">- <TableRow className="hover:bg-transparent">- <TableHead>- <Skeleton className="my-1.5 h-4 w-24" />- </TableHead>- <TableHead className="hidden sm:table-cell">- <Skeleton className="my-1.5 h-4 w-32" />- </TableHead>- <TableHead className="hidden md:table-cell">- <Skeleton className="my-1.5 h-4 w-16" />- </TableHead>- <TableHead>- <Skeleton className="my-1.5 h-4 w-20" />- </TableHead>- <TableHead className="flex items-center justify-end" />- </TableRow>- </TableHeader>- <TableBody>- {Array.from({ length: rows }).map((_, i) => (- <TableRow key={i} className="hover:bg-transparent">- <TableCell>- <Skeleton className="my-1.5 h-4 w-full max-w-40" />- </TableCell>- <TableCell className="hidden sm:table-cell">- <Skeleton className="my-1.5 h-4 w-full max-w-52" />- </TableCell>- <TableCell className="hidden md:table-cell">+ <div className="bg-background overflow-hidden rounded-md border">+ <Table>+ <TableHeader className="bg-muted/40">+ <TableRow className="hover:bg-transparent">+ <TableHead><Skeleton className="my-1.5 h-4 w-24" />- </TableCell>- <TableCell>- <Skeleton className="my-1.5 h-4 w-full max-w-40" />- </TableCell>- <TableCell className="flex justify-end">- <Skeleton className="my-1.5 h-5 w-5" />- </TableCell>+ </TableHead>+ <TableHead className="hidden sm:table-cell">+ <Skeleton className="my-1.5 h-4 w-32" />+ </TableHead>+ <TableHead className="hidden md:table-cell">+ <Skeleton className="my-1.5 h-4 w-16" />+ </TableHead>+ <TableHead>+ <Skeleton className="my-1.5 h-4 w-20" />+ </TableHead>+ <TableHead className="flex items-center justify-end" /></TableRow>- ))}- </TableBody>- </Table>+ </TableHeader>+ <TableBody>+ {Array.from({ length: rows }).map((_, i) => (+ <TableRow key={i} className="hover:bg-transparent">+ <TableCell>+ <Skeleton className="my-1.5 h-4 w-full max-w-40" />+ </TableCell>+ <TableCell className="hidden sm:table-cell">+ <Skeleton className="my-1.5 h-4 w-full max-w-52" />+ </TableCell>+ <TableCell className="hidden md:table-cell">+ <Skeleton className="my-1.5 h-4 w-24" />+ </TableCell>+ <TableCell>+ <Skeleton className="my-1.5 h-4 w-full max-w-40" />+ </TableCell>+ <TableCell className="flex justify-end">+ <Skeleton className="my-1.5 h-5 w-5" />+ </TableCell>+ </TableRow>+ ))}+ </TableBody>+ </Table>+ </div>);}diff --git a/apps/dashboard/src/components/ui/data-table/data-table.tsx b/apps/dashboard/src/components/ui/data-table/data-table.tsxindex 06d616275..715a365b5 100644--- a/apps/dashboard/src/components/ui/data-table/data-table.tsx+++ b/apps/dashboard/src/components/ui/data-table/data-table.tsx@@ -68,7 +68,7 @@ export function DataTable<TData, TValue>({defaultSorting = [],defaultColumnVisibility = {},defaultColumnFilters = [],- defaultPagination = { pageIndex: 0, pageSize: 20 },+ defaultPagination = { pageIndex: 0, pageSize: 10 },autoResetPageIndex = true,columnFilters,setColumnFilters,@@ -105,6 +105,7 @@ export function DataTable<TData, TValue>({const table = useReactTable({data,columns,+ initialState: { pagination: defaultPagination },state: {sorting: sortingState,columnVisibility: columnVisibilityState,@@ -137,83 +138,88 @@ export function DataTable<TData, TValue>({{toolbarComponent? React.createElement(toolbarComponent, { table }): null}- <Table>- <TableHeader>- {table.getHeaderGroups().map((headerGroup) => (- <TableRow key={headerGroup.id}>- {headerGroup.headers.map((header) => {- return (- <TableHead- key={header.id}- colSpan={header.colSpan}- className={header.column.columnDef.meta?.headerClassName}+ <div className="bg-background overflow-hidden rounded-md border">+ <Table>+ <TableHeader className="bg-muted/40">+ {table.getHeaderGroups().map((headerGroup) => (+ <TableRow key={headerGroup.id} className="hover:bg-transparent">+ {headerGroup.headers.map((header) => {+ return (+ <TableHead+ key={header.id}+ colSpan={header.colSpan}+ className={header.column.columnDef.meta?.headerClassName}+ >+ {header.isPlaceholder+ ? null+ : flexRender(+ header.column.columnDef.header,+ header.getContext(),+ )}+ </TableHead>+ );+ })}+ </TableRow>+ ))}+ </TableHeader>+ <TableBody>+ {table.getRowModel().rows?.length ? (+ table.getRowModel().rows.map((row) => (+ <Fragment key={row.id}>+ <TableRow+ data-state={+ (row.getIsSelected() || row.getIsExpanded()) && "selected"+ }+ onClick={(e) => {+ // nested links/buttons own their click+ if ((e.target as HTMLElement).closest("a,button")) return;+ onRowClick?.(row);+ }}+ className="data-[state=selected]:bg-muted/50">- {header.isPlaceholder- ? null- : flexRender(- header.column.columnDef.header,- header.getContext(),+ {row.getVisibleCells().map((cell) => (+ <TableCell+ key={cell.id}+ className={cell.column.columnDef.meta?.cellClassName}+ >+ {flexRender(+ cell.column.columnDef.cell,+ cell.getContext(),)}- </TableHead>- );- })}- </TableRow>- ))}- </TableHeader>- <TableBody>- {table.getRowModel().rows?.length ? (- table.getRowModel().rows.map((row) => (- <Fragment key={row.id}>- <TableRow- data-state={- (row.getIsSelected() || row.getIsExpanded()) && "selected"- }- onClick={(e) => {- // nested links/buttons own their click- if ((e.target as HTMLElement).closest("a,button")) return;- onRowClick?.(row);- }}- className="data-[state=selected]:bg-muted/50"- >- {row.getVisibleCells().map((cell) => (- <TableCell- key={cell.id}- className={cell.column.columnDef.meta?.cellClassName}- >- {flexRender(- cell.column.columnDef.cell,- cell.getContext(),- )}- </TableCell>- ))}- </TableRow>- {row.getIsExpanded() && (- <TableRow className="hover:bg-background">- <TableCell- className="p-0"- colSpan={row.getVisibleCells().length}- >- {rowComponent- ? React.createElement(rowComponent, { row })- : null}- </TableCell>+ </TableCell>+ ))}</TableRow>- )}- </Fragment>- ))- ) : (- <TableRow>- <TableCell colSpan={columns.length} className="h-24 text-center">- No results.- </TableCell>- </TableRow>- )}- </TableBody>- {actionBar ? React.createElement(actionBar, { table }) : null}- </Table>- {paginationComponent- ? React.createElement(paginationComponent, { table })- : null}+ {row.getIsExpanded() && (+ <TableRow className="hover:bg-background">+ <TableCell+ className="p-0"+ colSpan={row.getVisibleCells().length}+ >+ {rowComponent+ ? React.createElement(rowComponent, { row })+ : null}+ </TableCell>+ </TableRow>+ )}+ </Fragment>+ ))+ ) : (+ <TableRow>+ <TableCell+ colSpan={columns.length}+ className="h-24 text-center"+ >+ No results.+ </TableCell>+ </TableRow>+ )}+ </TableBody>+ {actionBar ? React.createElement(actionBar, { table }) : null}+ </Table>+ {paginationComponent+ ? React.createElement(paginationComponent, { table })+ : null}+ </div></div>);}