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 Panel from '@/components/ui/Panel' interface InternalOnlyConfigurationProps { form: UseFormReturn } export const InternalOnlyConfiguration = ({ form }: InternalOnlyConfigurationProps) => { const { slug } = useParams() const showNonProdFields = process.env.NEXT_PUBLIC_ENVIRONMENT !== 'prod' const highAvailability = useWatch({ control: form.control, name: 'highAvailability' }) const cloudProvider = useWatch({ control: form.control, name: 'cloudProvider' }) const kubernetesClusterId = useWatch({ control: form.control, name: 'kubernetesClusterId' }) const isK8sProvider = cloudProvider === 'AWS_K8S' || cloudProvider === 'AWS_NIMBUS' // Held here (outside the collapsible content) so the selector's last valid // selection survives the section being collapsed and reopened. const lastValidPostgresVersionSelection = useRef('') return (
( )} />
{showNonProdFields && (

The settings below are only applicable for local/staging projects

{!highAvailability && ( ( )} /> )} ( )} /> {isK8sProvider && ( ( {/* 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. */} )} /> )} {isK8sProvider && !!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.
)} /> )}
)}
) }