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
2 changes: 1 addition & 1 deletion app/components/form/SideModalForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ type SideModalFormProps<TFieldValues extends FieldValues> = {
/** Must be provided with a reason describing why it's disabled */
submitDisabled?: string
/** Error from the API call */
submitError?: ApiError | null
submitError: ApiError | null
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the Mistake Preventer

loading?: boolean
title: string
subtitle?: ReactNode
Expand Down
2 changes: 2 additions & 0 deletions app/forms/idp/edit.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ export function EditIdpSideModalForm() {
<Access16Icon /> {idp.name}
</ResourceLabel>
}
// TODO: pass actual error when this form is hooked up
submitError={null}
>
<PropertiesTable>
<PropertiesTable.Row label="ID">
Expand Down
2 changes: 2 additions & 0 deletions app/forms/image-edit.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@ export function EditImageSideModalForm({
<Images16Icon /> {image.name}
</ResourceLabel>
}
// TODO: pass actual error when this form is hooked up
submitError={null}
>
<PropertiesTable>
<PropertiesTable.Row label="Shared with">{type}</PropertiesTable.Row>
Expand Down
1 change: 1 addition & 0 deletions app/forms/image-from-snapshot.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ export function CreateImageFromSnapshotSideModalForm() {
body: { ...body, source: { type: 'snapshot', id: data.id } },
})
}
submitError={createImage.error}
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the fix

>
<PropertiesTable>
<PropertiesTable.Row label="Snapshot">{data.name}</PropertiesTable.Row>
Expand Down
15 changes: 15 additions & 0 deletions app/test/e2e/snapshots.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,3 +101,18 @@ test('Create image from snapshot', async ({ page }) => {
description: 'image description',
})
})

test('Create image from snapshot, name taken', async ({ page }) => {
await page.goto('/projects/mock-project/snapshots')

const row = page.getByRole('row', { name: 'snapshot-1' })
await row.getByRole('button', { name: 'Row actions' }).click()
await page.getByRole('menuitem', { name: 'Create image' }).click()

await expectVisible(page, ['role=dialog[name="Create image from snapshot"]'])

await page.fill('role=textbox[name="Name"]', 'image-1')
await page.click('role=button[name="Create image"]')

await expect(page.getByText('name already exists').nth(0)).toBeVisible()
})