Skip to content
Closed
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
10 changes: 9 additions & 1 deletion src/Components/CreateImageWizard/CreateImageWizard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,7 @@ const CreateImageWizard = ({ isEdit }: CreateImageWizardProps) => {
// Firstboot
const firstBootValidation = useFirstBootValidation();
// Details
const [detailsPristine, setDetailsPristine] = useState(true);
const detailsValidation = useDetailsValidation();

let startIndex = 1; // default index
Expand Down Expand Up @@ -453,7 +454,14 @@ const CreateImageWizard = ({ isEdit }: CreateImageWizardProps) => {
status={detailsValidation.disabledNext ? 'error' : 'default'}
footer={
<CustomWizardFooter
disableNext={detailsValidation.disabledNext}
beforeNext={() => {
if (detailsValidation.disabledNext) {
setDetailsPristine(false);
return false;
}
return true;
}}
disableNext={!detailsPristine && detailsValidation.disabledNext}
/>
}
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ describe('Step Details', () => {
const nextButton = await getNextButton();
expect(nextButton).toBeEnabled();
await enterBlueprintName(' ');
await clickNext();
await waitFor(() => expect(nextButton).toBeDisabled());
});

Expand All @@ -83,6 +84,7 @@ describe('Step Details', () => {
await goToDetailsStep();
await enterBlueprintName('Lemon Pie');
const nextButton = await getNextButton();
await clickNext();
await waitFor(() => expect(nextButton).toBeDisabled());
});

Expand Down
Loading