Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

Add flag to disable wrappers UI (#39150)

Joshen Lim579332fda3f6
diff --git a/apps/studio/components/interfaces/Integrations/Landing/AvailableIntegrations.tsx b/apps/studio/components/interfaces/Integrations/Landing/AvailableIntegrations.tsx
index 2d740de982b..864c3338fa1 100644
--- a/apps/studio/components/interfaces/Integrations/Landing/AvailableIntegrations.tsx
+++ b/apps/studio/components/interfaces/Integrations/Landing/AvailableIntegrations.tsx
@@ -18,9 +18,7 @@ const CATEGORIES = [
] as const
export const AvailableIntegrations = () => {
- const { integrationsShowStripeWrapper } = useIsFeatureEnabled([
- 'integrations:show_stripe_wrapper',
- ])
+ const { integrationsWrappers } = useIsFeatureEnabled(['integrations:wrappers'])
const [selectedCategory, setSelectedCategory] = useQueryState(
'category',
@@ -43,9 +41,9 @@ export const AvailableIntegrations = () => {
const installedIds = installedIntegrations.map((i) => i.id)
// available integrations for install
- const availableIntegrations = integrationsShowStripeWrapper
+ const availableIntegrations = integrationsWrappers
? allIntegrations
- : allIntegrations.filter((x) => x.id !== 'stripe_wrapper')
+ : allIntegrations.filter((x) => !x.id.endsWith('_wrapper'))
const integrationsByCategory =
selectedCategory === 'all'
? availableIntegrations
diff --git a/apps/studio/components/interfaces/Integrations/Landing/useInstalledIntegrations.tsx b/apps/studio/components/interfaces/Integrations/Landing/useInstalledIntegrations.tsx
index 9df420f1b13..0834121c2ea 100644
--- a/apps/studio/components/interfaces/Integrations/Landing/useInstalledIntegrations.tsx
+++ b/apps/studio/components/interfaces/Integrations/Landing/useInstalledIntegrations.tsx
@@ -3,6 +3,7 @@ import { useMemo } from 'react'
import { useDatabaseExtensionsQuery } from 'data/database-extensions/database-extensions-query'
import { useSchemasQuery } from 'data/database/schemas-query'
import { useFDWsQuery } from 'data/fdw/fdws-query'
+import { useIsFeatureEnabled } from 'hooks/misc/useIsFeatureEnabled'
import { useSelectedProjectQuery } from 'hooks/misc/useSelectedProject'
import { EMPTY_ARR } from 'lib/void'
import { wrapperMetaComparator } from '../Wrappers/Wrappers.utils'
@@ -10,6 +11,15 @@ import { INTEGRATIONS } from './Integrations.constants'
export const useInstalledIntegrations = () => {
const { data: project } = useSelectedProjectQuery()
+ const { integrationsWrappers } = useIsFeatureEnabled(['integrations:wrappers'])
+
+ const allIntegrations = useMemo(() => {
+ if (integrationsWrappers) {
+ return INTEGRATIONS
+ } else {
+ return INTEGRATIONS.filter((integration) => !integration.id.endsWith('_wrapper'))
+ }
+ }, [integrationsWrappers])
const {
data,
@@ -47,28 +57,30 @@ export const useInstalledIntegrations = () => {
const wrappers = useMemo(() => data ?? EMPTY_ARR, [data])
const installedIntegrations = useMemo(() => {
- return INTEGRATIONS.filter((i) => {
- // special handling for supabase webhooks
- if (i.id === 'webhooks') {
- return isHooksEnabled
- }
- if (i.type === 'wrapper') {
- return wrappers.find((w) => wrapperMetaComparator(i.meta, w))
- }
- if (i.type === 'postgres_extension') {
- return i.requiredExtensions.every((extName) => {
- const foundExtension = (extensions ?? []).find((ext) => ext.name === extName)
- return !!foundExtension?.installed_version
- })
- }
- return false
- }).sort((a, b) => a.name.localeCompare(b.name))
+ return allIntegrations
+ .filter((i) => {
+ // special handling for supabase webhooks
+ if (i.id === 'webhooks') {
+ return isHooksEnabled
+ }
+ if (i.type === 'wrapper') {
+ return wrappers.find((w) => wrapperMetaComparator(i.meta, w))
+ }
+ if (i.type === 'postgres_extension') {
+ return i.requiredExtensions.every((extName) => {
+ const foundExtension = (extensions ?? []).find((ext) => ext.name === extName)
+ return !!foundExtension?.installed_version
+ })
+ }
+ return false
+ })
+ .sort((a, b) => a.name.localeCompare(b.name))
}, [wrappers, extensions, isHooksEnabled])
// available integrations are all integrations that can be installed. If an integration can't be installed (needed
// extensions are not available on this DB image), the UI will provide a tooltip explaining why.
const availableIntegrations = useMemo(
- () => INTEGRATIONS.sort((a, b) => a.name.localeCompare(b.name)),
+ () => allIntegrations.sort((a, b) => a.name.localeCompare(b.name)),
[]
)
diff --git a/apps/studio/components/layouts/DatabaseLayout/Database.Commands.tsx b/apps/studio/components/layouts/DatabaseLayout/Database.Commands.tsx
index 3abd34af48c..ddfb6dd7f72 100644
--- a/apps/studio/components/layouts/DatabaseLayout/Database.Commands.tsx
+++ b/apps/studio/components/layouts/DatabaseLayout/Database.Commands.tsx
@@ -12,9 +12,10 @@ export function useDatabaseGotoCommands(options?: CommandOptions) {
let { ref } = useParams()
ref ||= '_'
- const { databaseReplication, databaseRoles } = useIsFeatureEnabled([
+ const { databaseReplication, databaseRoles, integrationsWrappers } = useIsFeatureEnabled([
'database:replication',
'database:roles',
+ 'integrations:wrappers',
])
useRegisterCommands(
@@ -102,13 +103,17 @@ export function useDatabaseGotoCommands(options?: CommandOptions) {
route: `/project/${ref}/database/backups/scheduled`,
defaultHidden: true,
},
- {
- id: 'nav-database-wrappers',
- name: 'Wrappers',
- value: 'Database: Wrappers',
- route: `/project/${ref}/integrations/wrappers`,
- defaultHidden: true,
- },
+ ...(integrationsWrappers
+ ? [
+ {
+ id: 'nav-database-wrappers',
+ name: 'Wrappers',
+ value: 'Database: Wrappers',
+ route: `/project/${ref}/integrations?category=wrappers`,
+ defaultHidden: true,
+ } as IRouteCommand,
+ ]
+ : []),
{
id: 'nav-database-migrations',
name: 'Migrations',
diff --git a/apps/studio/components/layouts/DatabaseLayout/DatabaseLayout.tsx b/apps/studio/components/layouts/DatabaseLayout/DatabaseLayout.tsx
index 4919aac04a7..59f74122a4f 100644
--- a/apps/studio/components/layouts/DatabaseLayout/DatabaseLayout.tsx
+++ b/apps/studio/components/layouts/DatabaseLayout/DatabaseLayout.tsx
@@ -33,10 +33,11 @@ const DatabaseProductMenu = () => {
const columnLevelPrivileges = useIsColumnLevelPrivilegesEnabled()
const enablePgReplicate = useFlag('enablePgReplicate')
- const { databaseReplication: showPgReplicate, databaseRoles: showRoles } = useIsFeatureEnabled([
- 'database:replication',
- 'database:roles',
- ])
+ const {
+ databaseReplication: showPgReplicate,
+ databaseRoles: showRoles,
+ integrationsWrappers: showWrappers,
+ } = useIsFeatureEnabled(['database:replication', 'database:roles', 'integrations:wrappers'])
return (
<>
@@ -49,6 +50,7 @@ const DatabaseProductMenu = () => {
enablePgReplicate,
showPgReplicate,
showRoles,
+ showWrappers,
})}
/>
</>
diff --git a/apps/studio/components/layouts/DatabaseLayout/DatabaseMenu.utils.tsx b/apps/studio/components/layouts/DatabaseLayout/DatabaseMenu.utils.tsx
index 8226871f54a..d551edcc0bd 100644
--- a/apps/studio/components/layouts/DatabaseLayout/DatabaseMenu.utils.tsx
+++ b/apps/studio/components/layouts/DatabaseLayout/DatabaseMenu.utils.tsx
@@ -13,6 +13,7 @@ export const generateDatabaseMenu = (
enablePgReplicate: boolean
showPgReplicate: boolean
showRoles: boolean
+ showWrappers: boolean
}
): ProductMenuGroup[] => {
const ref = project?.ref ?? 'default'
@@ -23,6 +24,7 @@ export const generateDatabaseMenu = (
enablePgReplicate,
showPgReplicate,
showRoles,
+ showWrappers,
} = flags || {}
return [
@@ -134,13 +136,17 @@ export const generateDatabaseMenu = (
url: `/project/${ref}/database/migrations`,
items: [],
},
- {
- name: 'Wrappers',
- key: 'wrappers',
- url: `/project/${ref}/integrations?category=wrapper`,
- rightIcon: <ArrowUpRight strokeWidth={1} className="h-4 w-4" />,
- items: [],
- },
+ ...(showWrappers
+ ? [
+ {
+ name: 'Wrappers',
+ key: 'wrappers',
+ url: `/project/${ref}/integrations?category=wrapper`,
+ rightIcon: <ArrowUpRight strokeWidth={1} className="h-4 w-4" />,
+ items: [],
+ },
+ ]
+ : []),
...(!!pgNetExtensionExists
? [
{
diff --git a/apps/studio/components/layouts/Integrations/layout.tsx b/apps/studio/components/layouts/Integrations/layout.tsx
index bef2d1ce074..87732d1a80d 100644
--- a/apps/studio/components/layouts/Integrations/layout.tsx
+++ b/apps/studio/components/layouts/Integrations/layout.tsx
@@ -1,13 +1,13 @@
import { useRouter } from 'next/router'
import { PropsWithChildren } from 'react'
-import { useFlag } from 'common'
import { useInstalledIntegrations } from 'components/interfaces/Integrations/Landing/useInstalledIntegrations'
import ProjectLayout from 'components/layouts/ProjectLayout/ProjectLayout'
import AlertError from 'components/ui/AlertError'
import { ProductMenu } from 'components/ui/ProductMenu'
import { ProductMenuGroup } from 'components/ui/ProductMenu/ProductMenu.types'
import ProductMenuItem from 'components/ui/ProductMenu/ProductMenuItem'
+import { useIsFeatureEnabled } from 'hooks/misc/useIsFeatureEnabled'
import { useSelectedProjectQuery } from 'hooks/misc/useSelectedProject'
import { withAuth } from 'hooks/misc/withAuth'
import { Menu, Separator } from 'ui'
@@ -20,6 +20,7 @@ import { GenericSkeletonLoader } from 'ui-patterns'
const IntegrationsLayout = ({ children }: PropsWithChildren) => {
const router = useRouter()
const { data: project } = useSelectedProjectQuery()
+ const { integrationsWrappers: showWrappers } = useIsFeatureEnabled(['integrations:wrappers'])
const segments = router.asPath.split('/')
// construct the page url to be used to determine the active state for the sidebar
@@ -65,7 +66,7 @@ const IntegrationsLayout = ({ children }: PropsWithChildren) => {
: 'integrations'
: page
}
- menu={generateIntegrationsMenu({ projectRef: project?.ref })}
+ menu={generateIntegrationsMenu({ projectRef: project?.ref, flags: { showWrappers } })}
/>
<Separator />
<div className="px-4 py-6 md:px-6">
@@ -110,7 +111,15 @@ const IntegrationsLayout = ({ children }: PropsWithChildren) => {
// Wrap component with authentication HOC before exporting
export default withAuth(IntegrationsLayout)
-const generateIntegrationsMenu = ({ projectRef }: { projectRef?: string }): ProductMenuGroup[] => {
+const generateIntegrationsMenu = ({
+ projectRef,
+ flags,
+}: {
+ projectRef?: string
+ flags?: { showWrappers: boolean }
+}): ProductMenuGroup[] => {
+ const { showWrappers } = flags ?? {}
+
return [
{
title: 'Explore',
@@ -122,13 +131,17 @@ const generateIntegrationsMenu = ({ projectRef }: { projectRef?: string }): Prod
pages: ['integrations'],
items: [],
},
- {
- name: 'Wrappers',
- key: 'integrations-wrapper',
- url: `/project/${projectRef}/integrations?category=wrapper`,
- pages: ['integrations?category=wrapper'],
- items: [],
- },
+ ...(showWrappers
+ ? [
+ {
+ name: 'Wrappers',
+ key: 'integrations-wrapper',
+ url: `/project/${projectRef}/integrations?category=wrapper`,
+ pages: ['integrations?category=wrapper'],
+ items: [],
+ },
+ ]
+ : []),
{
name: 'Postgres Modules',
key: 'integrations-postgres_extension',
diff --git a/apps/studio/components/layouts/IntegrationsLayout/Integrations.Commands.tsx b/apps/studio/components/layouts/IntegrationsLayout/Integrations.Commands.tsx
index 510407e9c72..6a775092ea8 100644
--- a/apps/studio/components/layouts/IntegrationsLayout/Integrations.Commands.tsx
+++ b/apps/studio/components/layouts/IntegrationsLayout/Integrations.Commands.tsx
@@ -13,13 +13,11 @@ export function useIntegrationsGotoCommands(options?: CommandOptions) {
let { ref } = useParams()
ref ||= '_'
- const { integrationsShowStripeWrapper } = useIsFeatureEnabled([
- 'integrations:show_stripe_wrapper',
- ])
+ const { integrationsWrappers } = useIsFeatureEnabled(['integrations:wrappers'])
- const allIntegrations = integrationsShowStripeWrapper
+ const allIntegrations = integrationsWrappers
? INTEGRATIONS
- : INTEGRATIONS.filter((x) => x.id !== 'stripe_wrapper')
+ : INTEGRATIONS.filter((x) => !x.id.endsWith('_wrapper'))
const getName = (integration: IntegrationDefinition) => {
switch (integration.id) {
diff --git a/apps/studio/pages/project/[ref]/integrations/[id]/[pageId]/index.tsx b/apps/studio/pages/project/[ref]/integrations/[id]/[pageId]/index.tsx
index b0eb70e5efe..1b7ced2f8ee 100644
--- a/apps/studio/pages/project/[ref]/integrations/[id]/[pageId]/index.tsx
+++ b/apps/studio/pages/project/[ref]/integrations/[id]/[pageId]/index.tsx
@@ -3,9 +3,11 @@ import { INTEGRATIONS } from 'components/interfaces/Integrations/Landing/Integra
import { useInstalledIntegrations } from 'components/interfaces/Integrations/Landing/useInstalledIntegrations'
import DefaultLayout from 'components/layouts/DefaultLayout'
import IntegrationsLayout from 'components/layouts/Integrations/layout'
-import { PageLayout, NavigationItem } from 'components/layouts/PageLayout/PageLayout'
+import { NavigationItem, PageLayout } from 'components/layouts/PageLayout/PageLayout'
import { ScaffoldContainer, ScaffoldSection } from 'components/layouts/Scaffold'
import { GenericSkeletonLoader } from 'components/ui/ShimmeringLoader'
+import { UnknownInterface } from 'components/ui/UnknownInterface'
+import { useIsFeatureEnabled } from 'hooks/misc/useIsFeatureEnabled'
import { useRouter } from 'next/compat/router'
import { useEffect, useMemo } from 'react'
import { NextPageWithLayout } from 'types'
@@ -14,6 +16,7 @@ import { Admonition } from 'ui-patterns'
const IntegrationPage: NextPageWithLayout = () => {
const router = useRouter()
const { ref, id, pageId, childId } = useParams()
+ const { integrationsWrappers } = useIsFeatureEnabled(['integrations:wrappers'])
const { installedIntegrations: installedIntegrations, isLoading: isIntegrationsLoading } =
useInstalledIntegrations()
@@ -117,6 +120,10 @@ const IntegrationPage: NextPageWithLayout = () => {
return null
}
+ if (!integrationsWrappers && id?.endsWith('_wrapper')) {
+ return <UnknownInterface urlBack={`/project/${ref}/integrations`} />
+ }
+
return (
<PageLayout
title={pageTitle}
diff --git a/packages/common/enabled-features/enabled-features.json b/packages/common/enabled-features/enabled-features.json
index 6bef25c14fc..208e3eaf132 100644
--- a/packages/common/enabled-features/enabled-features.json
+++ b/packages/common/enabled-features/enabled-features.json
@@ -60,7 +60,7 @@
"feedback:docs": true,
"integrations:partners": true,
- "integrations:show_stripe_wrapper": true,
+ "integrations:wrappers": true,
"integrations:vercel": true,
"logs:templates": true,
diff --git a/packages/common/enabled-features/enabled-features.schema.json b/packages/common/enabled-features/enabled-features.schema.json
index 3ee59127865..a71a4813d9f 100644
--- a/packages/common/enabled-features/enabled-features.schema.json
+++ b/packages/common/enabled-features/enabled-features.schema.json
@@ -215,9 +215,9 @@
"type": "boolean",
"description": "Show all third-party-managed integrations"
},
- "integrations:show_stripe_wrapper": {
+ "integrations:wrappers": {
"type": "boolean",
- "description": "Show the Stripe wrapper under project integrations"
+ "description": "Show all wrappers (FDW) under project integrations"
},
"integrations:vercel": {
"type": "boolean",
@@ -413,7 +413,7 @@
"docs:web_apps",
"feedback:docs",
"integrations:partners",
- "integrations:show_stripe_wrapper",
+ "integrations:wrappers",
"integrations:vercel",
"profile:show_email",
"profile:show_information",