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 04 (#38064)

Joshen Lim7b1ac2a66e18
diff --git a/apps/studio/components/interfaces/Auth/Users/UserOverview.tsx b/apps/studio/components/interfaces/Auth/Users/UserOverview.tsx
index 6a83f3c58fc..7737da47b31 100644
--- a/apps/studio/components/interfaces/Auth/Users/UserOverview.tsx
+++ b/apps/studio/components/interfaces/Auth/Users/UserOverview.tsx
@@ -16,6 +16,7 @@ import { useUserSendOTPMutation } from 'data/auth/user-send-otp-mutation'
import { useUserUpdateMutation } from 'data/auth/user-update-mutation'
import { User } from 'data/auth/users-infinite-query'
import { useAsyncCheckProjectPermissions } from 'hooks/misc/useCheckPermissions'
+import { useIsFeatureEnabled } from 'hooks/misc/useIsFeatureEnabled'
import { BASE_PATH } from 'lib/constants'
import { timeout } from 'lib/helpers'
import { Button, cn, Separator } from 'ui'
@@ -45,6 +46,10 @@ export const UserOverview = ({ user, onDeleteSuccess }: UserOverviewProps) => {
const isPhoneAuth = user.phone !== null
const isBanned = user.banned_until !== null
+ const { authenticationSignInProviders } = useIsFeatureEnabled([
+ 'authentication:sign_in_providers',
+ ])
+
const providers = ((user.raw_app_meta_data?.providers as string[]) ?? []).map(
(provider: string) => {
return {
@@ -238,13 +243,15 @@ export const UserOverview = ({ user, onDeleteSuccess }: UserOverviewProps) => {
Signed in with a {providerName} account via{' '}
{providerName === 'SAML' ? 'SSO' : 'OAuth'}
</p>
- <Button asChild type="default" className="mt-2">
- <Link
- href={`/project/${projectRef}/auth/providers?provider=${provider.name === 'SAML' ? 'SAML 2.0' : provider.name}`}
- >
- Configure {providerName} provider
- </Link>
- </Button>
+ {authenticationSignInProviders && (
+ <Button asChild type="default" className="mt-2">
+ <Link
+ href={`/project/${projectRef}/auth/providers?provider=${provider.name === 'SAML' ? 'SAML 2.0' : provider.name}`}
+ >
+ Configure {providerName} provider
+ </Link>
+ </Button>
+ )}
</div>
{isActive ? (
<div className="flex items-center gap-1 rounded-full border border-brand-400 bg-brand-200 py-1 px-1 text-xs text-brand">
diff --git a/apps/studio/components/interfaces/Docs/GeneralContent.tsx b/apps/studio/components/interfaces/Docs/GeneralContent.tsx
index da63210858d..0550dfc1c42 100644
--- a/apps/studio/components/interfaces/Docs/GeneralContent.tsx
+++ b/apps/studio/components/interfaces/Docs/GeneralContent.tsx
@@ -2,7 +2,7 @@ import Authentication from 'components/interfaces/Docs/Authentication'
import Introduction from 'components/interfaces/Docs/Introduction'
import RpcIntroduction from 'components/interfaces/Docs/Pages/Rpc/Introduction'
import TablesIntroduction from 'components/interfaces/Docs/Pages/Tables/Introduction'
-import UserManagement from 'components/interfaces/Docs/Pages/UserManagement'
+import { UserManagement } from 'components/interfaces/Docs/Pages/UserManagement'
interface GeneralContentProps {
page?: string
diff --git a/apps/studio/components/interfaces/Docs/Pages/UserManagement.tsx b/apps/studio/components/interfaces/Docs/Pages/UserManagement.tsx
index 036acd17192..ff4ef5661eb 100644
--- a/apps/studio/components/interfaces/Docs/Pages/UserManagement.tsx
+++ b/apps/studio/components/interfaces/Docs/Pages/UserManagement.tsx
@@ -3,6 +3,7 @@ import { useRouter } from 'next/router'
import { useParams } from 'common'
import { useProjectSettingsV2Query } from 'data/config/project-settings-v2-query'
+import { useIsFeatureEnabled } from 'hooks/misc/useIsFeatureEnabled'
import { makeRandomString } from 'lib/helpers'
import CodeSnippet from '../CodeSnippet'
import Snippets from '../Snippets'
@@ -14,11 +15,15 @@ interface UserManagementProps {
showApiKey: string
}
-export default function UserManagement({ selectedLang, showApiKey }: UserManagementProps) {
+export const UserManagement = ({ selectedLang, showApiKey }: UserManagementProps) => {
const router = useRouter()
const { ref: projectRef } = useParams()
const keyToShow = showApiKey ? showApiKey : 'SUPABASE_KEY'
+ const { authenticationSignInProviders } = useIsFeatureEnabled([
+ 'authentication:sign_in_providers',
+ ])
+
const { data: settings } = useProjectSettingsV2Query({ projectRef })
const protocol = settings?.app_config?.protocol ?? 'https'
const hostEndpoint = settings?.app_config?.endpoint ?? ''
@@ -157,72 +162,80 @@ export default function UserManagement({ selectedLang, showApiKey }: UserManagem
</article>
</div>
- <h2 className="doc-heading">Log in with Third Party OAuth</h2>
- <div className="doc-section ">
- <article className="code-column text-foreground">
- <p>
- Users can log in with Third Party OAuth like Google, Facebook, GitHub, and more. You
- must first enable each of these in the Auth Providers settings{' '}
- <span className="text-green-500">
- <Link key={'AUTH'} href={`/project/${router.query.ref}/auth/providers`}>
- here
- </Link>
- </span>{' '}
- .
- </p>
- <p>
- View all the available{' '}
- <a
- href="https://supabase.com/docs/guides/auth#providers"
- target="_blank"
- rel="noreferrer"
- >
- Third Party OAuth providers
- </a>
- </p>
- <p>
- After they have logged in, all interactions using the Supabase JS client will be
- performed as "that user".
- </p>
- <p>
- Generate your Client ID and secret from:{` `}
- <a
- href="https://console.developers.google.com/apis/credentials"
- target="_blank"
- rel="noreferrer"
- >
- Google
- </a>
- ,{` `}
- <a href="https://github.com/settings/applications/new" target="_blank" rel="noreferrer">
- GitHub
- </a>
- ,{` `}
- <a href="https://gitlab.com/oauth/applications" target="_blank" rel="noreferrer">
- GitLab
- </a>
- ,{` `}
- <a href="https://developers.facebook.com/apps/" target="_blank" rel="noreferrer">
- Facebook
- </a>
- ,{` `}
- <a
- href="https://support.atlassian.com/bitbucket-cloud/docs/use-oauth-on-bitbucket-cloud/"
- target="_blank"
- rel="noreferrer"
- >
- Bitbucket
- </a>
- .
- </p>
- </article>
- <article className="code">
- <CodeSnippet
- selectedLang={selectedLang}
- snippet={Snippets.authThirdPartyLogin(endpoint, keyToShow)}
- />
- </article>
- </div>
+ {authenticationSignInProviders && (
+ <>
+ <h2 className="doc-heading">Log in with Third Party OAuth</h2>
+ <div className="doc-section ">
+ <article className="code-column text-foreground">
+ <p>
+ Users can log in with Third Party OAuth like Google, Facebook, GitHub, and more. You
+ must first enable each of these in the Auth Providers settings{' '}
+ <span className="text-green-500">
+ <Link key={'AUTH'} href={`/project/${router.query.ref}/auth/providers`}>
+ here
+ </Link>
+ </span>{' '}
+ .
+ </p>
+ <p>
+ View all the available{' '}
+ <a
+ href="https://supabase.com/docs/guides/auth#providers"
+ target="_blank"
+ rel="noreferrer"
+ >
+ Third Party OAuth providers
+ </a>
+ </p>
+ <p>
+ After they have logged in, all interactions using the Supabase JS client will be
+ performed as "that user".
+ </p>
+ <p>
+ Generate your Client ID and secret from:{` `}
+ <a
+ href="https://console.developers.google.com/apis/credentials"
+ target="_blank"
+ rel="noreferrer"
+ >
+ Google
+ </a>
+ ,{` `}
+ <a
+ href="https://github.com/settings/applications/new"
+ target="_blank"
+ rel="noreferrer"
+ >
+ GitHub
+ </a>
+ ,{` `}
+ <a href="https://gitlab.com/oauth/applications" target="_blank" rel="noreferrer">
+ GitLab
+ </a>
+ ,{` `}
+ <a href="https://developers.facebook.com/apps/" target="_blank" rel="noreferrer">
+ Facebook
+ </a>
+ ,{` `}
+ <a
+ href="https://support.atlassian.com/bitbucket-cloud/docs/use-oauth-on-bitbucket-cloud/"
+ target="_blank"
+ rel="noreferrer"
+ >
+ Bitbucket
+ </a>
+ .
+ </p>
+ </article>
+ <article className="code">
+ <CodeSnippet
+ selectedLang={selectedLang}
+ snippet={Snippets.authThirdPartyLogin(endpoint, keyToShow)}
+ />
+ </article>
+ </div>
+ </>
+ )}
<h2 className="doc-heading">User</h2>
<div className="doc-section ">
diff --git a/apps/studio/components/interfaces/Home/NewProjectPanel/APIKeys.tsx b/apps/studio/components/interfaces/Home/NewProjectPanel/APIKeys.tsx
index d2779272463..438cbd5fd70 100644
--- a/apps/studio/components/interfaces/Home/NewProjectPanel/APIKeys.tsx
+++ b/apps/studio/components/interfaces/Home/NewProjectPanel/APIKeys.tsx
@@ -42,7 +42,10 @@ export const APIKeys = () => {
])
const availableLanguages = [
- ...(javascriptExampleEnabled ? [{ name: 'Javascript', key: 'js' }] : []),
+ {
+ name: javascriptExampleEnabled ? 'Javascript' : 'Typescript',
+ key: 'js',
+ },
...(dartExampleEnabled ? [{ name: 'Dart', key: 'dart' }] : []),
]
const [selectedLanguage, setSelectedLanguage] = useState(availableLanguages[0])
diff --git a/apps/studio/components/interfaces/Home/ProjectList/ProjectCard.tsx b/apps/studio/components/interfaces/Home/ProjectList/ProjectCard.tsx
index 0f2283b1b97..0874e31d8a2 100644
--- a/apps/studio/components/interfaces/Home/ProjectList/ProjectCard.tsx
+++ b/apps/studio/components/interfaces/Home/ProjectList/ProjectCard.tsx
@@ -6,6 +6,7 @@ import type { IntegrationProjectConnection } from 'data/integrations/integration
import { ProjectIndexPageLink } from 'data/prefetchers/project.$ref'
import type { ProjectInfo } from 'data/projects/projects-query'
import type { ResourceWarning } from 'data/usage/resource-warnings-query'
+import { useIsFeatureEnabled } from 'hooks/misc/useIsFeatureEnabled'
import { BASE_PATH } from 'lib/constants'
import InlineSVG from 'react-inlinesvg'
import { inferProjectStatus } from './ProjectCard.utils'
@@ -29,6 +30,10 @@ const ProjectCard = ({
const { name, ref: projectRef } = project
const desc = `${project.cloud_provider} | ${project.region}`
+ const { projectHomepageShowInstanceSize } = useIsFeatureEnabled([
+ 'project_homepage:show_instance_size',
+ ])
+
const isBranchingEnabled = project.preview_branch_refs?.length > 0
const isGithubIntegrated = githubIntegration !== undefined
const isVercelIntegrated = vercelIntegration !== undefined
@@ -45,7 +50,9 @@ const ProjectCard = ({
<p className="flex-shrink truncate text-sm pr-4">{name}</p>
<span className="text-sm lowercase text-foreground-light">{desc}</span>
<div className="flex items-center gap-x-1.5">
- {project.status !== 'INACTIVE' && <ComputeBadgeWrapper project={project} />}
+ {project.status !== 'INACTIVE' && projectHomepageShowInstanceSize && (
+ <ComputeBadgeWrapper project={project} />
+ )}
{isVercelIntegrated && (
<div className="w-fit p-1 border rounded-md flex items-center text-black dark:text-white">
<InlineSVG
diff --git a/apps/studio/components/interfaces/Integrations/Landing/AvailableIntegrations.tsx b/apps/studio/components/interfaces/Integrations/Landing/AvailableIntegrations.tsx
index ed06cda5e90..2d740de982b 100644
--- a/apps/studio/components/interfaces/Integrations/Landing/AvailableIntegrations.tsx
+++ b/apps/studio/components/interfaces/Integrations/Landing/AvailableIntegrations.tsx
@@ -18,7 +18,9 @@ const CATEGORIES = [
] as const
export const AvailableIntegrations = () => {
- const showStripeWrapper = useIsFeatureEnabled('integrations:show_stripe_wrapper')
+ const { integrationsShowStripeWrapper } = useIsFeatureEnabled([
+ 'integrations:show_stripe_wrapper',
+ ])
const [selectedCategory, setSelectedCategory] = useQueryState(
'category',
@@ -41,7 +43,7 @@ export const AvailableIntegrations = () => {
const installedIds = installedIntegrations.map((i) => i.id)
// available integrations for install
- const availableIntegrations = showStripeWrapper
+ const availableIntegrations = integrationsShowStripeWrapper
? allIntegrations
: allIntegrations.filter((x) => x.id !== 'stripe_wrapper')
const integrationsByCategory =
diff --git a/apps/studio/components/interfaces/Settings/Infrastructure/InfrastructureConfiguration/InstanceNode.tsx b/apps/studio/components/interfaces/Settings/Infrastructure/InfrastructureConfiguration/InstanceNode.tsx
index 7ad2f1fb211..a14c87464c1 100644
--- a/apps/studio/components/interfaces/Settings/Infrastructure/InfrastructureConfiguration/InstanceNode.tsx
+++ b/apps/studio/components/interfaces/Settings/Infrastructure/InfrastructureConfiguration/InstanceNode.tsx
@@ -15,6 +15,7 @@ import {
} from 'data/read-replicas/replicas-status-query'
import { formatDatabaseID } from 'data/read-replicas/replicas.utils'
import { useAsyncCheckProjectPermissions } from 'hooks/misc/useCheckPermissions'
+import { useIsFeatureEnabled } from 'hooks/misc/useIsFeatureEnabled'
import { BASE_PATH } from 'lib/constants'
import { useDatabaseSelectorStateSnapshot } from 'state/database-selector'
import {
@@ -44,7 +45,7 @@ interface NodeData {
id: string
provider: string
region: Region
- computeSize: string
+ computeSize?: string
status: string
inserted_at: string
}
@@ -109,6 +110,10 @@ export const PrimaryNode = ({ data }: NodeProps<PrimaryNodeData>) => {
// [Joshen] Just FYI Handles cannot be conditionally rendered
const { provider, region, computeSize, numReplicas, numRegions, hasLoadBalancer } = data
+ const { projectHomepageShowInstanceSize } = useIsFeatureEnabled([
+ 'project_homepage:show_instance_size',
+ ])
+
return (
<>
<Handle
@@ -133,8 +138,12 @@ export const PrimaryNode = ({ data }: NodeProps<PrimaryNodeData>) => {
</p>
<p className="flex items-center gap-x-1">
<span className="text-sm text-foreground-light">{provider}</span>
- <span className="text-sm text-foreground-light">•</span>
- <span className="text-sm text-foreground-light">{computeSize}</span>
+ {projectHomepageShowInstanceSize && (
+ <>
+ <span className="text-sm text-foreground-light">•</span>
+ <span className="text-sm text-foreground-light">{computeSize}</span>
+ </>
+ )}
</p>
</div>
</div>
@@ -186,6 +195,10 @@ export const ReplicaNode = ({ data }: NodeProps<ReplicaNodeData>) => {
PermissionAction.CREATE,
'projects'
)
+ const { projectHomepageShowInstanceSize } = useIsFeatureEnabled([
+ 'project_homepage:show_instance_size',
+ ])
+
const [, setShowConnect] = useQueryState('showConnect', parseAsBoolean.withDefault(false))
const { data: databaseStatuses } = useReadReplicasStatusesQuery({ projectRef: ref })
@@ -289,7 +302,7 @@ export const ReplicaNode = ({ data }: NodeProps<ReplicaNodeData>) => {
<p className="text-sm text-foreground-light">{region.name}</p>
<p className="flex text-sm text-foreground-light items-center gap-x-1">
<span>{provider}</span>
- {!!computeSize && (
+ {projectHomepageShowInstanceSize && !!computeSize && (
<>
<span>•</span>
<span>{computeSize}</span>
diff --git a/apps/studio/components/interfaces/Settings/Infrastructure/InfrastructureConfiguration/MapView.tsx b/apps/studio/components/interfaces/Settings/Infrastructure/InfrastructureConfiguration/MapView.tsx
index f96afaf94b5..6140367095b 100644
--- a/apps/studio/components/interfaces/Settings/Infrastructure/InfrastructureConfiguration/MapView.tsx
+++ b/apps/studio/components/interfaces/Settings/Infrastructure/InfrastructureConfiguration/MapView.tsx
@@ -20,6 +20,7 @@ import { DropdownMenuItemTooltip } from 'components/ui/DropdownMenuItemTooltip'
import { Database, useReadReplicasQuery } from 'data/read-replicas/replicas-query'
import { formatDatabaseID } from 'data/read-replicas/replicas.utils'
import { useAsyncCheckProjectPermissions } from 'hooks/misc/useCheckPermissions'
+import { useIsFeatureEnabled } from 'hooks/misc/useIsFeatureEnabled'
import { BASE_PATH } from 'lib/constants'
import type { AWS_REGIONS_KEYS } from 'shared-data'
import { useDatabaseSelectorStateSnapshot } from 'state/database-selector'
@@ -51,6 +52,9 @@ const MapView = ({
}: MapViewProps) => {
const { ref } = useParams()
const dbSelectorState = useDatabaseSelectorStateSnapshot()
+ const { projectHomepageShowInstanceSize } = useIsFeatureEnabled([
+ 'project_homepage:show_instance_size',
+ ])
const [mount, setMount] = useState(false)
const [zoom, setZoom] = useState<number>(1.5)
@@ -286,7 +290,9 @@ const MapView = ({
<Badge variant="warning">Unhealthy</Badge>
)}
</p>
- <p className="text-xs text-foreground-light">AWS • {database.size}</p>
+ <p className="text-xs text-foreground-light">
+ AWS{projectHomepageShowInstanceSize ? ` • ${database.size}` : ''}
+ </p>
{database.identifier !== ref && (
<p className="text-xs text-foreground-light">Created on: {created}</p>
)}
diff --git a/apps/studio/components/interfaces/Settings/Logs/LogsQueryPanel.tsx b/apps/studio/components/interfaces/Settings/Logs/LogsQueryPanel.tsx
index f67aef39e04..ff2e816a347 100644
--- a/apps/studio/components/interfaces/Settings/Logs/LogsQueryPanel.tsx
+++ b/apps/studio/components/interfaces/Settings/Logs/LogsQueryPanel.tsx
@@ -58,6 +58,7 @@ const LogsQueryPanel = ({
onDateChange,
}: LogsQueryPanelProps) => {
const [showReference, setShowReference] = useState(false)
+ const { logsTemplates } = useIsFeatureEnabled(['logs:templates'])
const {
projectAuthAll: authEnabled,
@@ -125,7 +126,7 @@ const LogsQueryPanel = ({
</DropdownMenuContent>
</DropdownMenu>
- {IS_PLATFORM && (
+ {IS_PLATFORM && logsTemplates && (
<DropdownMenu>
<DropdownMenuTrigger asChild>
<Button type="default" iconRight={<ChevronDown />}>
diff --git a/apps/studio/components/layouts/AuthLayout/Auth.Commands.tsx b/apps/studio/components/layouts/AuthLayout/Auth.Commands.tsx
index d7fefeb0cb3..a062de0b9d0 100644
--- a/apps/studio/components/layouts/AuthLayout/Auth.Commands.tsx
+++ b/apps/studio/components/layouts/AuthLayout/Auth.Commands.tsx
@@ -1,15 +1,35 @@
import { Lock } from 'lucide-react'
+import { useParams } from 'common'
import { COMMAND_MENU_SECTIONS } from 'components/interfaces/App/CommandMenu/CommandMenu.utils'
+import { orderCommandSectionsByPriority } from 'components/interfaces/App/CommandMenu/ordering'
+import { useIsFeatureEnabled } from 'hooks/misc/useIsFeatureEnabled'
import type { CommandOptions } from 'ui-patterns/CommandMenu'
import { useRegisterCommands } from 'ui-patterns/CommandMenu'
-import { orderCommandSectionsByPriority } from 'components/interfaces/App/CommandMenu/ordering'
-import { useParams } from 'common'
+import { IRouteCommand } from 'ui-patterns/CommandMenu/internal/types'
export function useAuthGotoCommands(options?: CommandOptions) {
let { ref } = useParams()
ref ||= '_'
+ const {
+ authenticationSignInProviders,
+ authenticationThirdPartyAuth,
+ authenticationRateLimits,
+ authenticationEmails,
+ authenticationMultiFactor,
+ authenticationAttackProtection,
+ authenticationAdvanced,
+ } = useIsFeatureEnabled([
+ 'authentication:sign_in_providers',
+ 'authentication:third_party_auth',
+ 'authentication:rate_limits',
+ 'authentication:emails',
+ 'authentication:multi_factor',
+ 'authentication:attack_protection',
+ 'authentication:advanced',
+ ])
+
useRegisterCommands(
'Actions',
[
@@ -47,20 +67,28 @@ export function useAuthGotoCommands(options?: CommandOptions) {
route: `/project/${ref}/auth/policies`,
defaultHidden: true,
},
- {
- id: 'nav-auth-providers',
- name: 'Providers',
- value: 'Auth: Providers (Social Login, SSO)',
- route: `/project/${ref}/auth/providers`,
- defaultHidden: true,
- },
- {
- id: 'nav-auth-providers',
- name: 'Providers (Third Party)',
- value: 'Auth: Providers (Third Party)',
- route: `/project/${ref}/auth/third-party`,
- defaultHidden: true,
- },
+ ...(authenticationSignInProviders
+ ? [
+ {
+ id: 'nav-auth-providers',
+ name: 'Providers',
+ value: 'Auth: Providers (Social Login, SSO)',
+ route: `/project/${ref}/auth/providers`,
+ defaultHidden: true,
+ } as IRouteCommand,
+ ]
+ : []),
+ ...(authenticationThirdPartyAuth
+ ? [
+ {
+ id: 'nav-auth-providers',
+ name: 'Providers (Third Party)',
+ value: 'Auth: Providers (Third Party)',
+ route: `/project/${ref}/auth/third-party`,
+ defaultHidden: true,
+ } as IRouteCommand,
+ ]
+ : []),
{
id: 'nav-auth-sessions',
name: 'Sessions',
@@ -68,27 +96,39 @@ export function useAuthGotoCommands(options?: CommandOptions) {
route: `/project/${ref}/auth/sessions`,
defaultHidden: true,
},
- {
- id: 'nav-auth-rate-limits',
- name: 'Rate Limits',
- value: 'Auth: Rate Limits',
- route: `/project/${ref}/auth/rate-limits`,
- defaultHidden: true,
- },
- {
- id: 'nav-auth-templates',
- name: 'Email Templates',
- value: 'Auth: Email Templates',
- route: `/project/${ref}/auth/templates`,
- defaultHidden: true,
- },
- {
- id: 'nav-auth-mfa',
- name: 'Multi Factor Authentication (MFA)',
- value: 'Auth: Multi Factor Authenticaiton (MFA)',
- route: `/project/${ref}/auth/mfa`,
- defaultHidden: true,
- },
+ ...(authenticationRateLimits
+ ? [
+ {
+ id: 'nav-auth-rate-limits',
+ name: 'Rate Limits',
+ value: 'Auth: Rate Limits',
+ route: `/project/${ref}/auth/rate-limits`,
+ defaultHidden: true,
+ } as IRouteCommand,
+ ]
+ : []),
+ ...(authenticationEmails
+ ? [
+ {
+ id: 'nav-auth-templates',
+ name: 'Email Templates',
+ value: 'Auth: Email Templates',
+ route: `/project/${ref}/auth/templates`,
+ defaultHidden: true,
+ } as IRouteCommand,
+ ]
+ : []),
+ ...(authenticationMultiFactor
+ ? [
+ {
+ id: 'nav-auth-mfa',
+ name: 'Multi Factor Authentication (MFA)',
+ value: 'Auth: Multi Factor Authenticaiton (MFA)',
+ route: `/project/${ref}/auth/mfa`,
+ defaultHidden: true,
+ } as IRouteCommand,
+ ]
+ : []),
{
id: 'nav-auth-url-configuration',
name: 'URL Configuration',
@@ -96,13 +136,17 @@ export function useAuthGotoCommands(options?: CommandOptions) {
route: `/project/${ref}/auth/url-configuration`,
defaultHidden: true,
},
- {
- id: 'nav-auth-attack-protection',
- name: 'Attack Protection',
- value: 'Auth: Attack Protection',
- route: `/project/${ref}/auth/protection`,
- defaultHidden: true,
- },
+ ...(authenticationAttackProtection
+ ? [
+ {
+ id: 'nav-auth-attack-protection',
+ name: 'Attack Protection',
+ value: 'Auth: Attack Protection',
+ route: `/project/${ref}/auth/protection`,
+ defaultHidden: true,
+ } as IRouteCommand,
+ ]
+ : []),
{
id: 'nav-auth-auth-hooks',
name: 'Auth Hooks',
@@ -110,13 +154,17 @@ export function useAuthGotoCommands(options?: CommandOptions) {
route: `/project/${ref}/auth/hooks`,
defaultHidden: true,
},
- {
- id: 'nav-auth-advanced-settings',
- name: 'Auth Advanced Settings',
- value: 'Auth: Advanced Settings',
- route: `/project/${ref}/auth/advanced`,
- defaultHidden: true,
- },
+ ...(authenticationAdvanced
+ ? [
+ {
+ id: 'nav-auth-advanced-settings',
+ name: 'Auth Advanced Settings',
+ value: 'Auth: Advanced Settings',
+ route: `/project/${ref}/auth/advanced`,
+ defaultHidden: true,
+ } as IRouteCommand,
+ ]
+ : []),
],
{ ...options, deps: [ref] }
)
diff --git a/apps/studio/components/layouts/DatabaseLayout/Database.Commands.tsx b/apps/studio/components/layouts/DatabaseLayout/Database.Commands.tsx
index ba42375641b..3abd34af48c 100644
--- a/apps/studio/components/layouts/DatabaseLayout/Database.Commands.tsx
+++ b/apps/studio/components/layouts/DatabaseLayout/Database.Commands.tsx
@@ -1,15 +1,22 @@
import { Blocks, Code, Database, History, Search } from 'lucide-react'
+import { useParams } from 'common'
import { COMMAND_MENU_SECTIONS } from 'components/interfaces/App/CommandMenu/CommandMenu.utils'
+import { orderCommandSectionsByPriority } from 'components/interfaces/App/CommandMenu/ordering'
+import { useIsFeatureEnabled } from 'hooks/misc/useIsFeatureEnabled'
import type { CommandOptions } from 'ui-patterns/CommandMenu'
import { useRegisterCommands } from 'ui-patterns/CommandMenu'
-import { useParams } from 'common'
-import { orderCommandSectionsByPriority } from 'components/interfaces/App/CommandMenu/ordering'
+import { IRouteCommand } from 'ui-patterns/CommandMenu/internal/types'
export function useDatabaseGotoCommands(options?: CommandOptions) {
let { ref } = useParams()
ref ||= '_'
+ const { databaseReplication, databaseRoles } = useIsFeatureEnabled([
+ 'database:replication',
+ 'database:roles',
+ ])
+
useRegisterCommands(
COMMAND_MENU_SECTIONS.QUERY,
[
@@ -59,20 +66,28 @@ export function useDatabaseGotoCommands(options?: CommandOptions) {
route: `/project/${ref}/database/extensions`,
defaultHidden: true,
},
- {
- id: 'nav-database-roles',
- name: 'Roles',
- value: 'Database: Roles',
- route: `/project/${ref}/database/roles`,
- defaultHidden: true,
- },
- {
- id: 'nav-database-replication',
- name: 'Replication',
- value: 'Database: Replication',
- route: `/project/${ref}/database/replication`,
- defaultHidden: true,
- },
+ ...(databaseRoles
+ ? [
+ {
+ id: 'nav-database-roles',
+ name: 'Roles',
+ value: 'Database: Roles',
+ route: `/project/${ref}/database/roles`,
+ defaultHidden: true,
+ } as IRouteCommand,
+ ]
+ : []),
+ ...(databaseReplication
+ ? [
+ {
+ id: 'nav-database-replication',
+ name: 'Replication',
+ value: 'Database: Replication',
+ route: `/project/${ref}/database/replication`,
+ defaultHidden: true,
+ } as IRouteCommand,
+ ]
+ : []),
{
id: 'nav-database-hooks',
name: 'Webhooks',
@@ -144,12 +159,16 @@ export function useDatabaseGotoCommands(options?: CommandOptions) {
route: `/project/${ref}/database/indexes`,
icon: () => <Database />,
},
- {
- id: 'run-view-database-roles',
- name: 'View your roles',
- route: `/project/${ref}/database/roles`,
- icon: () => <Database />,
- },
+ ...(databaseRoles
+ ? [
+ {
+ id: 'run-view-database-roles',
+ name: 'View your roles',
+ route: `/project/${ref}/database/roles`,
+ icon: () => <Database />,
+ } as IRouteCommand,
+ ]
+ : []),
{
id: 'run-view-database-backups',
name: 'View your backups',
diff --git a/apps/studio/components/layouts/IntegrationsLayout/Integrations.Commands.tsx b/apps/studio/components/layouts/IntegrationsLayout/Integrations.Commands.tsx
index 0651deedf84..510407e9c72 100644
--- a/apps/studio/components/layouts/IntegrationsLayout/Integrations.Commands.tsx
+++ b/apps/studio/components/layouts/IntegrationsLayout/Integrations.Commands.tsx
@@ -5,6 +5,7 @@ import {
IntegrationDefinition,
INTEGRATIONS,
} from 'components/interfaces/Integrations/Landing/Integrations.constants'
+import { useIsFeatureEnabled } from 'hooks/misc/useIsFeatureEnabled'
import type { CommandOptions } from 'ui-patterns/CommandMenu'
import { useRegisterCommands } from 'ui-patterns/CommandMenu'
@@ -12,6 +13,14 @@ export function useIntegrationsGotoCommands(options?: CommandOptions) {
let { ref } = useParams()
ref ||= '_'
+ const { integrationsShowStripeWrapper } = useIsFeatureEnabled([
+ 'integrations:show_stripe_wrapper',
+ ])
+
+ const allIntegrations = integrationsShowStripeWrapper
+ ? INTEGRATIONS
+ : INTEGRATIONS.filter((x) => x.id !== 'stripe_wrapper')
+
const getName = (integration: IntegrationDefinition) => {
switch (integration.id) {
case 'cron':
@@ -27,7 +36,7 @@ export function useIntegrationsGotoCommands(options?: CommandOptions) {
useRegisterCommands(
COMMAND_MENU_SECTIONS.NAVIGATE,
- INTEGRATIONS.map((x) => {
+ allIntegrations.map((x) => {
return {
id: `nav-integrations-${x.id}`,
name: x.name,
@@ -41,7 +50,7 @@ export function useIntegrationsGotoCommands(options?: CommandOptions) {
useRegisterCommands(
COMMAND_MENU_SECTIONS.INTEGRATIONS,
- INTEGRATIONS.map((x) => {
+ allIntegrations.map((x) => {
return {
id: `manage-${x.id}`,
name: getName(x),
diff --git a/apps/studio/components/layouts/LogsLayout/Logs.Commands.tsx b/apps/studio/components/layouts/LogsLayout/Logs.Commands.tsx
index e302bb87400..d6fd444e8da 100644
--- a/apps/studio/components/layouts/LogsLayout/Logs.Commands.tsx
+++ b/apps/studio/components/layouts/LogsLayout/Logs.Commands.tsx
@@ -1,12 +1,16 @@
import { useParams } from 'common'
import { COMMAND_MENU_SECTIONS } from 'components/interfaces/App/CommandMenu/CommandMenu.utils'
+import { useIsFeatureEnabled } from 'hooks/misc/useIsFeatureEnabled'
import type { CommandOptions } from 'ui-patterns/CommandMenu'
import { useRegisterCommands } from 'ui-patterns/CommandMenu'
+import { IRouteCommand } from 'ui-patterns/CommandMenu/internal/types'
export function useLogsGotoCommands(options?: CommandOptions) {
let { ref } = useParams()
ref ||= '_'
+ const { logsCollections } = useIsFeatureEnabled(['logs:collections'])
+
useRegisterCommands(
COMMAND_MENU_SECTIONS.NAVIGATE,
[
@@ -16,42 +20,46 @@ export function useLogsGotoCommands(options?: CommandOptions) {
route: `/project/${ref}/logs/explorer`,
defaultHidden: true,
},
- {
- id: 'nav-logs-postgres',
- name: 'Postgres Logs',
- route: `/project/${ref}/logs/postgres-logs`,
- defaultHidden: true,
- },
- {
- id: 'nav-logs-postgrest',
- name: 'PostgREST Logs',
- route: `/project/${ref}/logs/postgrest-logs`,
- defaultHidden: true,
- },
- {
- id: 'nav-logs-pooler',
- name: 'Pooler Logs',
- route: `/project/${ref}/logs/pooler-logs`,
- defaultHidden: true,
- },
- {
- id: 'nav-logs-auth',
- name: 'Auth Logs',
- route: `/project/${ref}/logs/auth-logs`,
- defaultHidden: true,
- },
- {
- id: 'nav-logs-storage',
- name: 'Storage Logs',
- route: `/project/${ref}/logs/storage-logs`,
- defaultHidden: true,
- },
- {
- id: 'nav-logs-realtime',
- name: 'Realtime Logs',
- route: `/project/${ref}/logs/realtime-logs`,
- defaultHidden: true,
- },
+ ...(logsCollections
+ ? ([
+ {
+ id: 'nav-logs-postgres',
+ name: 'Postgres Logs',
+ route: `/project/${ref}/logs/postgres-logs`,
+ defaultHidden: true,
+ },
+ {
+ id: 'nav-logs-postgrest',
+ name: 'PostgREST Logs',
+ route: `/project/${ref}/logs/postgrest-logs`,
+ defaultHidden: true,
+ },
+ {
+ id: 'nav-logs-pooler',
+ name: 'Pooler Logs',
+ route: `/project/${ref}/logs/pooler-logs`,
+ defaultHidden: true,
+ },
+ {
+ id: 'nav-logs-auth',
+ name: 'Auth Logs',
+ route: `/project/${ref}/logs/auth-logs`,
+ defaultHidden: true,
+ },
+ {
+ id: 'nav-logs-storage',
+ name: 'Storage Logs',
+ route: `/project/${ref}/logs/storage-logs`,
+ defaultHidden: true,
+ },
+ {
+ id: 'nav-logs-realtime',
+ name: 'Realtime Logs',
+ route: `/project/${ref}/logs/realtime-logs`,
+ defaultHidden: true,
+ },
+ ] as IRouteCommand[])
+ : []),
],
{ ...options, deps: [ref] }
)
diff --git a/apps/studio/components/layouts/ProjectSettingsLayout/ProjectSettings.Commands.tsx b/apps/studio/components/layouts/ProjectSettingsLayout/ProjectSettings.Commands.tsx
index 0a8b062f3f9..3710a00b12b 100644
--- a/apps/studio/components/layouts/ProjectSettingsLayout/ProjectSettings.Commands.tsx
+++ b/apps/studio/components/layouts/ProjectSettingsLayout/ProjectSettings.Commands.tsx
@@ -1,12 +1,21 @@
import { useParams } from 'common'
import { COMMAND_MENU_SECTIONS } from 'components/interfaces/App/CommandMenu/CommandMenu.utils'
+import { useIsFeatureEnabled } from 'hooks/misc/useIsFeatureEnabled'
import type { CommandOptions } from 'ui-patterns/CommandMenu'
import { useRegisterCommands } from 'ui-patterns/CommandMenu'
+import { IRouteCommand } from 'ui-patterns/CommandMenu/internal/types'
export function useProjectSettingsGotoCommands(options?: CommandOptions) {
let { ref } = useParams()
ref ||= '_'
+ const { projectSettingsLogDrains, projectSettingsCustomDomains, authenticationSignInProviders } =
+ useIsFeatureEnabled([
+ 'project_settings:log_drains',
+ 'project_settings:custom_domains',
+ 'authentication:sign_in_providers',
+ ])
+
useRegisterCommands(
COMMAND_MENU_SECTIONS.NAVIGATE,
[
@@ -25,7 +34,9 @@ export function useProjectSettingsGotoCommands(options?: CommandOptions) {
{
id: 'nav-project-settings-auth',
name: 'Auth Settings',
- route: `/project/${ref}/auth/providers`,
+ route: authenticationSignInProviders
+ ? `/project/${ref}/auth/providers`
+ : `/project/${ref}/auth/policies`,
defaultHidden: true,
},
{
@@ -40,12 +51,16 @@ export function useProjectSettingsGotoCommands(options?: CommandOptions) {
route: `/project/${ref}/storage/settings`,
defaultHidden: true,
},
- {
- id: 'nav-project-settings-custom-domains',
- name: 'Custom Domains',
- route: `/project/${ref}/settings/general#custom-domains`,
- defaultHidden: true,
- },
+ ...(projectSettingsCustomDomains
+ ? [
+ {
+ id: 'nav-project-settings-custom-domains',
+ name: 'Custom Domains',
+ route: `/project/${ref}/settings/general#custom-domains`,
+ defaultHidden: true,
+ } as IRouteCommand,
+ ]
+ : []),
{
id: 'nav-project-settings-restart-project',
name: 'Restart project',
@@ -106,12 +121,16 @@ export function useProjectSettingsGotoCommands(options?: CommandOptions) {
route: `/project/${ref}/database/settings#banned-ips`,
defaultHidden: true,
},
- {
- id: 'nav-project-settings-log-drains',
- name: 'Log drains',
- route: `/project/${ref}/settings/log-drains`,
- defaultHidden: true,
- },
+ ...(projectSettingsLogDrains
+ ? [
+ {
+ id: 'nav-project-settings-log-drains',
+ name: 'Log drains',
+ route: `/project/${ref}/settings/log-drains`,
+ defaultHidden: true,
+ } as IRouteCommand,
+ ]
+ : []),
],
{ ...options, deps: [ref] }
)
diff --git a/apps/studio/components/layouts/ProjectSettingsLayout/SettingsMenu.utils.tsx b/apps/studio/components/layouts/ProjectSettingsLayout/SettingsMenu.utils.tsx
index ceb8c60d8c9..b4a6b32e9fb 100644
--- a/apps/studio/components/layouts/ProjectSettingsLayout/SettingsMenu.utils.tsx
+++ b/apps/studio/components/layouts/ProjectSettingsLayout/SettingsMenu.utils.tsx
@@ -128,7 +128,7 @@ export const generateSettingsMenu = (
{
name: 'Authentication',
key: 'auth',
- url: `/project/${ref}/auth/policies`,
+ url: `/project/${ref}/auth/providers`,
items: [],
rightIcon: <ArrowUpRight strokeWidth={1} className="h-4 w-4" />,
},
diff --git a/apps/studio/components/layouts/ReportsLayout/Reports.Commands.tsx b/apps/studio/components/layouts/ReportsLayout/Reports.Commands.tsx
index 22317d162f4..e1bc9f7b152 100644
--- a/apps/studio/components/layouts/ReportsLayout/Reports.Commands.tsx
+++ b/apps/studio/components/layouts/ReportsLayout/Reports.Commands.tsx
@@ -1,5 +1,6 @@
import { useParams } from 'common'
import { COMMAND_MENU_SECTIONS } from 'components/interfaces/App/CommandMenu/CommandMenu.utils'
+import { useIsFeatureEnabled } from 'hooks/misc/useIsFeatureEnabled'
import type { CommandOptions } from 'ui-patterns/CommandMenu'
import { useRegisterCommands } from 'ui-patterns/CommandMenu'
@@ -7,40 +8,44 @@ export function useReportsGotoCommands(options?: CommandOptions) {
let { ref } = useParams()
ref ||= '_'
+ const { reportsAll } = useIsFeatureEnabled(['reports:all'])
+
useRegisterCommands(
COMMAND_MENU_SECTIONS.NAVIGATE,
- [
- {
- id: 'nav-reports',
- name: 'Reports',
- route: `/project/${ref}/reports`,
- defaultHidden: true,
- },
- {
- id: 'nav-reports-api',
- name: 'API Reports',
- route: `/project/${ref}/reports/api-overview`,
- defaultHidden: true,
- },
- {
- id: 'nav-reports-storage',
- name: 'Storage Reports',
- route: `/project/${ref}/reports/storage`,
- defaultHidden: true,
- },
- {
- id: 'nav-reports-database',
- name: 'Database Reports',
- route: `/project/${ref}/reports/database`,
- defaultHidden: true,
- },
- {
- id: 'nav-reports-query-performance',
- name: 'Query Performance Reports',
- route: `/project/${ref}/reports/query-performance`,
- defaultHidden: true,
- },
- ],
+ reportsAll
+ ? [
+ {
+ id: 'nav-reports',
+ name: 'Reports',
+ route: `/project/${ref}/reports`,
+ defaultHidden: true,
+ },
+ {
+ id: 'nav-reports-api',
+ name: 'API Reports',
+ route: `/project/${ref}/reports/api-overview`,
+ defaultHidden: true,
+ },
+ {
+ id: 'nav-reports-storage',
+ name: 'Storage Reports',
+ route: `/project/${ref}/reports/storage`,
+ defaultHidden: true,
+ },
+ {
+ id: 'nav-reports-database',
+ name: 'Database Reports',
+ route: `/project/${ref}/reports/database`,
+ defaultHidden: true,
+ },
+ {
+ id: 'nav-reports-query-performance',
+ name: 'Query Performance Reports',
+ route: `/project/${ref}/reports/query-performance`,
+ defaultHidden: true,
+ },
+ ]
+ : [],
{ ...options, deps: [ref] }
)
}
diff --git a/apps/studio/components/ui/ProjectSettings/DisplayApiSettings.tsx b/apps/studio/components/ui/ProjectSettings/DisplayApiSettings.tsx
index b9f456d02b1..0ef28a3426f 100644
--- a/apps/studio/components/ui/ProjectSettings/DisplayApiSettings.tsx
+++ b/apps/studio/components/ui/ProjectSettings/DisplayApiSettings.tsx
@@ -10,10 +10,8 @@ import Panel from 'components/ui/Panel'
import { useJwtSecretUpdatingStatusQuery } from 'data/config/jwt-secret-updating-status-query'
import { useProjectSettingsV2Query } from 'data/config/project-settings-v2-query'
import { useAsyncCheckProjectPermissions } from 'hooks/misc/useCheckPermissions'
-import { useIsFeatureEnabled } from 'hooks/misc/useIsFeatureEnabled'
import { Input } from 'ui'
import { getLastUsedAPIKeys, useLastUsedAPIKeysLogQuery } from './DisplayApiSettings.utils'
-import { ToggleLegacyApiKeysPanel } from './ToggleLegacyApiKeys'
export const DisplayApiSettings = ({
showTitle = true,
@@ -25,9 +23,6 @@ export const DisplayApiSettings = ({
showLegacyText?: boolean
}) => {
const { ref: projectRef } = useParams()
- const { projectSettingsShowDisableLegacyApiKeys } = useIsFeatureEnabled([
- 'project_settings:show_disable_legacy_api_keys',
- ])
const {
data: settings,
@@ -74,151 +69,145 @@ export const DisplayApiSettings = ({
}, [lastUsedLogData, apiKeys])
return (
- <>
- <Panel
- noMargin
- title={
- showTitle && (
- <div className="space-y-3">
- <h5 className="text-base">Project API Keys</h5>
- <p className="text-sm text-foreground-light">
- Your API is secured behind an API gateway which requires an API Key for every
- request.
- <br />
- You can use the keys below in the Supabase client libraries.
- <br />
- </p>
- </div>
- )
- }
- >
- {isLoading ? (
- <div className="flex items-center justify-center py-8 space-x-2">
- <Loader2 className="animate-spin" size={16} strokeWidth={1.5} />
- <p className="text-sm text-foreground-light">Retrieving API keys</p>
- </div>
- ) : !canReadAPIKeys ? (
- <div className="flex items-center py-8 px-8 space-x-2">
- <AlertCircle size={16} strokeWidth={1.5} />
+ <Panel
+ noMargin
+ title={
+ showTitle && (
+ <div className="space-y-3">
+ <h5 className="text-base">Project API Keys</h5>
<p className="text-sm text-foreground-light">
- You don't have permission to view API keys. These keys restricted to users with higher
- access levels.
+ Your API is secured behind an API gateway which requires an API Key for every request.
+ <br />
+ You can use the keys below in the Supabase client libraries.
+ <br />
</p>
</div>
- ) : isProjectSettingsError || isJwtSecretUpdateStatusError ? (
- <div className="flex items-center justify-center py-8 space-x-2">
- <AlertCircle size={16} strokeWidth={1.5} />
- <p className="text-sm text-foreground-light">
- {isProjectSettingsError
- ? 'Failed to retrieve API keys'
- : 'Failed to update JWT secret'}
- </p>
- </div>
- ) : isApiKeysEmpty || isProjectSettingsLoading || isJwtSecretUpdateStatusLoading ? (
- <div className="flex items-center justify-center py-8 space-x-2">
- <Loader2 className="animate-spin" size={16} strokeWidth={1.5} />
- <p className="text-sm text-foreground-light">
- {isProjectSettingsLoading || isApiKeysEmpty
- ? 'Retrieving API keys'
- : 'JWT secret is being updated'}
- </p>
- </div>
- ) : (
- apiKeys.map((x, i: number) => (
- <Panel.Content
- key={x.api_key}
- className={
- i >= 1 &&
- 'border-t border-panel-border-interior-light [[data-theme*=dark]_&]:border-panel-border-interior-dark'
+ )
+ }
+ >
+ {isLoading ? (
+ <div className="flex items-center justify-center py-8 space-x-2">
+ <Loader2 className="animate-spin" size={16} strokeWidth={1.5} />
+ <p className="text-sm text-foreground-light">Retrieving API keys</p>
+ </div>
+ ) : !canReadAPIKeys ? (
+ <div className="flex items-center py-8 px-8 space-x-2">
+ <AlertCircle size={16} strokeWidth={1.5} />
+ <p className="text-sm text-foreground-light">
+ You don't have permission to view API keys. These keys restricted to users with higher
+ access levels.
+ </p>
+ </div>
+ ) : isProjectSettingsError || isJwtSecretUpdateStatusError ? (
+ <div className="flex items-center justify-center py-8 space-x-2">
+ <AlertCircle size={16} strokeWidth={1.5} />
+ <p className="text-sm text-foreground-light">
+ {isProjectSettingsError ? 'Failed to retrieve API keys' : 'Failed to update JWT secret'}
+ </p>
+ </div>
+ ) : isApiKeysEmpty || isProjectSettingsLoading || isJwtSecretUpdateStatusLoading ? (
+ <div className="flex items-center justify-center py-8 space-x-2">
+ <Loader2 className="animate-spin" size={16} strokeWidth={1.5} />
+ <p className="text-sm text-foreground-light">
+ {isProjectSettingsLoading || isApiKeysEmpty
+ ? 'Retrieving API keys'
+ : 'JWT secret is being updated'}
+ </p>
+ </div>
+ ) : (
+ apiKeys.map((x, i: number) => (
+ <Panel.Content
+ key={x.api_key}
+ className={
+ i >= 1 &&
+ 'border-t border-panel-border-interior-light [[data-theme*=dark]_&]:border-panel-border-interior-dark'
+ }
+ >
+ <Input
+ readOnly
+ disabled
+ layout="horizontal"
+ className="input-mono"
+ // @ts-ignore
+ label={
+ <>
+ {x.tags?.split(',').map((x, i: number) => (
+ <code key={`${x}${i}`} className="text-xs text-code">
+ {x}
+ </code>
+ ))}
+ {x.tags === 'service_role' && (
+ <>
+ <code className="text-xs text-code !bg-destructive !text-white !border-destructive">
+ secret
+ </code>
+ </>
+ )}
+ {x.tags === 'anon' && <code className="text-xs text-code">public</code>}
+ </>
}
- >
- <Input
- readOnly
- disabled
- layout="horizontal"
- className="input-mono"
- // @ts-ignore
- label={
+ copy={canReadAPIKeys && isNotUpdatingJwtSecret}
+ reveal={x.tags !== 'anon' && canReadAPIKeys && isNotUpdatingJwtSecret}
+ value={
+ !canReadAPIKeys
+ ? 'You need additional permissions to view API keys'
+ : jwtSecretUpdateStatus === JwtSecretUpdateStatus.Failed
+ ? 'JWT secret update failed, new API key may have issues'
+ : jwtSecretUpdateStatus === JwtSecretUpdateStatus.Updating
+ ? 'Updating JWT secret...'
+ : x?.api_key ?? 'You need additional permissions to view API keys'
+ }
+ onChange={() => {}}
+ descriptionText={
+ x.tags === 'service_role' ? (
<>
- {x.tags?.split(',').map((x, i: number) => (
- <code key={`${x}${i}`} className="text-xs text-code">
- {x}
- </code>
- ))}
- {x.tags === 'service_role' && (
- <>
- <code className="text-xs text-code !bg-destructive !text-white !border-destructive">
- secret
- </code>
- </>
+ This key has the ability to bypass Row Level Security. Never share it publicly.
+ If leaked, generate a new JWT secret immediately.{' '}
+ {showLegacyText && (
+ <span>
+ Prefer using{' '}
+ <Link
+ href={`/project/${projectRef}/settings/api-keys/new`}
+ className="text-link underline"
+ >
+ Secret API keys
+ </Link>{' '}
+ instead.
+ </span>
)}
- {x.tags === 'anon' && <code className="text-xs text-code">public</code>}
</>
- }
- copy={canReadAPIKeys && isNotUpdatingJwtSecret}
- reveal={x.tags !== 'anon' && canReadAPIKeys && isNotUpdatingJwtSecret}
- value={
- !canReadAPIKeys
- ? 'You need additional permissions to view API keys'
- : jwtSecretUpdateStatus === JwtSecretUpdateStatus.Failed
- ? 'JWT secret update failed, new API key may have issues'
- : jwtSecretUpdateStatus === JwtSecretUpdateStatus.Updating
- ? 'Updating JWT secret...'
- : x?.api_key ?? 'You need additional permissions to view API keys'
- }
- onChange={() => {}}
- descriptionText={
- x.tags === 'service_role' ? (
- <>
- This key has the ability to bypass Row Level Security. Never share it
- publicly. If leaked, generate a new JWT secret immediately.{' '}
- {showLegacyText && (
- <span>
- Prefer using{' '}
- <Link
- href={`/project/${projectRef}/settings/api-keys/new`}
- className="text-link underline"
- >
- Secret API keys
- </Link>{' '}
- instead.
- </span>
- )}
- </>
- ) : (
- <>
- This key is safe to use in a browser if you have enabled Row Level Security
- for your tables and configured policies.{' '}
- {showLegacyText && (
- <span>
- Prefer using{' '}
- <Link
- href={`/project/${projectRef}/settings/api-keys/new`}
- className="text-link underline"
- >
- Publishable API keys
- </Link>{' '}
- instead.
- </span>
- )}
- </>
- )
- }
- />
-
- <div
- className="pt-2 text-foreground-lighter w-full text-sm data-[invisible=true]:invisible"
- data-invisible={isLoadingLastUsed}
- >
- {lastUsedAPIKeys[x.api_key]
- ? `Last request was ${lastUsedAPIKeys[x.api_key]} ago.`
- : 'No requests in the past 24 hours.'}
- </div>
- </Panel.Content>
- ))
- )}
- </Panel>
+ ) : (
+ <>
+ This key is safe to use in a browser if you have enabled Row Level Security for
+ your tables and configured policies.{' '}
+ {showLegacyText && (
+ <span>
+ Prefer using{' '}
+ <Link
+ href={`/project/${projectRef}/settings/api-keys/new`}
+ className="text-link underline"
+ >
+ Publishable API keys
+ </Link>{' '}
+ instead.
+ </span>
+ )}
+ </>
+ )
+ }
+ />
+ <div
+ className="pt-2 text-foreground-lighter w-full text-sm data-[invisible=true]:invisible"
+ data-invisible={isLoadingLastUsed}
+ >
+ {lastUsedAPIKeys[x.api_key]
+ ? `Last request was ${lastUsedAPIKeys[x.api_key]} ago.`
+ : 'No requests in the past 24 hours.'}
+ </div>
+ </Panel.Content>
+ ))
+ )}
{showNotice ? (
<Panel.Notice
className="border-t"
@@ -230,9 +219,7 @@ export const DisplayApiSettings = ({
href="https://github.com/orgs/supabase/discussions/29260"
buttonText="Read the announcement"
/>
- ) : projectSettingsShowDisableLegacyApiKeys ? (
- <ToggleLegacyApiKeysPanel />
) : null}
- </>
+ </Panel>
)
}
diff --git a/apps/studio/pages/project/[ref]/settings/api-keys/index.tsx b/apps/studio/pages/project/[ref]/settings/api-keys/index.tsx
index 89db964ba92..adb2080fe26 100644
--- a/apps/studio/pages/project/[ref]/settings/api-keys/index.tsx
+++ b/apps/studio/pages/project/[ref]/settings/api-keys/index.tsx
@@ -2,10 +2,21 @@ import ApiKeysLayout from 'components/layouts/APIKeys/APIKeysLayout'
import DefaultLayout from 'components/layouts/DefaultLayout'
import SettingsLayout from 'components/layouts/ProjectSettingsLayout/SettingsLayout'
import { DisplayApiSettings } from 'components/ui/ProjectSettings'
+import { ToggleLegacyApiKeysPanel } from 'components/ui/ProjectSettings/ToggleLegacyApiKeys'
+import { useIsFeatureEnabled } from 'hooks/misc/useIsFeatureEnabled'
import type { NextPageWithLayout } from 'types'
const ApiKeysLegacyPage: NextPageWithLayout = () => {
- return <DisplayApiSettings showTitle={false} showNotice={false} />
+ const { projectSettingsShowDisableLegacyApiKeys } = useIsFeatureEnabled([
+ 'project_settings:show_disable_legacy_api_keys',
+ ])
+
+ return (
+ <>
+ <DisplayApiSettings showTitle={false} showNotice={false} />
+ {projectSettingsShowDisableLegacyApiKeys && <ToggleLegacyApiKeysPanel />}
+ </>
+ )
}
ApiKeysLegacyPage.getLayout = (page) => (
diff --git a/packages/common/enabled-features/enabled-features.schema.json b/packages/common/enabled-features/enabled-features.schema.json
index f75bab7b4b5..0e979da780c 100644
--- a/packages/common/enabled-features/enabled-features.schema.json
+++ b/packages/common/enabled-features/enabled-features.schema.json
@@ -132,7 +132,7 @@
"project_connection:javascript_example": {
"type": "boolean",
- "description": "Show the javascript example in the project connection settings"
+ "description": "Show the javascript example in the project connection settings. If off, it'll show up as Typescript example instead (both are the same code example)"
},
"project_connection:dart_example": {
"type": "boolean",
@@ -146,7 +146,7 @@
"project_homepage:show_instance_size": {
"type": "boolean",
- "description": "Show the instance size badge in the project homepage"
+ "description": "Show the instance size badge in the project homepage and infrastructure settings"
},
"project_homepage:show_examples": {
"type": "boolean",