mirror of
https://github.com/supabase/supabase.git
synced 2026-09-08 19:08:44 +08:00
## Context There's 2 areas of the dashboard that has the project creation flow - and this PR consolidates both to use the same UI components to minimise duplication + keep things consistent ### Before <img width="1920" height="957" alt="image" src="https://github.com/user-attachments/assets/2a7ab79d-71c7-43f2-925b-1e1666cc3a69" /> ### After <img width="1389" height="957" alt="image" src="https://github.com/user-attachments/assets/f8465568-af99-46eb-80ee-7ac345383231" /> ## Changes involved - What this means for the project creation flow for Vercel Integration: - Smart region can be selected - Compute size can be selected - Enable Data API can be checked - Automatic RLS enable can be checked - How it differs from the main project creation flow on `new/slug` - Organization selection is disabled (cannot be changed) - The following UI is hidden: - "Internal configuration" section - "GitHub repository" field - "Free project info" at the bottom - "Cancel" button Eventually we could looking into reducing the differences more, e.g having data seeding for both ways, and showing GitHub repository field for Vercel integration Resolves DEPR-616 Resolves FE-3905 ## To test Tbh, I'm not really sure how you'd be able to test the vercel integration locally or on staging, this seemingly can only be done when changes land on prod. - What I'd do however is to just test the project creation flow minimally by landing on `/integrations/vercel/_/deploy-button/new-project` - Project creation can work, but just not the connection creation part - And also test project creation on `/new/slug` as well <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit ## Summary by CodeRabbit * **New Features** * Added “Create sample tables with seed data” during project creation. * Enhanced Vercel integration setup with a guided creation flow and post-creation connection step. * Added an option to disable organization selection in specialized flows. * Added support for triggering a callback after successful project creation. * Added support for hiding the Cancel button in specialized flows. * **UI Improvements** * Refined the connected GitHub repository selector button/dropdown visuals. * Improved security options behavior for different project creation contexts. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
83 lines
2.7 KiB
TypeScript
83 lines
2.7 KiB
TypeScript
import { z } from 'zod'
|
|
|
|
import { DEFAULT_MINIMUM_PASSWORD_STRENGTH } from '@/lib/constants'
|
|
|
|
export const FormSchema = z
|
|
.object({
|
|
organization: z.string({
|
|
required_error: 'Please select an organization',
|
|
}),
|
|
projectName: z
|
|
.string()
|
|
.trim()
|
|
.min(1, 'Please enter a project name.') // Required field check
|
|
.min(3, 'Project name must be at least 3 characters long.') // Minimum length check
|
|
.max(64, 'Project name must be no longer than 64 characters.'), // Maximum length check
|
|
highAvailability: z.boolean(),
|
|
postgresVersion: z.string({
|
|
required_error: 'Please enter a Postgres version.',
|
|
}),
|
|
instanceType: z.string().optional(),
|
|
dbRegion: z.string({
|
|
required_error: 'Please select a region.',
|
|
}),
|
|
cloudProvider: z.string({
|
|
required_error: 'Please select a cloud provider.',
|
|
}),
|
|
|
|
dbPass: z
|
|
.string({ required_error: 'Please enter a database password.' })
|
|
.min(1, 'Password is required.'),
|
|
dbPassStrength: z
|
|
.union([z.literal(0), z.literal(1), z.literal(2), z.literal(3), z.literal(4)])
|
|
.default(0),
|
|
dbPassStrengthMessage: z.string().default(''),
|
|
dbPassStrengthWarning: z.string().default(''),
|
|
instanceSize: z.string().optional(),
|
|
githubRepositoryId: z.string().optional().default(''),
|
|
githubInstallationId: z.number().optional(),
|
|
githubRepositoryName: z.string().optional().default(''),
|
|
dataApi: z.boolean(),
|
|
dataApiDefaultPrivileges: z.boolean(),
|
|
enableRlsEventTrigger: z.boolean(),
|
|
postgresVersionSelection: z.string(),
|
|
useOrioleDb: z.boolean(),
|
|
shouldRunMigrations: z.boolean(),
|
|
})
|
|
.superRefine(
|
|
(
|
|
{ dbPassStrength, dbPassStrengthWarning, highAvailability, cloudProvider, useOrioleDb },
|
|
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)',
|
|
})
|
|
}
|
|
|
|
if (highAvailability && useOrioleDb) {
|
|
ctx.addIssue({
|
|
code: z.ZodIssueCode.custom,
|
|
path: ['highAvailability'],
|
|
message: 'High availability is not supported with OrioleDB images',
|
|
})
|
|
ctx.addIssue({
|
|
code: z.ZodIssueCode.custom,
|
|
path: ['useOrioleDb'],
|
|
message: 'High availability is not supported with OrioleDB images',
|
|
})
|
|
}
|
|
}
|
|
)
|
|
|
|
export type CreateProjectForm = z.infer<typeof FormSchema>
|