From 990f13e3989b9457773b8bd53851939454619d44 Mon Sep 17 00:00:00 2001 From: Sharon Gratch Date: Fri, 27 Dec 2024 00:35:20 +0200 Subject: [PATCH] Initilalize the validation value for the wizard's 'plan name' field to default instead of error Reference: https://issues.redhat.com/browse/MTV-1651 To avoid displaying an error on initialization for the 'plan name'empty field, when entering the wizard's step 2, leave the initialized validation value for this field as 'default. Signed-off-by: Sharon Gratch --- .../src/modules/Plans/views/create/PlanCreatePage.tsx | 3 ++- .../src/modules/Providers/views/migrate/reducer/reducer.ts | 4 ---- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/packages/forklift-console-plugin/src/modules/Plans/views/create/PlanCreatePage.tsx b/packages/forklift-console-plugin/src/modules/Plans/views/create/PlanCreatePage.tsx index 67554ed5c..dc0dbe9f6 100644 --- a/packages/forklift-console-plugin/src/modules/Plans/views/create/PlanCreatePage.tsx +++ b/packages/forklift-console-plugin/src/modules/Plans/views/create/PlanCreatePage.tsx @@ -90,7 +90,8 @@ export const PlanCreatePage: React.FC<{ namespace: string }> = ({ namespace }) = !emptyContext && !( !!state?.flow?.apiError || - Object.values(state?.validation || []).some((validation) => validation === 'error') + Object.values(state?.validation || []).some((validation) => validation === 'error') || + state?.validation?.planName === 'default' ), canJumpTo: filterState?.selectedVMs?.length > 0, nextButtonText: 'Create migration plan', diff --git a/packages/forklift-console-plugin/src/modules/Providers/views/migrate/reducer/reducer.ts b/packages/forklift-console-plugin/src/modules/Providers/views/migrate/reducer/reducer.ts index 99a544766..3c82f7e4c 100644 --- a/packages/forklift-console-plugin/src/modules/Providers/views/migrate/reducer/reducer.ts +++ b/packages/forklift-console-plugin/src/modules/Providers/views/migrate/reducer/reducer.ts @@ -137,10 +137,6 @@ const handlers: { ) { // triggered from useEffect on any data change draft.existingResources.plans = existingPlans; - draft.validation.planName = validatePlanName( - draft.underConstruction.plan.metadata.name, - existingPlans, - ); }, [SET_AVAILABLE_TARGET_NAMESPACES]( draft,