The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
Empty state
Joshen Limc55882308293
diff --git a/studio/components/interfaces/Organization/AuditLogs/AuditLogs.tsx b/studio/components/interfaces/Organization/AuditLogs/AuditLogs.tsxindex 0e0b1bfdd3f..9883b1524ad 100644--- a/studio/components/interfaces/Organization/AuditLogs/AuditLogs.tsx+++ b/studio/components/interfaces/Organization/AuditLogs/AuditLogs.tsx@@ -13,8 +13,9 @@ import { useOrganizationDetailQuery } from 'data/organizations/organization-detaimport { useOrganizationRolesQuery } from 'data/organizations/organization-roles-query'import { useOrganizationsQuery } from 'data/organizations/organizations-query'import { useProjectsQuery } from 'data/projects/projects-query'-import { Button, IconInfo, IconSearch, IconUser, Input } from 'ui'+import { Button, IconSearch, IconUser, Input } from 'ui'import LogDetailsPanel from './LogDetailsPanel'+import AlertError from 'components/ui/AlertError'// [Joshen considerations]// - Maybe fix the height of the table to the remaining height of the viewport, so that the search input is always visible@@ -56,97 +57,113 @@ const AuditLogs = () => {</div>)}+ {isError && <AlertError subject="Unable to retrieve audit logs" />}+{isSuccess && (<>- <div className="flex items-center">- <Input- size="tiny"- className="w-80"- icon={<IconSearch size={14} strokeWidth={1.5} />}- placeholder="Search audit logs"- />- </div>- <Table- head={[- <Table.th key="user">User</Table.th>,- <Table.th key="action">Action</Table.th>,- <Table.th key="target">Target</Table.th>,- <Table.th key="date">Date</Table.th>,- <Table.th key="actions"></Table.th>,- ]}- body={- sortedLogs?.map((log) => {- const user = members.find((member) => member.gotrue_id === log.actor.id)- const role = roles.find((role) => user?.role_ids?.[0] === role.id)- const project = projects?.find(- (project) => project.ref === log.permission_group.project_ref- )- const organization = organizations?.find(- (org) => org.slug === log.permission_group.org_slug- )-- const hasStatusCode = log.action.metadata[0]?.status !== undefined- const userIcon =- user === undefined ? (- <div className="flex h-[40px] w-[40px] flex items-center justify-center border-2 rounded-full border-scale-700">- <p>?</p>- </div>- ) : user?.invited_id || user?.username === user?.primary_email ? (- <div className="flex h-[40px] w-[40px] flex items-center justify-center border-2 rounded-full border-scale-700">- <IconUser size={18} strokeWidth={2} />- </div>- ) : (- <Image- alt={user?.username}- src={`https://github.com/${user?.username ?? ''}.png?size=80`}- width="40"- height="40"- className="border rounded-full"- />- )+ {logs.length === 0 ? (+ <div className="bg-scale-100 dark:bg-scale-300 border rounded p-4 flex items-center justify-between">+ <p className="prose text-sm">+ Your organization does not have any audit logs available yet+ </p>+ </div>+ ) : (+ <>+ <div className="flex items-center">+ <Input+ size="tiny"+ className="w-80"+ icon={<IconSearch size={14} strokeWidth={1.5} />}+ placeholder="Search audit logs"+ />+ </div>+ <Table+ head={[+ <Table.th key="user">User</Table.th>,+ <Table.th key="action">Action</Table.th>,+ <Table.th key="target">Target</Table.th>,+ <Table.th key="date">Date</Table.th>,+ <Table.th key="actions"></Table.th>,+ ]}+ body={+ sortedLogs?.map((log) => {+ const user = members.find((member) => member.gotrue_id === log.actor.id)+ const role = roles.find((role) => user?.role_ids?.[0] === role.id)+ const project = projects?.find(+ (project) => project.ref === log.permission_group.project_ref+ )+ const organization = organizations?.find(+ (org) => org.slug === log.permission_group.org_slug+ )- return (- <Table.tr- key={log.timestamp}- onClick={() => setSelectedLog(log)}- className="cursor-pointer hover:!bg-scale-100 transition duration-100"- >- <Table.td>- <div className="flex items-center space-x-4">- {userIcon}- <div>- <p className="text-scale-1100">{user?.username ?? log.actor.id}</p>- {role && <p className="mt-0.5 text-xs text-scale-1000">{role?.name}</p>}+ const hasStatusCode = log.action.metadata[0]?.status !== undefined+ const userIcon =+ user === undefined ? (+ <div className="flex h-[40px] w-[40px] flex items-center justify-center border-2 rounded-full border-scale-700">+ <p>?</p>+ </div>+ ) : user?.invited_id || user?.username === user?.primary_email ? (+ <div className="flex h-[40px] w-[40px] flex items-center justify-center border-2 rounded-full border-scale-700">+ <IconUser size={18} strokeWidth={2} /></div>- </div>- </Table.td>- <Table.td>- <div className="flex items-center space-x-2">- {hasStatusCode && (- <p className="bg-scale-400 rounded px-1 flex items-center justify-center text-xs font-mono border">- {log.action.metadata[0].status}+ ) : (+ <Image+ alt={user?.username}+ src={`https://github.com/${user?.username ?? ''}.png?size=80`}+ width="40"+ height="40"+ className="border rounded-full"+ />+ )++ return (+ <Table.tr+ key={log.timestamp}+ onClick={() => setSelectedLog(log)}+ className="cursor-pointer hover:!bg-scale-100 transition duration-100"+ >+ <Table.td>+ <div className="flex items-center space-x-4">+ {userIcon}+ <div>+ <p className="text-scale-1100">{user?.username ?? log.actor.id}</p>+ {role && (+ <p className="mt-0.5 text-xs text-scale-1000">{role?.name}</p>+ )}+ </div>+ </div>+ </Table.td>+ <Table.td>+ <div className="flex items-center space-x-2">+ {hasStatusCode && (+ <p className="bg-scale-400 rounded px-1 flex items-center justify-center text-xs font-mono border">+ {log.action.metadata[0].status}+ </p>+ )}+ <p className="max-w-[200px] truncate">{log.action.name}</p>+ </div>+ </Table.td>+ <Table.td>+ <p className="text-scale-1100">+ {project?.name ?? organization?.name ?? 'Entity no longer exists'}+ </p>+ <p className="text-scale-1000 text-xs mt-0.5">+ {log.permission_group.org_slug ?? log.permission_group.project_ref}</p>- )}- <p className="max-w-[200px] truncate">{log.action.name}</p>- </div>- </Table.td>- <Table.td>- <p className="text-scale-1100">- {project?.name ?? organization?.name ?? 'Entity no longer exists'}- </p>- <p className="text-scale-1000 text-xs mt-0.5">- {log.permission_group.org_slug ?? log.permission_group.project_ref}- </p>- </Table.td>- <Table.td>{dayjs(log.timestamp).format('DD MMM YYYY, HH:mm:ss')}</Table.td>- <Table.td align="right">- <Button type="default">View details</Button>- </Table.td>- </Table.tr>- )- }) ?? []- }- />+ </Table.td>+ <Table.td>+ {dayjs(log.timestamp).format('DD MMM YYYY, HH:mm:ss')}+ </Table.td>+ <Table.td align="right">+ <Button type="default">View details</Button>+ </Table.td>+ </Table.tr>+ )+ }) ?? []+ }+ />+ </>+ )}</>)}</div>