Skip to content

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

Chore/disable more sections 01 (#38057)

Joshen Limc4b36d9ab0c7
diff --git a/apps/studio/components/interfaces/Integrations/Landing/AvailableIntegrations.tsx b/apps/studio/components/interfaces/Integrations/Landing/AvailableIntegrations.tsx
index 0b8c59878a6..ed06cda5e90 100644
--- a/apps/studio/components/interfaces/Integrations/Landing/AvailableIntegrations.tsx
+++ b/apps/studio/components/interfaces/Integrations/Landing/AvailableIntegrations.tsx
@@ -3,6 +3,7 @@ import { parseAsString, useQueryState } from 'nuqs'
import AlertError from 'components/ui/AlertError'
import NoSearchResults from 'components/ui/NoSearchResults'
+import { useIsFeatureEnabled } from 'hooks/misc/useIsFeatureEnabled'
import { buttonVariants, cn, Tabs_Shadcn_, TabsList_Shadcn_, TabsTrigger_Shadcn_ } from 'ui'
import { Admonition } from 'ui-patterns/admonition'
import { Input } from 'ui-patterns/DataInputs/Input'
@@ -17,6 +18,8 @@ const CATEGORIES = [
] as const
export const AvailableIntegrations = () => {
+ const showStripeWrapper = useIsFeatureEnabled('integrations:show_stripe_wrapper')
+
const [selectedCategory, setSelectedCategory] = useQueryState(
'category',
parseAsString.withDefault('all').withOptions({ clearOnDefault: true })
@@ -26,16 +29,26 @@ export const AvailableIntegrations = () => {
parseAsString.withDefault('').withOptions({ clearOnDefault: true })
)
- const { availableIntegrations, installedIntegrations, error, isError, isLoading, isSuccess } =
- useInstalledIntegrations()
+ const {
+ availableIntegrations: allIntegrations,
+ installedIntegrations,
+ error,
+ isError,
+ isLoading,
+ isSuccess,
+ } = useInstalledIntegrations()
const installedIds = installedIntegrations.map((i) => i.id)
// available integrations for install
+ const availableIntegrations = showStripeWrapper
+ ? allIntegrations
+ : allIntegrations.filter((x) => x.id !== 'stripe_wrapper')
const integrationsByCategory =
selectedCategory === 'all'
? availableIntegrations
: availableIntegrations.filter((i) => i.type === selectedCategory)
+
const filteredIntegrations = (
search.length > 0
? integrationsByCategory.filter((i) => i.name.toLowerCase().includes(search.toLowerCase()))
diff --git a/apps/studio/components/interfaces/Sidebar.tsx b/apps/studio/components/interfaces/Sidebar.tsx
index efda42e4252..492a9956556 100644
--- a/apps/studio/components/interfaces/Sidebar.tsx
+++ b/apps/studio/components/interfaces/Sidebar.tsx
@@ -224,6 +224,7 @@ const ProjectLinks = () => {
const snap = useAppStateSnapshot()
const isNewAPIDocsEnabled = useIsAPIDocsSidePanelEnabled()
const { securityLints, errorLints } = useLints()
+ const showReports = useIsFeatureEnabled('reports:all')
const activeRoute = router.pathname.split('/')[3]
@@ -251,6 +252,7 @@ const ProjectLinks = () => {
const otherRoutes = generateOtherRoutes(ref, project, {
unifiedLogs: isUnifiedLogsEnabled,
+ showReports,
})
const settingsRoutes = generateSettingsRoutes(ref, project)
diff --git a/apps/studio/components/layouts/ProjectLayout/NavigationBar/NavigationBar.utils.tsx b/apps/studio/components/layouts/ProjectLayout/NavigationBar/NavigationBar.utils.tsx
index 503d3c8d973..c08feee6cd6 100644
--- a/apps/studio/components/layouts/ProjectLayout/NavigationBar/NavigationBar.utils.tsx
+++ b/apps/studio/components/layouts/ProjectLayout/NavigationBar/NavigationBar.utils.tsx
@@ -119,12 +119,14 @@ export const generateProductRoutes = (
export const generateOtherRoutes = (
ref?: string,
project?: Project,
- features?: { unifiedLogs?: boolean }
+ features?: { unifiedLogs?: boolean; showReports?: boolean }
): Route[] => {
const isProjectBuilding = project?.status === PROJECT_STATUS.COMING_UP
const buildingUrl = `/project/${ref}`
- const unifiedLogsEnabled = features?.unifiedLogs ?? false
+ const { unifiedLogs, showReports } = features ?? {}
+ const unifiedLogsEnabled = unifiedLogs ?? false
+ const reportsEnabled = showReports ?? true
return [
{
@@ -133,7 +135,7 @@ export const generateOtherRoutes = (
icon: <Lightbulb size={ICON_SIZE} strokeWidth={ICON_STROKE_WIDTH} />,
link: ref && (isProjectBuilding ? buildingUrl : `/project/${ref}/advisors/security`),
},
- ...(IS_PLATFORM
+ ...(IS_PLATFORM && reportsEnabled
? [
{
key: 'reports',
diff --git a/apps/studio/components/layouts/RealtimeLayout/RealtimeLayout.tsx b/apps/studio/components/layouts/RealtimeLayout/RealtimeLayout.tsx
index e4cef928a73..047132d86e7 100644
--- a/apps/studio/components/layouts/RealtimeLayout/RealtimeLayout.tsx
+++ b/apps/studio/components/layouts/RealtimeLayout/RealtimeLayout.tsx
@@ -3,6 +3,7 @@ import { PropsWithChildren } from 'react'
import { useIsRealtimeSettingsEnabled } from 'components/interfaces/App/FeaturePreview/FeaturePreviewContext'
import { ProductMenu } from 'components/ui/ProductMenu'
+import { useIsFeatureEnabled } from 'hooks/misc/useIsFeatureEnabled'
import { useSelectedProjectQuery } from 'hooks/misc/useSelectedProject'
import { withAuth } from 'hooks/misc/withAuth'
import { useIsRealtimeSettingsFFEnabled } from 'hooks/ui/useFlag'
@@ -17,6 +18,7 @@ const RealtimeLayout = ({ title, children }: PropsWithChildren<RealtimeLayoutPro
const { data: project } = useSelectedProjectQuery()
const enableRealtimeSettingsFF = useIsRealtimeSettingsFFEnabled()
const enableRealtimeSettingsFP = useIsRealtimeSettingsEnabled()
+ const showPolicies = useIsFeatureEnabled('authentication:policies')
const enableRealtimeSettings = enableRealtimeSettingsFF && enableRealtimeSettingsFP
@@ -30,7 +32,7 @@ const RealtimeLayout = ({ title, children }: PropsWithChildren<RealtimeLayoutPro
productMenu={
<ProductMenu
page={page}
- menu={generateRealtimeMenu(project!, { enableRealtimeSettings })}
+ menu={generateRealtimeMenu(project!, { enableRealtimeSettings, showPolicies })}
/>
}
>
diff --git a/apps/studio/components/layouts/RealtimeLayout/RealtimeMenu.utils.ts b/apps/studio/components/layouts/RealtimeLayout/RealtimeMenu.utils.ts
index 365c424d57a..59a494dd9de 100644
--- a/apps/studio/components/layouts/RealtimeLayout/RealtimeMenu.utils.ts
+++ b/apps/studio/components/layouts/RealtimeLayout/RealtimeMenu.utils.ts
@@ -4,10 +4,11 @@ import { IS_PLATFORM } from 'lib/constants'
export const generateRealtimeMenu = (
project: Project,
- flags?: { enableRealtimeSettings: boolean }
+ flags?: { enableRealtimeSettings: boolean; showPolicies: boolean }
): ProductMenuGroup[] => {
const ref = project?.ref ?? 'default'
- const { enableRealtimeSettings } = flags || {}
+ const { enableRealtimeSettings, showPolicies } = flags || {}
+ const showRealtimeSettings = IS_PLATFORM && enableRealtimeSettings
return [
{
@@ -21,26 +22,34 @@ export const generateRealtimeMenu = (
},
],
},
- {
- title: 'Configuration',
- items: [
- {
- name: 'Policies',
- key: 'policies',
- url: `/project/${ref}/realtime/policies`,
- items: [],
- },
- ...(IS_PLATFORM && enableRealtimeSettings
- ? [
- {
- name: 'Settings',
- key: 'settings',
- url: `/project/${ref}/realtime/settings`,
- items: [],
- },
- ]
- : []),
- ],
- },
+ ...(showRealtimeSettings || showPolicies
+ ? [
+ {
+ title: 'Configuration',
+ items: [
+ ...(showPolicies
+ ? [
+ {
+ name: 'Policies',
+ key: 'policies',
+ url: `/project/${ref}/realtime/policies`,
+ items: [],
+ },
+ ]
+ : []),
+ ...(showRealtimeSettings
+ ? [
+ {
+ name: 'Settings',
+ key: 'settings',
+ url: `/project/${ref}/realtime/settings`,
+ items: [],
+ },
+ ]
+ : []),
+ ],
+ },
+ ]
+ : []),
]
}
diff --git a/apps/studio/components/layouts/ReportsLayout/ReportsLayout.tsx b/apps/studio/components/layouts/ReportsLayout/ReportsLayout.tsx
index c9cb77cc689..36bcf2cceeb 100644
--- a/apps/studio/components/layouts/ReportsLayout/ReportsLayout.tsx
+++ b/apps/studio/components/layouts/ReportsLayout/ReportsLayout.tsx
@@ -1,5 +1,8 @@
import { PropsWithChildren } from 'react'
+import { useParams } from 'common'
+import { UnknownInterface } from 'components/ui/UnknownInterface'
+import { useIsFeatureEnabled } from 'hooks/misc/useIsFeatureEnabled'
import { withAuth } from 'hooks/misc/withAuth'
import ProjectLayout from '../ProjectLayout/ProjectLayout'
import ReportsMenu from './ReportsMenu'
@@ -9,11 +12,23 @@ interface ReportsLayoutProps {
}
const ReportsLayout = ({ title, children }: PropsWithChildren<ReportsLayoutProps>) => {
- return (
- <ProjectLayout title={title} product="Reports" productMenu={<ReportsMenu />} isBlocking={false}>
- {children}
- </ProjectLayout>
- )
+ const { ref } = useParams()
+ const { reportsAll } = useIsFeatureEnabled(['reports:all'])
+
+ if (reportsAll) {
+ return (
+ <ProjectLayout
+ title={title}
+ product="Reports"
+ productMenu={<ReportsMenu />}
+ isBlocking={false}
+ >
+ {children}
+ </ProjectLayout>
+ )
+ } else {
+ return <UnknownInterface urlBack={`/project/${ref}`} />
+ }
}
export default withAuth(ReportsLayout)
diff --git a/apps/studio/pages/project/[ref]/realtime/policies.tsx b/apps/studio/pages/project/[ref]/realtime/policies.tsx
index 20555d9d134..38fc9f84d7d 100644
--- a/apps/studio/pages/project/[ref]/realtime/policies.tsx
+++ b/apps/studio/pages/project/[ref]/realtime/policies.tsx
@@ -1,11 +1,21 @@
import { RealtimePolicies } from 'components/interfaces/Realtime/Policies'
import type { NextPageWithLayout } from 'types'
-import RealtimeLayout from 'components/layouts/RealtimeLayout/RealtimeLayout'
+import { useParams } from 'common'
import DefaultLayout from 'components/layouts/DefaultLayout'
+import RealtimeLayout from 'components/layouts/RealtimeLayout/RealtimeLayout'
+import { UnknownInterface } from 'components/ui/UnknownInterface'
+import { useIsFeatureEnabled } from 'hooks/misc/useIsFeatureEnabled'
const RealtimePoliciesPage: NextPageWithLayout = () => {
- return <RealtimePolicies />
+ const { ref } = useParams()
+ const { authenticationPolicies } = useIsFeatureEnabled(['authentication:policies'])
+
+ if (authenticationPolicies) {
+ return <RealtimePolicies />
+ } else {
+ return <UnknownInterface urlBack={`/project/${ref}/realtime/inspector`} />
+ }
}
RealtimePoliciesPage.getLayout = (page) => (
diff --git a/packages/common/enabled-features/enabled-features.json b/packages/common/enabled-features/enabled-features.json
index ec2357a4351..4c0f50f6cc2 100644
--- a/packages/common/enabled-features/enabled-features.json
+++ b/packages/common/enabled-features/enabled-features.json
@@ -29,6 +29,7 @@
"database:roles": true,
"integrations:vercel": true,
+ "integrations:show_stripe_wrapper": true,
"logs:templates": true,
"logs:collections": true,
@@ -45,5 +46,7 @@
"project_homepage:show_instance_size": true,
"project_homepage:show_examples": true,
+ "reports:all": true,
+
"table_editor:enable_rls_toggle": true
}
diff --git a/packages/common/enabled-features/enabled-features.schema.json b/packages/common/enabled-features/enabled-features.schema.json
index f3bd32c894d..07a42fa4d0d 100644
--- a/packages/common/enabled-features/enabled-features.schema.json
+++ b/packages/common/enabled-features/enabled-features.schema.json
@@ -103,6 +103,10 @@
"type": "boolean",
"description": "Enable the vercel integration section in the organization and project settings pages"
},
+ "integrations:show_stripe_wrapper": {
+ "type": "boolean",
+ "description": "Show the Stripe wrapper under project integrations"
+ },
"logs:templates": {
"type": "boolean",
@@ -149,6 +153,11 @@
"description": "Show all client libraries examples in the project homepage. When false, all client library examples will be hidden except the JavaScript client library."
},
+ "reports:all": {
+ "type": "boolean",
+ "description": "Enable the project reports page"
+ },
+
"table_editor:enable_rls_toggle": {
"type": "boolean",
"description": "Show the RLS toggle in the table creation flow and table editor header"
@@ -178,6 +187,7 @@
"database:replication",
"database:roles",
"integrations:vercel",
+ "integrations:show_stripe_wrapper",
"profile:show_email",
"profile:show_information",
"logs:templates",
@@ -188,6 +198,7 @@
"project_homepage:show_all_client_libraries",
"project_connection:javascript_example",
"project_connection:dart_example",
+ "reports:all",
"table_editor:enable_rls_toggle"
],
"additionalProperties": false