import { useParams } from 'common' import { useRef } from 'react' import { UseFormReturn } from 'react-hook-form' import { type CloudProvider } from 'shared-data' import { Checkbox, FormControl, FormDescription, FormField, FormItem, FormLabel, Input, useWatch, } from 'ui' import { CollapsibleCardSection } from 'ui-patterns/CollapsibleCardSection' import { FormItemLayout } from 'ui-patterns/form/FormItemLayout/FormItemLayout' import { CloudProviderSelector } from './CloudProviderSelector' import { PostgresVersionSelector } from './PostgresVersionSelector' import { CreateProjectForm } from './ProjectCreation.schema' import { canOverrideKubernetesCluster, isProductionEnvironment } from './ProjectCreation.utils' import Panel from '@/components/ui/Panel' interface InternalOnlyConfigurationProps { form: UseFormReturn isV3AdvancedDeploymentEnabled: boolean } export const InternalOnlyConfiguration = ({ form, isV3AdvancedDeploymentEnabled, }: InternalOnlyConfigurationProps) => { const { slug } = useParams() const showNonProdFields = !isProductionEnvironment() const canConfigureDeployment = showNonProdFields || isV3AdvancedDeploymentEnabled const highAvailability = useWatch({ control: form.control, name: 'highAvailability' }) const cloudProvider = useWatch({ control: form.control, name: 'cloudProvider' }) const dbRegion = useWatch({ control: form.control, name: 'dbRegion' }) const kubernetesClusterId = useWatch({ control: form.control, name: 'kubernetesClusterId' }) const useOrioleDbForCreate = useWatch({ control: form.control, name: 'useOrioleDb' }) const canOverrideCluster = canOverrideKubernetesCluster( cloudProvider, isV3AdvancedDeploymentEnabled ) // Held here (outside the collapsible content) so the selector's last valid // selection survives the section being collapsed and reopened. const lastValidPostgresVersionSelection = useRef('') return (
( )} />
{canConfigureDeployment && } {showNonProdFields && (

The settings below are only applicable for local/staging projects

{!highAvailability && ( ( )} /> )} ( )} />
)} {canOverrideCluster && ( ( {/* The backend matches against the kubernetes_clusters.id primary key, which is the full `-eksCluster-` value — not the short cluster name shown elsewhere (e.g. admin_studio's project page). The short name alone won't match any cluster. */} )} /> )} {canOverrideCluster && !!kubernetesClusterId && ( ( field.onChange(value === true)} />
Force-deploy to this cluster Allows deliberately targeting a CORDONED cluster. PENDING and REMOVED clusters remain ineligible, and the cluster still needs a mapped filesystem to provision onto.
)} /> )}
) }