Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

Authorized apps in org settings add copy action for App ID (#34321)

Joshen Lim8dcf3262234d
diff --git a/apps/studio/components/interfaces/Organization/OAuthApps/AuthorizedAppRow.tsx b/apps/studio/components/interfaces/Organization/OAuthApps/AuthorizedAppRow.tsx
index 8c74e334e8d..57b21191e7c 100644
--- a/apps/studio/components/interfaces/Organization/OAuthApps/AuthorizedAppRow.tsx
+++ b/apps/studio/components/interfaces/Organization/OAuthApps/AuthorizedAppRow.tsx
@@ -1,9 +1,10 @@
-import dayjs from 'dayjs'
import { Trash } from 'lucide-react'
import Table from 'components/to-be-cleaned/Table'
+import CopyButton from 'components/ui/CopyButton'
import type { AuthorizedApp } from 'data/oauth/authorized-apps-query'
import { Button } from 'ui'
+import { TimestampInfo } from 'ui-patterns'
export interface AuthorizedAppRowProps {
app: AuthorizedApp
@@ -24,11 +25,20 @@ const AuthorizedAppRow = ({ app, onSelectRevoke }: AuthorizedAppRowProps) => {
<Table.td>{app.name}</Table.td>
<Table.td>{app.created_by}</Table.td>
<Table.td>
- <p className="font-mono truncate w-[220px]" title={app.app_id}>
- {app.app_id}
- </p>
+ <div className="flex items-center gap-x-2">
+ <p className="font-mono truncate" title={app.app_id}>
+ {app.app_id}
+ </p>
+ <CopyButton iconOnly type="default" text={app.app_id} className="px-1" />
+ </div>
+ </Table.td>
+ <Table.td>
+ <TimestampInfo
+ utcTimestamp={app.authorized_at ?? ''}
+ labelFormat="DD/MM/YYYY, HH:mm:ss"
+ className="text-sm"
+ />
</Table.td>
- <Table.td>{dayjs(app.authorized_at).format('DD/MM/YYYY, HH:mm:ss')}</Table.td>
<Table.td align="right">
<Button type="default" icon={<Trash />} className="px-1" onClick={() => onSelectRevoke()} />
</Table.td>
diff --git a/apps/studio/components/interfaces/Organization/OAuthApps/OAuthAppRow.tsx b/apps/studio/components/interfaces/Organization/OAuthApps/OAuthAppRow.tsx
index 92d130cd256..5570d88e304 100644
--- a/apps/studio/components/interfaces/Organization/OAuthApps/OAuthAppRow.tsx
+++ b/apps/studio/components/interfaces/Organization/OAuthApps/OAuthAppRow.tsx
@@ -1,13 +1,10 @@
import { PermissionAction } from '@supabase/shared-types/out/constants'
-import dayjs from 'dayjs'
-import { Check, Clipboard, Edit, MoreVertical, Trash } from 'lucide-react'
-import { useState } from 'react'
+import { Edit, MoreVertical, Trash } from 'lucide-react'
import Table from 'components/to-be-cleaned/Table'
+import CopyButton from 'components/ui/CopyButton'
import type { OAuthApp } from 'data/oauth/oauth-apps-query'
import { useCheckPermissions } from 'hooks/misc/useCheckPermissions'
-import { copyToClipboard } from 'lib/helpers'
-import { toast } from 'sonner'
import {
Button,
DropdownMenu,
@@ -19,6 +16,7 @@ import {
TooltipContent,
TooltipTrigger,
} from 'ui'
+import { TimestampInfo } from 'ui-patterns'
export interface OAuthAppRowProps {
app: OAuthApp
@@ -27,8 +25,6 @@ export interface OAuthAppRowProps {
}
const OAuthAppRow = ({ app, onSelectEdit, onSelectDelete }: OAuthAppRowProps) => {
- const [isCopied, setIsCopied] = useState(false)
-
const canUpdateOAuthApps = useCheckPermissions(PermissionAction.UPDATE, 'approved_oauth_apps')
const canDeleteOAuthApps = useCheckPermissions(PermissionAction.DELETE, 'approved_oauth_apps')
@@ -48,26 +44,11 @@ const OAuthAppRow = ({ app, onSelectEdit, onSelectDelete }: OAuthAppRowProps) =>
</p>
</Table.td>
<Table.td>
- <div className="flex items-center">
- <p className="font-mono truncate w-[220px]" title={app.client_id}>
+ <div className="flex items-center gap-x-2">
+ <p className="font-mono truncate" title={app.client_id}>
{app.client_id}
</p>
- <Button
- type="default"
- icon={isCopied ? <Check className="text-brand" strokeWidth={3} /> : <Clipboard />}
- className="ml-2 px-1"
- onClick={() => {
- if (app.client_id) {
- copyToClipboard(app.client_id)
- setIsCopied(true)
- setTimeout(() => {
- setIsCopied(false)
- }, 3000)
- } else {
- toast('Unable to retrieve app client ID')
- }
- }}
- />
+ <CopyButton type="default" iconOnly text={app.client_id ?? ''} className="px-1" />
</div>
</Table.td>
<Table.td>
@@ -75,7 +56,13 @@ const OAuthAppRow = ({ app, onSelectEdit, onSelectDelete }: OAuthAppRowProps) =>
{app.client_secret_alias}...
</span>
</Table.td>
- <Table.td>{dayjs(app.created_at).format('DD/MM/YYYY, HH:mm:ss')}</Table.td>
+ <Table.td>
+ <TimestampInfo
+ utcTimestamp={app.created_at ?? ''}
+ labelFormat="DD/MM/YYYY, HH:mm:ss"
+ className="text-sm"
+ />
+ </Table.td>
<Table.td align="right">
<DropdownMenu>
<DropdownMenuTrigger asChild>