From 02a2181af5d78ee5624729346745979f5112711d Mon Sep 17 00:00:00 2001 From: Sharon Gratch Date: Mon, 6 Jan 2025 17:38:08 +0200 Subject: [PATCH] Migrate deprecated Wizard component to PF5 and fix Wizard's focus issue References: https://issues.redhat.com/browse/MTV-1051 https://issues.redhat.com/browse/MTV-1863 1. Migrate the deprecated Wizard component to PF5 - see https://v5-archive.patternfly.org/components/wizard/react-deprecated 2. When moving between steps in plan wizard, set the initial focus to the top of the step's page. Signed-off-by: Sharon Gratch --- .../views/create/PlanCreatePage.style.css | 10 +- .../Plans/views/create/PlanCreatePage.tsx | 95 +++++++++---------- 2 files changed, 53 insertions(+), 52 deletions(-) diff --git a/packages/forklift-console-plugin/src/modules/Plans/views/create/PlanCreatePage.style.css b/packages/forklift-console-plugin/src/modules/Plans/views/create/PlanCreatePage.style.css index f5134fcd5..d1cab2104 100644 --- a/packages/forklift-console-plugin/src/modules/Plans/views/create/PlanCreatePage.style.css +++ b/packages/forklift-console-plugin/src/modules/Plans/views/create/PlanCreatePage.style.css @@ -80,6 +80,12 @@ cursor: pointer; } -.forklift--create-plan--wizard-appearance-order { - z-index: 1; +.forklift--create-plan--wizard-content { + flex-flow: initial; +} + +.forklift--create-plan--wizard-container { + height: 100%; + display: flex; + flex-direction: column; } \ No newline at end of file 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 dc0dbe9f6..e122c1ebd 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 @@ -8,8 +8,7 @@ import { useSaveEffect } from 'src/modules/Providers/views/migrate/useSaveEffect import { ProviderModelGroupVersionKind, V1beta1Provider } from '@kubev2v/types'; import { useActiveNamespace, useK8sWatchResource } from '@openshift-console/dynamic-plugin-sdk'; -import { PageSection, Title } from '@patternfly/react-core'; -import { Wizard } from '@patternfly/react-core/deprecated'; +import { PageSection, Title, Wizard, WizardStep } from '@patternfly/react-core'; import { findProviderByID } from './components'; import { planCreatePageInitialState, planCreatePageReducer } from './states'; @@ -59,65 +58,61 @@ export const PlanCreatePage: React.FC<{ namespace: string }> = ({ namespace }) = }); useSaveEffect(state, dispatch); - const steps = [ - { - id: 'step-1', - name: 'Select source provider', - component: ( - - ), - enableNext: filterState?.selectedVMs?.length > 0, - }, - { - id: 'step-2', - name: 'Create migration plan', - component: ( - - ), - enableNext: - !emptyContext && - !( - !!state?.flow?.apiError || - Object.values(state?.validation || []).some((validation) => validation === 'error') || - state?.validation?.planName === 'default' - ), - canJumpTo: filterState?.selectedVMs?.length > 0, - nextButtonText: 'Create migration plan', - }, - ]; - const title = 'Plans wizard'; return ( <> {'Create migration plan'} - - + history.goBack()} onSave={() => { setActiveNamespace(state.underConstruction.projectName); dispatch(startCreate()); }} - onClose={() => history.goBack()} - startAtStep={startAtStep} - /> + > + + + + validation === 'error', + ) || + state?.validation?.planName === 'default', + }} + > + + + );