The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
feat: disable org features (#37991)
Alaister Young44c8f849ba4c
diff --git a/apps/studio/components/interfaces/Organization/GeneralSettings/AIOptInLevelSelector.tsx b/apps/studio/components/interfaces/Organization/GeneralSettings/AIOptInLevelSelector.tsxindex 5744f9e177b..28e9686ef77 100644--- a/apps/studio/components/interfaces/Organization/GeneralSettings/AIOptInLevelSelector.tsx+++ b/apps/studio/components/interfaces/Organization/GeneralSettings/AIOptInLevelSelector.tsx@@ -5,6 +5,7 @@ import { AIOptInFormValues } from 'hooks/forms/useAIOptInForm'import { FormField_Shadcn_, RadioGroup_Shadcn_, RadioGroupItem_Shadcn_ } from 'ui'import { FormItemLayout } from 'ui-patterns/form/FormItemLayout/FormItemLayout'import { OptInToOpenAIToggle } from './OptInToOpenAIToggle'+import { useIsFeatureEnabled } from 'hooks/misc/useIsFeatureEnabled'interface AIOptInLevelSelectorProps {control: Control<AIOptInFormValues>@@ -13,39 +14,67 @@ interface AIOptInLevelSelectorProps {layout?: 'horizontal' | 'vertical' | 'flex-row-reverse'}-const AI_OPT_IN_LEVELS = [- {- value: 'disabled',- title: 'Disabled',- description:- 'You do not consent to sharing any database information with Amazon Bedrock and understand that responses will be generic and not tailored to your database',- },- {- value: 'schema',- title: 'Schema Only',- description:- 'You consent to sharing your database’s schema metadata (such as table and column names, data types, and relationships—but not actual database data) with Amazon Bedrock',- },- {- value: 'schema_and_log',- title: 'Schema & Logs',- description:- 'You consent to sharing your schema and logs (which may contain PII/database data) with Amazon Bedrock for better results',- },- {- value: 'schema_and_log_and_data',- title: 'Schema, Logs & Database Data',- description:- 'You consent to give Amazon Bedrock full access to run database read only queries and analyze results for optimal results',- },-]-export const AIOptInLevelSelector = ({control,disabled,label,layout = 'vertical',}: AIOptInLevelSelectorProps) => {+ const {+ aiOptInLevelDisabled,+ aiOptInLevelSchema,+ aiOptInLevelSchemaAndLog,+ aiOptInLevelSchemaAndLogAndData,+ } = useIsFeatureEnabled([+ 'ai:opt_in_level_disabled',+ 'ai:opt_in_level_schema',+ 'ai:opt_in_level_schema_and_log',+ 'ai:opt_in_level_schema_and_log_and_data',+ ])++ const AI_OPT_IN_LEVELS = [+ ...(aiOptInLevelDisabled+ ? [+ {+ value: 'disabled',+ title: 'Disabled',+ description:+ 'You do not consent to sharing any database information with Amazon Bedrock and understand that responses will be generic and not tailored to your database',+ },+ ]+ : []),+ ...(aiOptInLevelSchema+ ? [+ {+ value: 'schema',+ title: 'Schema Only',+ description:+ 'You consent to sharing your database’s schema metadata (such as table and column names, data types, and relationships—but not actual database data) with Amazon Bedrock',+ },+ ]+ : []),+ ...(aiOptInLevelSchemaAndLog+ ? [+ {+ value: 'schema_and_log',+ title: 'Schema & Logs',+ description:+ 'You consent to sharing your schema and logs (which may contain PII/database data) with Amazon Bedrock for better results',+ },+ ]+ : []),+ ...(aiOptInLevelSchemaAndLogAndData+ ? [+ {+ value: 'schema_and_log_and_data',+ title: 'Schema, Logs & Database Data',+ description:+ 'You consent to give Amazon Bedrock full access to run database read only queries and analyze results for optimal results',+ },+ ]+ : []),+ ]+return (<FormItemLayoutlabel={label}diff --git a/apps/studio/components/interfaces/Organization/IntegrationSettings/IntegrationSettings.tsx b/apps/studio/components/interfaces/Organization/IntegrationSettings/IntegrationSettings.tsxindex 57e01183719..bec757f81fa 100644--- a/apps/studio/components/interfaces/Organization/IntegrationSettings/IntegrationSettings.tsx+++ b/apps/studio/components/interfaces/Organization/IntegrationSettings/IntegrationSettings.tsx@@ -20,6 +20,7 @@ import { useGitHubConnectionDeleteMutation } from 'data/integrations/github-connimport { useGitHubConnectionsQuery } from 'data/integrations/github-connections-query'import type { IntegrationProjectConnection } from 'data/integrations/integrations.types'import { useCheckPermissions } from 'hooks/misc/useCheckPermissions'+import { useIsFeatureEnabled } from 'hooks/misc/useIsFeatureEnabled'import { useSelectedOrganizationQuery } from 'hooks/misc/useSelectedOrganization'import { BASE_PATH } from 'lib/constants'import {@@ -45,6 +46,8 @@ const IntegrationSettings = () => {const router = useRouter()const { data: org } = useSelectedOrganizationQuery()+ const showVercelIntegration = useIsFeatureEnabled('integrations:vercel')+const canReadGithubConnection = useCheckPermissions(PermissionAction.READ,'integrations.github_connections'@@ -179,9 +182,13 @@ The GitHub app will watch for changes in your repository such as file changes, b<ScaffoldTitle>Integrations</ScaffoldTitle></ScaffoldContainerLegacy><GitHubSection />- <ScaffoldDivider />- <VercelSection isProjectScoped={false} />- <SidePanelVercelProjectLinker />+ {showVercelIntegration && (+ <>+ <ScaffoldDivider />+ <VercelSection isProjectScoped={false} />+ <SidePanelVercelProjectLinker />+ </>+ )}</>)}diff --git a/apps/studio/components/interfaces/Settings/Integrations/IntegrationsSettings.tsx b/apps/studio/components/interfaces/Settings/Integrations/IntegrationsSettings.tsxindex 51ce7d77558..2533fdfdf1d 100644--- a/apps/studio/components/interfaces/Settings/Integrations/IntegrationsSettings.tsx+++ b/apps/studio/components/interfaces/Settings/Integrations/IntegrationsSettings.tsx@@ -2,6 +2,7 @@ import Link from 'next/link'import SidePanelVercelProjectLinker from 'components/interfaces/Organization/IntegrationSettings/SidePanelVercelProjectLinker'import { ScaffoldContainer, ScaffoldDivider } from 'components/layouts/Scaffold'+import { useIsFeatureEnabled } from 'hooks/misc/useIsFeatureEnabled'import { useProjectByRefQuery, useSelectedProjectQuery } from 'hooks/misc/useSelectedProject'import { BASE_PATH } from 'lib/constants'import { AlertDescription_Shadcn_, AlertTitle_Shadcn_, Alert_Shadcn_, WarningIcon } from 'ui'@@ -23,6 +24,8 @@ const IntegrationSettings = () => {const { data: parentProject } = useProjectByRefQuery(project?.parent_project_ref)const isBranch = project?.parent_project_ref !== undefined+ const showVercelIntegration = useIsFeatureEnabled('integrations:vercel')+return (<>{isBranch && (@@ -43,9 +46,13 @@ const IntegrationSettings = () => {</ScaffoldContainer>)}<GitHubSection />- <ScaffoldDivider />- <VercelSection isProjectScoped={true} />- <SidePanelVercelProjectLinker />+ {showVercelIntegration && (+ <>+ <ScaffoldDivider />+ <VercelSection isProjectScoped={true} />+ <SidePanelVercelProjectLinker />+ </>+ )}</>)}diff --git a/apps/studio/components/interfaces/Sidebar.tsx b/apps/studio/components/interfaces/Sidebar.tsxindex 2f6c7ca7c01..efda42e4252 100644--- a/apps/studio/components/interfaces/Sidebar.tsx+++ b/apps/studio/components/interfaces/Sidebar.tsx@@ -355,6 +355,8 @@ const OrganizationLinks = () => {const isUserMFAEnabled = useIsMFAEnabled()const disableAccessMfa = org?.organization_requires_mfa && !isUserMFAEnabled+ const showBilling = useIsFeatureEnabled('billing:all')+const activeRoute = router.pathname.split('/')[3]const navMenuItems = [@@ -382,12 +384,16 @@ const OrganizationLinks = () => {key: 'usage',icon: <ChartArea size={ICON_SIZE} strokeWidth={ICON_STROKE_WIDTH} />,},- {- label: 'Billing',- href: `/org/${slug}/billing`,- key: 'billing',- icon: <Receipt size={ICON_SIZE} strokeWidth={ICON_STROKE_WIDTH} />,- },+ ...(showBilling+ ? [+ {+ label: 'Billing',+ href: `/org/${slug}/billing`,+ key: 'billing',+ icon: <Receipt size={ICON_SIZE} strokeWidth={ICON_STROKE_WIDTH} />,+ },+ ]+ : []),{label: 'Organization settings',href: `/org/${slug}/general`,diff --git a/apps/studio/components/layouts/OrganizationLayout.tsx b/apps/studio/components/layouts/OrganizationLayout.tsxindex 5df44aa907e..a705d2c6d3f 100644--- a/apps/studio/components/layouts/OrganizationLayout.tsx+++ b/apps/studio/components/layouts/OrganizationLayout.tsx@@ -15,7 +15,7 @@ const OrganizationLayoutContent = ({ children }: PropsWithChildren<{}>) => {})return (- <div className={cn('w-full flex flex-col overflow-hidden')}>+ <div className={cn('h-full w-full flex flex-col overflow-hidden')}>{selectedOrganization && selectedOrganization?.managed_by !== 'supabase' && (<Alert_Shadcn_variant="default"diff --git a/apps/studio/pages/org/[slug]/billing.tsx b/apps/studio/pages/org/[slug]/billing.tsxindex be6f59ff822..6d692fa5fcf 100644--- a/apps/studio/pages/org/[slug]/billing.tsx+++ b/apps/studio/pages/org/[slug]/billing.tsx@@ -5,6 +5,8 @@ import { BillingSettings } from 'components/interfaces/Organization/BillingSettiimport DefaultLayout from 'components/layouts/DefaultLayout'import OrganizationLayout from 'components/layouts/OrganizationLayout'import OrganizationSettingsLayout from 'components/layouts/ProjectLayout/OrganizationSettingsLayout'+import { UnknownInterface } from 'components/ui/UnknownInterface'+import { useIsFeatureEnabled } from 'hooks/misc/useIsFeatureEnabled'import {ORG_SETTINGS_PANEL_KEYS,useOrgSettingsPageStateSnapshot,@@ -12,9 +14,11 @@ import {import type { NextPageWithLayout } from 'types'const OrgBillingSettings: NextPageWithLayout = () => {- const { panel } = useParams()+ const { panel, slug } = useParams()const snap = useOrgSettingsPageStateSnapshot()+ const showBilling = useIsFeatureEnabled('billing:all')+useEffect(() => {const allowedValues = ['subscriptionPlan', 'costControl']if (panel && typeof panel === 'string' && allowedValues.includes(panel)) {@@ -24,6 +28,10 @@ const OrgBillingSettings: NextPageWithLayout = () => {// eslint-disable-next-line react-hooks/exhaustive-deps}, [panel])+ if (!showBilling) {+ return <UnknownInterface urlBack={`/org/${slug}`} />+ }+return <BillingSettings />}diff --git a/packages/common/enabled-features/enabled-features.json b/packages/common/enabled-features/enabled-features.jsonindex abdb1d71d7f..173dfe94b19 100644--- a/packages/common/enabled-features/enabled-features.json+++ b/packages/common/enabled-features/enabled-features.json@@ -1,6 +1,15 @@{"$schema": "./enabled-features.schema.json",+ "ai:opt_in_level_disabled": true,+ "ai:opt_in_level_schema": true,+ "ai:opt_in_level_schema_and_log": true,+ "ai:opt_in_level_schema_and_log_and_data": true,++ "billing:all": true,++ "integrations:vercel": true,+"logs:templates": true,"logs:collections": true,diff --git a/packages/common/enabled-features/enabled-features.schema.json b/packages/common/enabled-features/enabled-features.schema.jsonindex 317fca868b2..9d39cb94b89 100644--- a/packages/common/enabled-features/enabled-features.schema.json+++ b/packages/common/enabled-features/enabled-features.schema.json@@ -6,6 +6,33 @@"type": "string"},+ "ai:opt_in_level_disabled": {+ "type": "boolean",+ "description": "Enable the AI opt in level 'disabled'"+ },+ "ai:opt_in_level_schema": {+ "type": "boolean",+ "description": "Enable the AI opt in level 'schema'"+ },+ "ai:opt_in_level_schema_and_log": {+ "type": "boolean",+ "description": "Enable the AI opt in level 'schema_and_log'"+ },+ "ai:opt_in_level_schema_and_log_and_data": {+ "type": "boolean",+ "description": "Enable the AI opt in level 'schema_and_log_and_data'"+ },++ "billing:all": {+ "type": "boolean",+ "description": "Enable the billing settings page"+ },++ "integrations:vercel": {+ "type": "boolean",+ "description": "Enable the vercel integration section in the organization and project settings pages"+ },+"logs:templates": {"type": "boolean","description": "Enable the logs templates page"@@ -52,6 +79,12 @@}},"required": [+ "ai:opt_in_level_disabled",+ "ai:opt_in_level_schema",+ "ai:opt_in_level_schema_and_log",+ "ai:opt_in_level_schema_and_log_and_data",+ "billing:all",+ "integrations:vercel","profile:show_email","profile:show_information","logs:templates",