mirror of
https://github.com/ruvnet/RuVector.git
synced 2026-05-25 06:36:37 +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>
72 lines
2.1 KiB
TypeScript
72 lines
2.1 KiB
TypeScript
import { MutableRefObject } from 'react'
|
|
import { toast } from 'sonner'
|
|
import { Modal } from 'ui'
|
|
|
|
import { useFDWDeleteMutation } from 'data/fdw/fdw-delete-mutation'
|
|
import type { FDW } from 'data/fdw/fdws-query'
|
|
import { useSelectedProjectQuery } from 'hooks/misc/useSelectedProject'
|
|
import { getWrapperMetaForWrapper } from './Wrappers.utils'
|
|
|
|
interface DeleteWrapperModalProps {
|
|
selectedWrapper?: FDW
|
|
onClose: () => void
|
|
deletingWrapperIdRef?: MutableRefObject<string | null>
|
|
}
|
|
|
|
const DeleteWrapperModal = ({
|
|
selectedWrapper,
|
|
onClose,
|
|
deletingWrapperIdRef,
|
|
}: DeleteWrapperModalProps) => {
|
|
const { data: project } = useSelectedProjectQuery()
|
|
const { mutate: deleteFDW, isPending: isDeleting } = useFDWDeleteMutation({
|
|
onSuccess: () => {
|
|
toast.success(`Successfully disabled ${selectedWrapper?.name} foreign data wrapper`)
|
|
onClose()
|
|
},
|
|
onError: () => {
|
|
if (deletingWrapperIdRef) {
|
|
deletingWrapperIdRef.current = null
|
|
}
|
|
},
|
|
})
|
|
const wrapperMeta = getWrapperMetaForWrapper(selectedWrapper)
|
|
|
|
const onConfirmDelete = async () => {
|
|
if (!project?.ref) return console.error('Project ref is required')
|
|
if (!selectedWrapper) return console.error('Wrapper is required')
|
|
if (!wrapperMeta) return console.error('Wrapper meta is required')
|
|
|
|
if (deletingWrapperIdRef) {
|
|
deletingWrapperIdRef.current = selectedWrapper.id.toString()
|
|
}
|
|
|
|
deleteFDW({
|
|
projectRef: project?.ref,
|
|
connectionString: project?.connectionString,
|
|
wrapper: selectedWrapper,
|
|
wrapperMeta: wrapperMeta,
|
|
})
|
|
}
|
|
|
|
return (
|
|
<Modal
|
|
size="medium"
|
|
alignFooter="right"
|
|
loading={isDeleting}
|
|
visible={selectedWrapper !== undefined}
|
|
onCancel={() => onClose()}
|
|
onConfirm={() => onConfirmDelete()}
|
|
header={`Confirm to disable ${selectedWrapper?.name}`}
|
|
>
|
|
<Modal.Content>
|
|
<p className="text-sm">
|
|
Are you sure you want to disable {selectedWrapper?.name}? This will also remove all tables
|
|
created with this wrapper.
|
|
</p>
|
|
</Modal.Content>
|
|
</Modal>
|
|
)
|
|
}
|
|
|
|
export default DeleteWrapperModal
|