mirror of
https://github.com/ruvnet/RuVector.git
synced 2026-05-24 13:54:31 +00:00
Major additions: - Complete Next.js studio application with 1600+ components - Docker support (Dockerfile.combined, docker-compose.yml) - GCP deployment documentation and benchmarks - SQL benchmark scripts for performance testing - Sentry integration for monitoring - Comprehensive test suite and mocks Studio features: - Dashboard and admin interfaces - Data visualization components - Authentication and user management - API integration with RuVector backend - Static data and public assets 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
95 lines
2.9 KiB
TypeScript
95 lines
2.9 KiB
TypeScript
import { PermissionAction } from '@supabase/shared-types/out/constants'
|
|
import { toast } from 'sonner'
|
|
|
|
import { useParams } from 'common'
|
|
import { ButtonTooltip } from 'components/ui/ButtonTooltip'
|
|
import NoPermission from 'components/ui/NoPermission'
|
|
import { GenericSkeletonLoader } from 'components/ui/ShimmeringLoader'
|
|
import { useHooksEnableMutation } from 'data/database/hooks-enable-mutation'
|
|
import { useSchemasQuery } from 'data/database/schemas-query'
|
|
import { useAsyncCheckPermissions } from 'hooks/misc/useCheckPermissions'
|
|
import { useSelectedProjectQuery } from 'hooks/misc/useSelectedProject'
|
|
import { Admonition } from 'ui-patterns'
|
|
import { IntegrationOverviewTab } from '../Integration/IntegrationOverviewTab'
|
|
|
|
export const WebhooksOverviewTab = () => {
|
|
const { ref: projectRef } = useParams()
|
|
const { data: project } = useSelectedProjectQuery()
|
|
|
|
const {
|
|
data: schemas,
|
|
isSuccess: isSchemasLoaded,
|
|
refetch,
|
|
} = useSchemasQuery({
|
|
projectRef: project?.ref,
|
|
connectionString: project?.connectionString,
|
|
})
|
|
|
|
const isHooksEnabled = schemas?.some((schema) => schema.name === 'supabase_functions')
|
|
const { can: canReadWebhooks, isLoading: isLoadingPermissions } = useAsyncCheckPermissions(
|
|
PermissionAction.TENANT_SQL_ADMIN_READ,
|
|
'triggers'
|
|
)
|
|
|
|
const { mutate: enableHooks, isPending: isEnablingHooks } = useHooksEnableMutation({
|
|
onSuccess: async () => {
|
|
await refetch()
|
|
toast.success('Successfully enabled webhooks')
|
|
},
|
|
})
|
|
|
|
const enableHooksForProject = async () => {
|
|
if (!projectRef) return console.error('Project ref is required')
|
|
enableHooks({ ref: projectRef })
|
|
}
|
|
|
|
if (!isSchemasLoaded || isLoadingPermissions) {
|
|
return (
|
|
<div className="p-10">
|
|
<GenericSkeletonLoader />
|
|
</div>
|
|
)
|
|
}
|
|
|
|
if (!canReadWebhooks) {
|
|
return (
|
|
<div className="p-10">
|
|
<NoPermission isFullPage resourceText="view database webhooks" />
|
|
</div>
|
|
)
|
|
}
|
|
|
|
return (
|
|
<IntegrationOverviewTab
|
|
actions={
|
|
isSchemasLoaded && isHooksEnabled ? null : (
|
|
<Admonition
|
|
showIcon={false}
|
|
type="default"
|
|
title="Enable database webhooks on your project"
|
|
>
|
|
<p>
|
|
Database Webhooks can be used to trigger serverless functions or send requests to an
|
|
HTTP endpoint
|
|
</p>
|
|
<ButtonTooltip
|
|
className="w-fit"
|
|
onClick={() => enableHooksForProject()}
|
|
disabled={isEnablingHooks}
|
|
tooltip={{
|
|
content: {
|
|
side: 'bottom',
|
|
text: !canReadWebhooks
|
|
? 'You need additional permissions to enable webhooks'
|
|
: undefined,
|
|
},
|
|
}}
|
|
>
|
|
Enable webhooks
|
|
</ButtonTooltip>
|
|
</Admonition>
|
|
)
|
|
}
|
|
/>
|
|
)
|
|
}
|