@@ -22,6 +22,7 @@ import {
22
22
} from "components/Form/Form" ;
23
23
import { IconField } from "components/IconField/IconField" ;
24
24
import { OrganizationAutocomplete } from "components/OrganizationAutocomplete/OrganizationAutocomplete" ;
25
+ import { useDashboard } from "modules/dashboard/useDashboard" ;
25
26
import { SelectedTemplate } from "pages/CreateWorkspacePage/SelectedTemplate" ;
26
27
import {
27
28
nameValidator ,
@@ -88,7 +89,7 @@ const defaultInitialValues: CreateTemplateData = {
88
89
allow_user_autostop :false ,
89
90
allow_everyone_group_access :true ,
90
91
provisioner_type :"terraform" ,
91
- organization_id :"" ,
92
+ organization_id :"00000000-0000-0000-0000-000000000000 " ,
92
93
} ;
93
94
94
95
type GetInitialValuesParams = {
@@ -179,6 +180,7 @@ export type CreateTemplateFormProps = (
179
180
} ;
180
181
181
182
export const CreateTemplateForm :FC < CreateTemplateFormProps > = ( props ) => {
183
+ const { experiments} = useDashboard ( ) ;
182
184
const [ searchParams ] = useSearchParams ( ) ;
183
185
const [ selectedOrg , setSelectedOrg ] = useState < Organization | null > ( null ) ;
184
186
const {
@@ -193,6 +195,7 @@ export const CreateTemplateForm: FC<CreateTemplateFormProps> = (props) => {
193
195
allowAdvancedScheduling,
194
196
variablesSectionRef,
195
197
} = props ;
198
+ const multiOrgExperimentEnabled = experiments . includes ( "multi-organization" ) ;
196
199
// TODO: if there is only 1 organization, set the dropdown to the default organizationId or hide it
197
200
198
201
const form = useFormik < CreateTemplateData > ( {
@@ -232,16 +235,20 @@ export const CreateTemplateForm: FC<CreateTemplateFormProps> = (props) => {
232
235
} }
233
236
/>
234
237
) }
235
-
236
- < OrganizationAutocomplete
237
- { ...getFieldHelpers ( "organization_id" ) }
238
- value = { selectedOrg }
239
- onChange = { ( newValue ) => {
240
- setSelectedOrg ( newValue ) ;
241
- return form . setFieldValue ( "organization_id" , newValue ?. id || "" ) ;
242
- } }
243
- size = "medium"
244
- />
238
+ { multiOrgExperimentEnabled && (
239
+ < OrganizationAutocomplete
240
+ { ...getFieldHelpers ( "organization_id" ) }
241
+ value = { selectedOrg }
242
+ onChange = { ( newValue ) => {
243
+ setSelectedOrg ( newValue ) ;
244
+ return form . setFieldValue (
245
+ "organization_id" ,
246
+ newValue ?. id || "" ,
247
+ ) ;
248
+ } }
249
+ size = "medium"
250
+ />
251
+ ) }
245
252
246
253
< TextField
247
254
{ ...getFieldHelpers ( "name" ) }