The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
[FE-2913] feat(studio): restrict cloud provider to AWS (Revamped) for HA projects (#44569)
Alaister Younge7bec24021de
diff --git a/apps/studio/components/interfaces/ProjectCreation/CloudProviderSelector.tsx b/apps/studio/components/interfaces/ProjectCreation/CloudProviderSelector.tsxindex aac1034f9be..2e62b8fe7e3 100644--- a/apps/studio/components/interfaces/ProjectCreation/CloudProviderSelector.tsx+++ b/apps/studio/components/interfaces/ProjectCreation/CloudProviderSelector.tsx@@ -8,6 +8,7 @@ import {SelectItem_Shadcn_,SelectTrigger_Shadcn_,SelectValue_Shadcn_,+ useWatch_Shadcn_,} from 'ui'import { FormItemLayout } from 'ui-patterns/form/FormItemLayout/FormItemLayout'@@ -16,12 +17,15 @@ import Panel from '@/components/ui/Panel'import { useCustomContent } from '@/hooks/custom-content/useCustomContent'import { PROVIDERS } from '@/lib/constants'+const HA_SUPPORTED_PROVIDERS = ['AWS_K8S']+interface CloudProviderSelectorProps {form: UseFormReturn<CreateProjectForm>}export const CloudProviderSelector = ({ form }: CloudProviderSelectorProps) => {const { infraCloudProviders: validCloudProviders } = useCustomContent(['infra:cloud_providers'])+ const highAvailability = useWatch_Shadcn_({ control: form.control, name: 'highAvailability' })return (<Panel.Content>@@ -29,10 +33,21 @@ export const CloudProviderSelector = ({ form }: CloudProviderSelectorProps) => {control={form.control}name="cloudProvider"render={({ field }) => (- <FormItemLayout label="Cloud provider" layout="horizontal">+ <FormItemLayout+ label="Cloud provider"+ layout="horizontal"+ description={+ highAvailability ? (+ <p className="text-warning">+ High availability is only supported on AWS (Revamped)+ </p>+ ) : undefined+ }+ ><Select_Shadcn_onValueChange={(value) => field.onChange(value)}defaultValue={field.value}+ value={field.value}><FormControl_Shadcn_><SelectTrigger_Shadcn_>@@ -46,8 +61,9 @@ export const CloudProviderSelector = ({ form }: CloudProviderSelectorProps) => {.map((providerObj) => {const label = providerObj['name']const value = providerObj['id']+ const isDisabled = highAvailability && !HA_SUPPORTED_PROVIDERS.includes(value)return (- <SelectItem_Shadcn_ key={value} value={value}>+ <SelectItem_Shadcn_ key={value} value={value} disabled={isDisabled}>{label}</SelectItem_Shadcn_>)diff --git a/apps/studio/components/interfaces/ProjectCreation/ProjectCreation.schema.ts b/apps/studio/components/interfaces/ProjectCreation/ProjectCreation.schema.tsindex 47d9c21209b..3e1bbbc7e3a 100644--- a/apps/studio/components/interfaces/ProjectCreation/ProjectCreation.schema.ts+++ b/apps/studio/components/interfaces/ProjectCreation/ProjectCreation.schema.ts@@ -38,14 +38,23 @@ export const FormSchema = zpostgresVersionSelection: z.string(),useOrioleDb: z.boolean(),})- .superRefine(({ dbPassStrength, dbPassStrengthWarning }, ctx) => {- if (dbPassStrength < DEFAULT_MINIMUM_PASSWORD_STRENGTH) {- ctx.addIssue({- code: z.ZodIssueCode.custom,- path: ['dbPass'],- message: dbPassStrengthWarning || 'Password not secure enough',- })+ .superRefine(+ ({ dbPassStrength, dbPassStrengthWarning, highAvailability, cloudProvider }, ctx) => {+ if (dbPassStrength < DEFAULT_MINIMUM_PASSWORD_STRENGTH) {+ ctx.addIssue({+ code: z.ZodIssueCode.custom,+ path: ['dbPass'],+ message: dbPassStrengthWarning || 'Password not secure enough',+ })+ }+ if (highAvailability && cloudProvider !== 'AWS_K8S') {+ ctx.addIssue({+ code: z.ZodIssueCode.custom,+ path: ['cloudProvider'],+ message: 'High availability is only supported on AWS (Revamped)',+ })+ }}- })+ )export type CreateProjectForm = z.infer<typeof FormSchema>diff --git a/apps/studio/pages/new/[slug].tsx b/apps/studio/pages/new/[slug].tsxindex 958139f9dab..928a372fb71 100644--- a/apps/studio/pages/new/[slug].tsx+++ b/apps/studio/pages/new/[slug].tsx@@ -402,6 +402,12 @@ const Wizard: NextPageWithLayout = () => {}}, [recommendedSmartRegion])+ useEffect(() => {+ if (highAvailability && cloudProvider !== 'AWS_K8S') {+ form.setValue('cloudProvider', 'AWS_K8S')+ }+ }, [highAvailability, cloudProvider, form])+useEffect(() => {if (watchedInstanceSize !== instanceSize) {form.setValue('instanceSize', instanceSize, {