Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 16 additions & 3 deletions app/forms/disk-create.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,13 @@
*
* Copyright Oxide Computer Company
*/
// Read-only disk creation is disabled pending a propolis fix. To re-enable:
// 1. Uncomment CheckboxField import and JSX in this file
// 2. Uncomment CheckboxField JSX in app/forms/instance-create.tsx
// 3. Use `values.bootDiskReadOnly` instead of hardcoded `false` in instance-create.tsx getBootDisk
// 4. Use `source.readOnly` instead of hardcoded `false` in the onSubmit handler below
// 5. Unskip e2e tests in test/e2e/disks.e2e.ts and test/e2e/instance-create.e2e.ts
// https://github.com/oxidecomputer/console/issues/3071
import { useQuery } from '@tanstack/react-query'
import { filesize } from 'filesize'
import { useMemo } from 'react'
Expand All @@ -23,7 +30,7 @@ import {
type Image,
} from '@oxide/api'

import { CheckboxField } from '~/components/form/fields/CheckboxField'
// import { CheckboxField } from '~/components/form/fields/CheckboxField' // re-enable with #3071
import { DescriptionField } from '~/components/form/fields/DescriptionField'
import { DiskSizeField } from '~/components/form/fields/DiskSizeField'
import { toImageComboboxItem } from '~/components/form/fields/ImageSelectField'
Expand Down Expand Up @@ -172,14 +179,14 @@ export function CreateDiskSideModalForm({
// image ID is validated by the form: it's required when the
// field is present (i.e., when image type is selected)
imageId: source.imageId!,
readOnly: source.readOnly,
readOnly: false,
}))
.with({ type: 'snapshot' }, (source) => ({
type: 'snapshot' as const,
// snapshot ID is validated by the form: it's required when
// the field is present (i.e., when snapshot type is selected)
snapshotId: source.snapshotId!,
readOnly: source.readOnly,
readOnly: false,
}))
.exhaustive(),
}))
Expand Down Expand Up @@ -370,22 +377,28 @@ const DiskSourceField = ({
}
}}
/>
{/* Read-only disk creation disabled pending propolis fix
https://github.com/oxidecomputer/console/issues/3071
<div className="mt-2">
<CheckboxField name="diskBackend.diskSource.readOnly" control={control}>
Make disk read-only
</CheckboxField>
</div>
*/}
</>
)}

{diskSource.type === 'snapshot' && (
<>
<SnapshotSelectField control={control} />
{/* Read-only disk creation disabled pending propolis fix
https://github.com/oxidecomputer/console/issues/3071
<div className="mt-2">
<CheckboxField name="diskBackend.diskSource.readOnly" control={control}>
Make disk read-only
</CheckboxField>
</div>
*/}
</>
)}
</div>
Expand Down
5 changes: 4 additions & 1 deletion app/forms/instance-create.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ const getBootDiskAttachment = (
diskSource: {
type: 'image',
imageId: source,
readOnly: values.bootDiskReadOnly,
readOnly: false,
},
},
}
Expand Down Expand Up @@ -398,6 +398,8 @@ export default function CreateInstanceForm() {
}
}}
/>
{/* Read-only disk creation disabled pending propolis fix
https://github.com/oxidecomputer/console/issues/3071
<div key="divider3" className="my-6! content-['a']" />
<CheckboxField
key="bootDiskReadOnly"
Expand All @@ -407,6 +409,7 @@ export default function CreateInstanceForm() {
>
Make disk read-only
</CheckboxField>
*/}
</>
)

Expand Down
8 changes: 6 additions & 2 deletions test/e2e/disks.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,9 @@ test('Create local disk with size > 1023 GiB', async ({ page }) => {
})
})

test('Create disk from snapshot with read-only', async ({ page }) => {
// Read-only disk creation disabled pending propolis fix
// https://github.com/oxidecomputer/console/issues/3071
test.skip('Create disk from snapshot with read-only', async ({ page }) => {
await page.goto('/projects/mock-project/disks-new')
await page.getByRole('textbox', { name: 'Name' }).fill('a-new-disk')
await page.getByRole('radio', { name: 'Snapshot' }).click()
Expand All @@ -259,7 +261,9 @@ test('Create disk from snapshot with read-only', async ({ page }) => {
await expect(modal.getByLabel('e6c58826-62fb-4205-820e-620407cd04e7')).toBeVisible()
})

test('Create disk from image with read-only', async ({ page }) => {
// Read-only disk creation disabled pending propolis fix
// https://github.com/oxidecomputer/console/issues/3071
test.skip('Create disk from image with read-only', async ({ page }) => {
await page.goto('/projects/mock-project/disks-new')
await page.getByRole('textbox', { name: 'Name' }).fill('a-new-disk')
await page.getByRole('radio', { name: 'Image' }).click()
Expand Down
4 changes: 3 additions & 1 deletion test/e2e/instance-create.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1195,7 +1195,9 @@ test('floating IPs are filtered by NIC IP version', async ({ page }) => {
await expect(page.getByText('to attach a floating IP')).toBeVisible()
})

test('can create instance with read-only boot disk', async ({ page }) => {
// Read-only disk creation disabled pending propolis fix
// https://github.com/oxidecomputer/console/issues/3071
test.skip('can create instance with read-only boot disk', async ({ page }) => {
await page.goto('/projects/mock-project/instances-new')

const instanceName = 'readonly-boot-instance'
Expand Down
Loading