The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
feat(studio): show created at column in JWT signing keys table (#51845)
Drew McLellanaf98094c8c7e
diff --git a/apps/studio/components/interfaces/JwtSecrets/jwt-secret-keys-table/copyable-key.tsx b/apps/studio/components/interfaces/JwtSecrets/jwt-secret-keys-table/copyable-key.tsxnew file mode 100644index 00000000000..f91e70f44c5--- /dev/null+++ b/apps/studio/components/interfaces/JwtSecrets/jwt-secret-keys-table/copyable-key.tsx@@ -0,0 +1,47 @@+import { CheckIcon, CopyIcon } from 'lucide-react'+import { useEffect, useState } from 'react'+import { copyToClipboard, Tooltip, TooltipContent, TooltipTrigger } from 'ui'++export const CopyableKey = ({ keyId }: { keyId: string }) => {+ const [isCopied, setIsCopied] = useState(false)++ useEffect(() => {+ if (!isCopied) return+ const timer = setTimeout(() => setIsCopied(false), 2000)+ return () => clearTimeout(timer)+ }, [isCopied])++ const handleCopy = () => {+ copyToClipboard(keyId, () => setIsCopied(true))+ }++ return (+ <>+ <Tooltip>+ <TooltipTrigger asChild>+ <button+ type="button"+ tabIndex={0}+ onClick={handleCopy}+ className="flex w-fit items-center gap-x-1 cursor-pointer group font-mono text-xs text-foreground-lighter mt-1"+ >+ {keyId}+ {isCopied ? (+ <CheckIcon size={12} strokeWidth={1.25} className="text-primary" />+ ) : (+ <CopyIcon+ size={12}+ strokeWidth={1.25}+ className="opacity-0 group-hover:opacity-100 transition-opacity"+ />+ )}+ </button>+ </TooltipTrigger>+ <TooltipContent>Copy key</TooltipContent>+ </Tooltip>+ <span role="status" aria-live="polite" className="sr-only">+ {isCopied ? 'Key copied to clipboard' : ''}+ </span>+ </>+ )+}diff --git a/apps/studio/components/interfaces/JwtSecrets/jwt-secret-keys-table/index.tsx b/apps/studio/components/interfaces/JwtSecrets/jwt-secret-keys-table/index.tsxindex 88eaa62f321..5ab9d88d428 100644--- a/apps/studio/components/interfaces/JwtSecrets/jwt-secret-keys-table/index.tsx+++ b/apps/studio/components/interfaces/JwtSecrets/jwt-secret-keys-table/index.tsx@@ -66,9 +66,9 @@ const JWTSecretKeysTableHeader = ({return (<TableHeader><TableRow>- <TableHead className="w-[80px]">Status</TableHead>- <TableHead className="w-[315px]">Key ID</TableHead>+ <TableHead className="w-[315px]">Key</TableHead><TableHead className="w-[200px]">Type</TableHead>+ <TableHead className="text-right w-[160px] hidden xl:table-cell">Created at</TableHead>{IS_PLATFORM && showApiKeysLastUsed && (<TableHead className="text-right w-[160px]">Last used</TableHead>)}diff --git a/apps/studio/components/interfaces/JwtSecrets/jwt-secret-keys-table/signing-key-row.tsx b/apps/studio/components/interfaces/JwtSecrets/jwt-secret-keys-table/signing-key-row.tsxindex d6723d1e19b..6cff8a78871 100644--- a/apps/studio/components/interfaces/JwtSecrets/jwt-secret-keys-table/signing-key-row.tsx+++ b/apps/studio/components/interfaces/JwtSecrets/jwt-secret-keys-table/signing-key-row.tsx@@ -25,6 +25,7 @@ import { TimestampInfo } from 'ui-patterns/TimestampInfo'import { AlgorithmHoverCard } from '../algorithm-hover-card'import { statusLabels } from '../jwt.constants'+import { CopyableKey } from './copyable-key'import { ButtonTooltip } from '@/components/ui/ButtonTooltip'import { DropdownMenuItemTooltip } from '@/components/ui/DropdownMenuItemTooltip'import { JWTSigningKey } from '@/data/jwt-signing-keys/jwt-signing-keys-query'@@ -125,16 +126,25 @@ export const SigningKeyRow = ({signingKey.status !== 'in_use' ? 'border-b border-dashed border-border' : 'border-b')}>- <TableCell className={cn(signingKey.status !== 'in_use' && 'text-foreground-lighter')}>- {statusLabels[signingKey.status]}+ <TableCell className="whitespace-nowrap">+ <p className={cn(signingKey.status !== 'in_use' && 'text-foreground-lighter')}>+ {statusLabels[signingKey.status]}+ </p>+ <CopyableKey keyId={signingKey.id} /></TableCell>- <TableCell className="font-mono whitespace-nowrap">{signingKey.id}</TableCell>-<TableCell><AlgorithmHoverCard algorithm={signingKey.algorithm} /></TableCell>+ <TableCell className="text-right text-sm text-foreground-light whitespace-nowrap hidden xl:table-cell">+ <TimestampInfo+ className="text-sm"+ utcTimestamp={signingKey.created_at}+ label={dayjs(signingKey.created_at).fromNow()}+ />+ </TableCell>+{isLastUsedVisible && (<LastUsedCelllastUsedAt={lastUsedAt}