Skip to content

Commit 7b1ac2a

Browse files
authored
Chore/disable more sections 04 (supabase#38064)
* Add flags for policies, third party auth, and manual linking + providers in sign in page * Add flag for rate limitm page * Add UnknownInterface components * Update comment * Flip flags to true * Add flags for realtime policies and reports page * Temp * Add flag for sign in providers page * Add flag for stripe wrapper * Add flag for custom domains * Add flag for dedicated ipv4 address addon * Add empty state for realtime policies * Add empty state for reports page * Add flag for disable legacy JWT keys section * Add flag for legacy jwt keys * nit * Remove ConnectionStringMoved call out * Add flag for project settings log drains * Add flag for subscription link in project settings * Deprecate settings/auth page and redirect directly to auth page * Flip back flags * Add flags for account preferences analytics marketing and account deleetion * Remove 'table_editor:enable_rls_toggle' flag and revert UI changes * Remove 'authentication:policies' flag and revert UI changes * Add flags for cmd K routes * Add flags for instance size in infra settings * Small refactor to DisplayApiSettings, decouple ToggleLegacyApiKeysPanel from it * Have project_connection:javascript_example toggle code example title to TS * add flag for templates dropdown in logs explorer * UsesOverview only show link to providers page if providers is enabled * API Docs UserManagement to only include docs on third party auth if providers is enabled * Hide instance size on project card if flag is off * Fix cmd k for roles, update redirect link from settings/auth to auth/providers
1 parent 312e9fd commit 7b1ac2a

File tree

19 files changed

+548
-390
lines changed

19 files changed

+548
-390
lines changed

apps/studio/components/interfaces/Auth/Users/UserOverview.tsx

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import { useUserSendOTPMutation } from 'data/auth/user-send-otp-mutation'
1616
import { useUserUpdateMutation } from 'data/auth/user-update-mutation'
1717
import { User } from 'data/auth/users-infinite-query'
1818
import { useAsyncCheckProjectPermissions } from 'hooks/misc/useCheckPermissions'
19+
import { useIsFeatureEnabled } from 'hooks/misc/useIsFeatureEnabled'
1920
import { BASE_PATH } from 'lib/constants'
2021
import { timeout } from 'lib/helpers'
2122
import { Button, cn, Separator } from 'ui'
@@ -45,6 +46,10 @@ export const UserOverview = ({ user, onDeleteSuccess }: UserOverviewProps) => {
4546
const isPhoneAuth = user.phone !== null
4647
const isBanned = user.banned_until !== null
4748

49+
const { authenticationSignInProviders } = useIsFeatureEnabled([
50+
'authentication:sign_in_providers',
51+
])
52+
4853
const providers = ((user.raw_app_meta_data?.providers as string[]) ?? []).map(
4954
(provider: string) => {
5055
return {
@@ -238,13 +243,15 @@ export const UserOverview = ({ user, onDeleteSuccess }: UserOverviewProps) => {
238243
Signed in with a {providerName} account via{' '}
239244
{providerName === 'SAML' ? 'SSO' : 'OAuth'}
240245
</p>
241-
<Button asChild type="default" className="mt-2">
242-
<Link
243-
href={`/project/${projectRef}/auth/providers?provider=${provider.name === 'SAML' ? 'SAML 2.0' : provider.name}`}
244-
>
245-
Configure {providerName} provider
246-
</Link>
247-
</Button>
246+
{authenticationSignInProviders && (
247+
<Button asChild type="default" className="mt-2">
248+
<Link
249+
href={`/project/${projectRef}/auth/providers?provider=${provider.name === 'SAML' ? 'SAML 2.0' : provider.name}`}
250+
>
251+
Configure {providerName} provider
252+
</Link>
253+
</Button>
254+
)}
248255
</div>
249256
{isActive ? (
250257
<div className="flex items-center gap-1 rounded-full border border-brand-400 bg-brand-200 py-1 px-1 text-xs text-brand">

apps/studio/components/interfaces/Docs/GeneralContent.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import Authentication from 'components/interfaces/Docs/Authentication'
22
import Introduction from 'components/interfaces/Docs/Introduction'
33
import RpcIntroduction from 'components/interfaces/Docs/Pages/Rpc/Introduction'
44
import TablesIntroduction from 'components/interfaces/Docs/Pages/Tables/Introduction'
5-
import UserManagement from 'components/interfaces/Docs/Pages/UserManagement'
5+
import { UserManagement } from 'components/interfaces/Docs/Pages/UserManagement'
66

77
interface GeneralContentProps {
88
page?: string

apps/studio/components/interfaces/Docs/Pages/UserManagement.tsx

Lines changed: 80 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { useRouter } from 'next/router'
33

44
import { useParams } from 'common'
55
import { useProjectSettingsV2Query } from 'data/config/project-settings-v2-query'
6+
import { useIsFeatureEnabled } from 'hooks/misc/useIsFeatureEnabled'
67
import { makeRandomString } from 'lib/helpers'
78
import CodeSnippet from '../CodeSnippet'
89
import Snippets from '../Snippets'
@@ -14,11 +15,15 @@ interface UserManagementProps {
1415
showApiKey: string
1516
}
1617

17-
export default function UserManagement({ selectedLang, showApiKey }: UserManagementProps) {
18+
export const UserManagement = ({ selectedLang, showApiKey }: UserManagementProps) => {
1819
const router = useRouter()
1920
const { ref: projectRef } = useParams()
2021
const keyToShow = showApiKey ? showApiKey : 'SUPABASE_KEY'
2122

23+
const { authenticationSignInProviders } = useIsFeatureEnabled([
24+
'authentication:sign_in_providers',
25+
])
26+
2227
const { data: settings } = useProjectSettingsV2Query({ projectRef })
2328
const protocol = settings?.app_config?.protocol ?? 'https'
2429
const hostEndpoint = settings?.app_config?.endpoint ?? ''
@@ -157,72 +162,80 @@ export default function UserManagement({ selectedLang, showApiKey }: UserManagem
157162
</article>
158163
</div>
159164

160-
<h2 className="doc-heading">Log in with Third Party OAuth</h2>
161-
<div className="doc-section ">
162-
<article className="code-column text-foreground">
163-
<p>
164-
Users can log in with Third Party OAuth like Google, Facebook, GitHub, and more. You
165-
must first enable each of these in the Auth Providers settings{' '}
166-
<span className="text-green-500">
167-
<Link key={'AUTH'} href={`/project/${router.query.ref}/auth/providers`}>
168-
here
169-
</Link>
170-
</span>{' '}
171-
.
172-
</p>
173-
<p>
174-
View all the available{' '}
175-
<a
176-
href="https://supabase.com/docs/guides/auth#providers"
177-
target="_blank"
178-
rel="noreferrer"
179-
>
180-
Third Party OAuth providers
181-
</a>
182-
</p>
183-
<p>
184-
After they have logged in, all interactions using the Supabase JS client will be
185-
performed as "that user".
186-
</p>
187-
<p>
188-
Generate your Client ID and secret from:{` `}
189-
<a
190-
href="https://console.developers.google.com/apis/credentials"
191-
target="_blank"
192-
rel="noreferrer"
193-
>
194-
Google
195-
</a>
196-
,{` `}
197-
<a href="https://github.com/settings/applications/new" target="_blank" rel="noreferrer">
198-
GitHub
199-
</a>
200-
,{` `}
201-
<a href="https://gitlab.com/oauth/applications" target="_blank" rel="noreferrer">
202-
GitLab
203-
</a>
204-
,{` `}
205-
<a href="https://developers.facebook.com/apps/" target="_blank" rel="noreferrer">
206-
Facebook
207-
</a>
208-
,{` `}
209-
<a
210-
href="https://support.atlassian.com/bitbucket-cloud/docs/use-oauth-on-bitbucket-cloud/"
211-
target="_blank"
212-
rel="noreferrer"
213-
>
214-
Bitbucket
215-
</a>
216-
.
217-
</p>
218-
</article>
219-
<article className="code">
220-
<CodeSnippet
221-
selectedLang={selectedLang}
222-
snippet={Snippets.authThirdPartyLogin(endpoint, keyToShow)}
223-
/>
224-
</article>
225-
</div>
165+
{authenticationSignInProviders && (
166+
<>
167+
<h2 className="doc-heading">Log in with Third Party OAuth</h2>
168+
<div className="doc-section ">
169+
<article className="code-column text-foreground">
170+
<p>
171+
Users can log in with Third Party OAuth like Google, Facebook, GitHub, and more. You
172+
must first enable each of these in the Auth Providers settings{' '}
173+
<span className="text-green-500">
174+
<Link key={'AUTH'} href={`/project/${router.query.ref}/auth/providers`}>
175+
here
176+
</Link>
177+
</span>{' '}
178+
.
179+
</p>
180+
<p>
181+
View all the available{' '}
182+
<a
183+
href="https://supabase.com/docs/guides/auth#providers"
184+
target="_blank"
185+
rel="noreferrer"
186+
>
187+
Third Party OAuth providers
188+
</a>
189+
</p>
190+
<p>
191+
After they have logged in, all interactions using the Supabase JS client will be
192+
performed as "that user".
193+
</p>
194+
<p>
195+
Generate your Client ID and secret from:{` `}
196+
<a
197+
href="https://console.developers.google.com/apis/credentials"
198+
target="_blank"
199+
rel="noreferrer"
200+
>
201+
Google
202+
</a>
203+
,{` `}
204+
<a
205+
href="https://github.com/settings/applications/new"
206+
target="_blank"
207+
rel="noreferrer"
208+
>
209+
GitHub
210+
</a>
211+
,{` `}
212+
<a href="https://gitlab.com/oauth/applications" target="_blank" rel="noreferrer">
213+
GitLab
214+
</a>
215+
,{` `}
216+
<a href="https://developers.facebook.com/apps/" target="_blank" rel="noreferrer">
217+
Facebook
218+
</a>
219+
,{` `}
220+
<a
221+
href="https://support.atlassian.com/bitbucket-cloud/docs/use-oauth-on-bitbucket-cloud/"
222+
target="_blank"
223+
rel="noreferrer"
224+
>
225+
Bitbucket
226+
</a>
227+
.
228+
</p>
229+
</article>
230+
<article className="code">
231+
<CodeSnippet
232+
selectedLang={selectedLang}
233+
snippet={Snippets.authThirdPartyLogin(endpoint, keyToShow)}
234+
/>
235+
</article>
236+
</div>
237+
</>
238+
)}
226239

227240
<h2 className="doc-heading">User</h2>
228241
<div className="doc-section ">

apps/studio/components/interfaces/Home/NewProjectPanel/APIKeys.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,10 @@ export const APIKeys = () => {
4242
])
4343

4444
const availableLanguages = [
45-
...(javascriptExampleEnabled ? [{ name: 'Javascript', key: 'js' }] : []),
45+
{
46+
name: javascriptExampleEnabled ? 'Javascript' : 'Typescript',
47+
key: 'js',
48+
},
4649
...(dartExampleEnabled ? [{ name: 'Dart', key: 'dart' }] : []),
4750
]
4851
const [selectedLanguage, setSelectedLanguage] = useState(availableLanguages[0])

apps/studio/components/interfaces/Home/ProjectList/ProjectCard.tsx

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import type { IntegrationProjectConnection } from 'data/integrations/integration
66
import { ProjectIndexPageLink } from 'data/prefetchers/project.$ref'
77
import type { ProjectInfo } from 'data/projects/projects-query'
88
import type { ResourceWarning } from 'data/usage/resource-warnings-query'
9+
import { useIsFeatureEnabled } from 'hooks/misc/useIsFeatureEnabled'
910
import { BASE_PATH } from 'lib/constants'
1011
import InlineSVG from 'react-inlinesvg'
1112
import { inferProjectStatus } from './ProjectCard.utils'
@@ -29,6 +30,10 @@ const ProjectCard = ({
2930
const { name, ref: projectRef } = project
3031
const desc = `${project.cloud_provider} | ${project.region}`
3132

33+
const { projectHomepageShowInstanceSize } = useIsFeatureEnabled([
34+
'project_homepage:show_instance_size',
35+
])
36+
3237
const isBranchingEnabled = project.preview_branch_refs?.length > 0
3338
const isGithubIntegrated = githubIntegration !== undefined
3439
const isVercelIntegrated = vercelIntegration !== undefined
@@ -45,7 +50,9 @@ const ProjectCard = ({
4550
<p className="flex-shrink truncate text-sm pr-4">{name}</p>
4651
<span className="text-sm lowercase text-foreground-light">{desc}</span>
4752
<div className="flex items-center gap-x-1.5">
48-
{project.status !== 'INACTIVE' && <ComputeBadgeWrapper project={project} />}
53+
{project.status !== 'INACTIVE' && projectHomepageShowInstanceSize && (
54+
<ComputeBadgeWrapper project={project} />
55+
)}
4956
{isVercelIntegrated && (
5057
<div className="w-fit p-1 border rounded-md flex items-center text-black dark:text-white">
5158
<InlineSVG

apps/studio/components/interfaces/Integrations/Landing/AvailableIntegrations.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@ const CATEGORIES = [
1818
] as const
1919

2020
export const AvailableIntegrations = () => {
21-
const showStripeWrapper = useIsFeatureEnabled('integrations:show_stripe_wrapper')
21+
const { integrationsShowStripeWrapper } = useIsFeatureEnabled([
22+
'integrations:show_stripe_wrapper',
23+
])
2224

2325
const [selectedCategory, setSelectedCategory] = useQueryState(
2426
'category',
@@ -41,7 +43,7 @@ export const AvailableIntegrations = () => {
4143
const installedIds = installedIntegrations.map((i) => i.id)
4244

4345
// available integrations for install
44-
const availableIntegrations = showStripeWrapper
46+
const availableIntegrations = integrationsShowStripeWrapper
4547
? allIntegrations
4648
: allIntegrations.filter((x) => x.id !== 'stripe_wrapper')
4749
const integrationsByCategory =

apps/studio/components/interfaces/Settings/Infrastructure/InfrastructureConfiguration/InstanceNode.tsx

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import {
1515
} from 'data/read-replicas/replicas-status-query'
1616
import { formatDatabaseID } from 'data/read-replicas/replicas.utils'
1717
import { useAsyncCheckProjectPermissions } from 'hooks/misc/useCheckPermissions'
18+
import { useIsFeatureEnabled } from 'hooks/misc/useIsFeatureEnabled'
1819
import { BASE_PATH } from 'lib/constants'
1920
import { useDatabaseSelectorStateSnapshot } from 'state/database-selector'
2021
import {
@@ -44,7 +45,7 @@ interface NodeData {
4445
id: string
4546
provider: string
4647
region: Region
47-
computeSize: string
48+
computeSize?: string
4849
status: string
4950
inserted_at: string
5051
}
@@ -109,6 +110,10 @@ export const PrimaryNode = ({ data }: NodeProps<PrimaryNodeData>) => {
109110
// [Joshen] Just FYI Handles cannot be conditionally rendered
110111
const { provider, region, computeSize, numReplicas, numRegions, hasLoadBalancer } = data
111112

113+
const { projectHomepageShowInstanceSize } = useIsFeatureEnabled([
114+
'project_homepage:show_instance_size',
115+
])
116+
112117
return (
113118
<>
114119
<Handle
@@ -133,8 +138,12 @@ export const PrimaryNode = ({ data }: NodeProps<PrimaryNodeData>) => {
133138
</p>
134139
<p className="flex items-center gap-x-1">
135140
<span className="text-sm text-foreground-light">{provider}</span>
136-
<span className="text-sm text-foreground-light"></span>
137-
<span className="text-sm text-foreground-light">{computeSize}</span>
141+
{projectHomepageShowInstanceSize && (
142+
<>
143+
<span className="text-sm text-foreground-light"></span>
144+
<span className="text-sm text-foreground-light">{computeSize}</span>
145+
</>
146+
)}
138147
</p>
139148
</div>
140149
</div>
@@ -186,6 +195,10 @@ export const ReplicaNode = ({ data }: NodeProps<ReplicaNodeData>) => {
186195
PermissionAction.CREATE,
187196
'projects'
188197
)
198+
const { projectHomepageShowInstanceSize } = useIsFeatureEnabled([
199+
'project_homepage:show_instance_size',
200+
])
201+
189202
const [, setShowConnect] = useQueryState('showConnect', parseAsBoolean.withDefault(false))
190203

191204
const { data: databaseStatuses } = useReadReplicasStatusesQuery({ projectRef: ref })
@@ -289,7 +302,7 @@ export const ReplicaNode = ({ data }: NodeProps<ReplicaNodeData>) => {
289302
<p className="text-sm text-foreground-light">{region.name}</p>
290303
<p className="flex text-sm text-foreground-light items-center gap-x-1">
291304
<span>{provider}</span>
292-
{!!computeSize && (
305+
{projectHomepageShowInstanceSize && !!computeSize && (
293306
<>
294307
<span></span>
295308
<span>{computeSize}</span>

apps/studio/components/interfaces/Settings/Infrastructure/InfrastructureConfiguration/MapView.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import { DropdownMenuItemTooltip } from 'components/ui/DropdownMenuItemTooltip'
2020
import { Database, useReadReplicasQuery } from 'data/read-replicas/replicas-query'
2121
import { formatDatabaseID } from 'data/read-replicas/replicas.utils'
2222
import { useAsyncCheckProjectPermissions } from 'hooks/misc/useCheckPermissions'
23+
import { useIsFeatureEnabled } from 'hooks/misc/useIsFeatureEnabled'
2324
import { BASE_PATH } from 'lib/constants'
2425
import type { AWS_REGIONS_KEYS } from 'shared-data'
2526
import { useDatabaseSelectorStateSnapshot } from 'state/database-selector'
@@ -51,6 +52,9 @@ const MapView = ({
5152
}: MapViewProps) => {
5253
const { ref } = useParams()
5354
const dbSelectorState = useDatabaseSelectorStateSnapshot()
55+
const { projectHomepageShowInstanceSize } = useIsFeatureEnabled([
56+
'project_homepage:show_instance_size',
57+
])
5458

5559
const [mount, setMount] = useState(false)
5660
const [zoom, setZoom] = useState<number>(1.5)
@@ -286,7 +290,9 @@ const MapView = ({
286290
<Badge variant="warning">Unhealthy</Badge>
287291
)}
288292
</p>
289-
<p className="text-xs text-foreground-light">AWS • {database.size}</p>
293+
<p className="text-xs text-foreground-light">
294+
AWS{projectHomepageShowInstanceSize ? ` • ${database.size}` : ''}
295+
</p>
290296
{database.identifier !== ref && (
291297
<p className="text-xs text-foreground-light">Created on: {created}</p>
292298
)}

apps/studio/components/interfaces/Settings/Logs/LogsQueryPanel.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ const LogsQueryPanel = ({
5858
onDateChange,
5959
}: LogsQueryPanelProps) => {
6060
const [showReference, setShowReference] = useState(false)
61+
const { logsTemplates } = useIsFeatureEnabled(['logs:templates'])
6162

6263
const {
6364
projectAuthAll: authEnabled,
@@ -125,7 +126,7 @@ const LogsQueryPanel = ({
125126
</DropdownMenuContent>
126127
</DropdownMenu>
127128

128-
{IS_PLATFORM && (
129+
{IS_PLATFORM && logsTemplates && (
129130
<DropdownMenu>
130131
<DropdownMenuTrigger asChild>
131132
<Button type="default" iconRight={<ChevronDown />}>

0 commit comments

Comments
 (0)