diff --git a/app/forms/silo-create.tsx b/app/forms/silo-create.tsx
index 8e2a42ef0..f1a5fc5a0 100644
--- a/app/forms/silo-create.tsx
+++ b/app/forms/silo-create.tsx
@@ -5,6 +5,7 @@
*
* Copyright Oxide Computer Company
*/
+import { useEffect } from 'react'
import { useNavigate } from 'react-router-dom'
import { useApiMutation, useApiQueryClient, type SiloCreate } from '@oxide/api'
@@ -20,6 +21,7 @@ import { SideModalForm } from '~/components/form/SideModalForm'
import { useForm } from '~/hooks'
import { addToast } from '~/stores/toast'
import { FormDivider } from '~/ui/lib/Divider'
+import { FieldLabel } from '~/ui/lib/FieldLabel'
import { Message } from '~/ui/lib/Message'
import { pb } from '~/util/path-builder'
import { GiB } from '~/util/units'
@@ -65,7 +67,13 @@ export function CreateSiloSideModalForm() {
})
const form = useForm({ defaultValues })
-
+ const identityMode = form.watch('identityMode')
+ // Clear the adminGroupName if the user selects the "local only" identity mode
+ useEffect(() => {
+ if (identityMode === 'local_only') {
+ form.setValue('adminGroupName', '')
+ }
+ }, [identityMode, form])
return (
-
+ {identityMode === 'saml_jit' && (
+
+ )}
+
-
- Grant fleet admin role to silo admins
-
-
-
-
- Grant fleet viewer role to silo viewers
-
+
+ Role mapping
+
+
+
+ Grant fleet admin role to silo admins
+
+
+ Grant fleet viewer role to silo viewers
+
+
diff --git a/test/e2e/silos.e2e.ts b/test/e2e/silos.e2e.ts
index 43b1154c8..445483d49 100644
--- a/test/e2e/silos.e2e.ts
+++ b/test/e2e/silos.e2e.ts
@@ -38,9 +38,19 @@ test('Create silo', async ({ page }) => {
const discoverable = page.getByRole('checkbox', { name: 'Discoverable' })
await expect(discoverable).toBeChecked()
await discoverable.click()
- await page.getByRole('radio', { name: 'Local only' }).click()
+ await expect(page.getByRole('textbox', { name: 'Admin group name' })).toBeVisible()
await page.getByRole('textbox', { name: 'Admin group name' }).fill('admins')
await page.getByRole('checkbox', { name: 'Grant fleet admin' }).click()
+ await expect(page.getByRole('textbox', { name: 'Admin group name' })).toHaveValue(
+ 'admins'
+ )
+ await expect(page.getByRole('checkbox', { name: 'Grant fleet admin' })).toBeChecked()
+ await page.getByRole('radio', { name: 'Local only' }).click()
+ await expect(page.getByRole('textbox', { name: 'Admin group name' })).toBeHidden()
+ await page.getByRole('radio', { name: 'SAML' }).click()
+ await expect(page.getByRole('textbox', { name: 'Admin group name' })).toHaveValue('')
+ await expect(page.getByRole('checkbox', { name: 'Grant fleet admin' })).toBeChecked()
+ await page.getByRole('textbox', { name: 'Admin group name' }).fill('admins')
await page.getByRole('textbox', { name: 'CPU quota' }).fill('30')
await page.getByRole('textbox', { name: 'Memory quota' }).fill('58')
await page.getByRole('textbox', { name: 'Storage quota' }).fill('735')
@@ -99,7 +109,7 @@ test('Create silo', async ({ page }) => {
await expectRowVisible(table, {
name: 'other-silo',
description: 'definitely a silo',
- 'Identity mode': 'local only',
+ 'Identity mode': 'saml jit',
// discoverable: 'false',
})
const otherSiloCell = page.getByRole('cell', { name: 'other-silo' })