import { PermissionAction } from '@supabase/shared-types/out/constants' import { partition } from 'lodash' import { ChevronRight, Edit, ExternalLink, Table2, Trash } from 'lucide-react' import Link from 'next/link' import { useState } from 'react' import { useParams } from 'common' import { ButtonTooltip } from 'components/ui/ButtonTooltip' import type { FDW } from 'data/fdw/fdws-query' import { useAsyncCheckPermissions } from 'hooks/misc/useCheckPermissions' import { Badge, Sheet, SheetContent, TableCell, TableRow, Tooltip, TooltipContent, TooltipTrigger, } from 'ui' import { INTEGRATIONS } from '../Landing/Integrations.constants' import DeleteWrapperModal from './DeleteWrapperModal' import { EditWrapperSheet } from './EditWrapperSheet' import { formatWrapperTables } from './Wrappers.utils' interface WrapperRowProps { wrapper: FDW } const WrapperRow = ({ wrapper }: WrapperRowProps) => { const { ref, id } = useParams() const { can: canManageWrappers } = useAsyncCheckPermissions( PermissionAction.TENANT_SQL_ADMIN_WRITE, 'wrappers' ) const [editWrapperShown, setEditWrapperShown] = useState(false) const [isClosingEditWrapper, setIsClosingEditWrapper] = useState(false) const [deleteWrapperShown, setDeleteWrapperShown] = useState(false) const integration = INTEGRATIONS.find((i) => i.id === id) if (!integration || integration.type !== 'wrapper') { return
A wrapper with this ID does not exist
} const serverOptions = Object.fromEntries( wrapper.server_options.map((option) => option.split('=')) ) const [encryptedMetadata, visibleMetadata] = partition( integration?.meta?.server.options.filter((option) => !option.hidden), 'secureEntry' ) const _tables = formatWrapperTables(wrapper, integration?.meta) return ( <>{metadata.label}:
*/} {metadata.label}