File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -19,6 +19,7 @@ import {
1919 TextField ,
2020 TlsCertsField ,
2121} from 'app/components/form'
22+ import { NumberField } from 'app/components/form/fields/NumberField'
2223import { useForm , useToast } from 'app/hooks'
2324import { pb } from 'app/util/path-builder'
2425
@@ -43,6 +44,10 @@ const defaultValues: SiloCreateFormValues = {
4344 } ,
4445}
4546
47+ function validateQuota ( value : number ) {
48+ if ( value < 0 ) return 'Must be at least 0'
49+ }
50+
4651export function CreateSiloSideModalForm ( ) {
4752 const navigate = useNavigate ( )
4853 const queryClient = useApiQueryClient ( )
@@ -97,6 +102,35 @@ export function CreateSiloSideModalForm() {
97102 < CheckboxField name = "discoverable" control = { form . control } >
98103 Discoverable
99104 </ CheckboxField >
105+ < FormDivider />
106+ < NumberField
107+ control = { form . control }
108+ label = "CPU quota"
109+ name = "quotas.cpus"
110+ required
111+ type = "number"
112+ units = "nCPUs"
113+ validate = { validateQuota }
114+ />
115+ < NumberField
116+ control = { form . control }
117+ label = "Memory quota"
118+ name = "quotas.memory"
119+ required
120+ type = "number"
121+ units = "GiB"
122+ validate = { validateQuota }
123+ />
124+ < NumberField
125+ control = { form . control }
126+ label = "Storage quota"
127+ name = "quotas.storage"
128+ required
129+ type = "number"
130+ units = "GiB"
131+ validate = { validateQuota }
132+ />
133+ < FormDivider />
100134 < RadioField
101135 name = "identityMode"
102136 label = "Identity mode"
Original file line number Diff line number Diff line change @@ -25,14 +25,17 @@ test('Create silo', async ({ page }) => {
2525
2626 await page . click ( 'role=link[name="New silo"]' )
2727
28- // fill out form and submit
28+ // fill out form
2929 await page . fill ( 'role=textbox[name="Name"]' , 'other-silo' )
3030 await page . fill ( 'role=textbox[name="Description"]' , 'definitely a silo' )
3131 await expect ( page . locator ( 'role=checkbox[name="Discoverable"]' ) ) . toBeChecked ( )
3232 await page . click ( 'role=checkbox[name="Discoverable"]' )
3333 await page . click ( 'role=radio[name="Local only"]' )
3434 await page . fill ( 'role=textbox[name="Admin group name"]' , 'admins' )
3535 await page . click ( 'role=checkbox[name="Grant fleet admin role to silo admins"]' )
36+ await page . getByRole ( 'textbox' , { name : 'CPU quota (nCPUs)' } ) . fill ( '3' )
37+ await page . getByRole ( 'textbox' , { name : 'Memory quota (GiB)' } ) . fill ( '5' )
38+ await page . getByRole ( 'textbox' , { name : 'Storage quota (GiB)' } ) . fill ( '7' )
3639
3740 // Add a TLS cert
3841 const openCertModalButton = page . getByRole ( 'button' , { name : 'Add TLS certificate' } )
You can’t perform that action at this time.
0 commit comments