mirror of
https://github.com/supabase/supabase.git
synced 2026-05-09 18:30:12 -04:00
4a0bb36ca8
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Co-authored-by: Ivan Vasilov <vasilov.ivan@gmail.com>
47 lines
1.4 KiB
TypeScript
47 lines
1.4 KiB
TypeScript
import { PermissionAction } from '@supabase/shared-types/out/constants'
|
|
import { useParams } from 'common'
|
|
import { PropsWithChildren } from 'react'
|
|
|
|
import DatabaseLayout from './DatabaseLayout'
|
|
import { PageLayout } from '@/components/layouts/PageLayout/PageLayout'
|
|
import NoPermission from '@/components/ui/NoPermission'
|
|
import { useAsyncCheckPermissions } from '@/hooks/misc/useCheckPermissions'
|
|
|
|
type DatabaseTriggersLayoutProps = PropsWithChildren
|
|
|
|
export const DatabaseTriggersLayout = ({ children }: DatabaseTriggersLayoutProps) => {
|
|
const { ref } = useParams()
|
|
const { can: canReadTriggers, isSuccess: isPermissionsLoaded } = useAsyncCheckPermissions(
|
|
PermissionAction.TENANT_SQL_ADMIN_READ,
|
|
'triggers'
|
|
)
|
|
|
|
const navigationItems = [
|
|
{
|
|
label: 'Data',
|
|
href: `/project/${ref}/database/triggers/data`,
|
|
},
|
|
{
|
|
label: 'Event',
|
|
href: `/project/${ref}/database/triggers/event`,
|
|
},
|
|
]
|
|
|
|
return (
|
|
<DatabaseLayout title="Triggers">
|
|
{isPermissionsLoaded && !canReadTriggers ? (
|
|
<NoPermission isFullPage resourceText="view database triggers" />
|
|
) : (
|
|
<PageLayout
|
|
title="Database Triggers"
|
|
subtitle="Execute actions automatically when database events occur"
|
|
navigationItems={navigationItems}
|
|
size="large"
|
|
>
|
|
{children}
|
|
</PageLayout>
|
|
)}
|
|
</DatabaseLayout>
|
|
)
|
|
}
|