diff --git a/packages/forklift-console-plugin/locales/en/plugin__forklift-console-plugin.json b/packages/forklift-console-plugin/locales/en/plugin__forklift-console-plugin.json
index 65463ecf8..8216fe206 100644
--- a/packages/forklift-console-plugin/locales/en/plugin__forklift-console-plugin.json
+++ b/packages/forklift-console-plugin/locales/en/plugin__forklift-console-plugin.json
@@ -356,6 +356,7 @@
"Plan name": "Plan name",
"Plans": "Plans",
"Plans for virtualization": "Plans for virtualization",
+ "Plans wizard": "Plans wizard",
"Please choose a NetworkAttachmentDefinition for data transfer.": "Please choose a NetworkAttachmentDefinition for data transfer.",
"Please choose a NetworkAttachmentDefinition for default data transfer.": "Please choose a NetworkAttachmentDefinition for default data transfer.",
"Please choose a target namespace for the migrated virtual machines.": "Please choose a target namespace for the migrated virtual machines.",
diff --git a/packages/forklift-console-plugin/src/modules/Plans/utils/helpers/anyValidationErrorExists.ts b/packages/forklift-console-plugin/src/modules/Plans/utils/helpers/anyValidationErrorExists.ts
new file mode 100644
index 000000000..7e750d8e5
--- /dev/null
+++ b/packages/forklift-console-plugin/src/modules/Plans/utils/helpers/anyValidationErrorExists.ts
@@ -0,0 +1,4 @@
+import { CreateVmMigrationPageState } from 'src/modules/Providers/views/migrate/types';
+
+export const anyValidationErrorExists = (state: CreateVmMigrationPageState): boolean =>
+ Object.values(state?.validation || []).some((validation) => validation === 'error');
diff --git a/packages/forklift-console-plugin/src/modules/Plans/utils/helpers/index.ts b/packages/forklift-console-plugin/src/modules/Plans/utils/helpers/index.ts
index f499b37f3..538a8a068 100644
--- a/packages/forklift-console-plugin/src/modules/Plans/utils/helpers/index.ts
+++ b/packages/forklift-console-plugin/src/modules/Plans/utils/helpers/index.ts
@@ -1,4 +1,5 @@
// @index(['./*', /style/g], f => `export * from '${f.path}';`)
+export * from './anyValidationErrorExists';
export * from './getMigrationPhase';
export * from './getMigrationVmsCounts';
export * from './getPlanPhase';
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..e6895fd08 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
@@ -1,15 +1,22 @@
import React, { useReducer } from 'react';
-import { useHistory } from 'react-router';
+import { getResourceUrl } from 'src/modules/Providers/utils/helpers';
import { useCreateVmMigrationData } from 'src/modules/Providers/views/migrate';
import ProvidersCreateVmMigrationPage from 'src/modules/Providers/views/migrate/ProvidersCreateVmMigrationPage';
import { startCreate } from 'src/modules/Providers/views/migrate/reducer/actions';
import { useFetchEffects } from 'src/modules/Providers/views/migrate/useFetchEffects';
import { useSaveEffect } from 'src/modules/Providers/views/migrate/useSaveEffect';
+import { useForkliftTranslation } from 'src/utils/i18n';
-import { ProviderModelGroupVersionKind, V1beta1Provider } from '@kubev2v/types';
+import {
+ PlanModelRef,
+ ProviderModelGroupVersionKind,
+ ProviderModelRef,
+ 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 { anyValidationErrorExists } from '../../utils';
import { findProviderByID } from './components';
import { planCreatePageInitialState, planCreatePageReducer } from './states';
@@ -18,10 +25,12 @@ import { SelectSourceProvider } from './steps';
import './PlanCreatePage.style.css';
export const PlanCreatePage: React.FC<{ namespace: string }> = ({ namespace }) => {
+ const { t } = useForkliftTranslation();
+
// Get optional initial state context
const { data } = useCreateVmMigrationData();
- const history = useHistory();
- const startAtStep = data?.provider !== undefined ? 2 : 1;
+ const createPlanFromPlansList = !(data?.provider !== undefined);
+ const startAtStep = createPlanFromPlansList ? 1 : 2;
const [activeNamespace, setActiveNamespace] = useActiveNamespace();
const defaultNamespace = process?.env?.DEFAULT_NAMESPACE || 'default';
const projectName =
@@ -29,6 +38,18 @@ export const PlanCreatePage: React.FC<{ namespace: string }> = ({ namespace }) =
(activeNamespace === '#ALL_NS#' ? 'openshift-mtv' : activeNamespace) ||
defaultNamespace;
+ const plansListURL = getResourceUrl({
+ reference: PlanModelRef,
+ namespace: namespace,
+ namespaced: namespace !== undefined,
+ });
+
+ const providerURL = getResourceUrl({
+ reference: ProviderModelRef,
+ name: data?.provider?.metadata?.name,
+ namespace: data?.provider?.metadata?.namespace,
+ });
+
// Init Select source provider form state
const [filterState, filterDispatch] = useReducer(planCreatePageReducer, {
...planCreatePageInitialState,
@@ -59,65 +80,65 @@ 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 anyValidationError = anyValidationErrorExists(state);
+ const planNameValidationDefault = state?.validation?.planName === 'default';
+
+ const title = t('Plans wizard');
- const title = 'Plans wizard';
return (
<>
{'Create migration plan'}
-
-
+
+ window.location.replace(createPlanFromPlansList ? plansListURL : `${providerURL}/vms`)
+ }
onSave={() => {
setActiveNamespace(state.underConstruction.projectName);
dispatch(startCreate());
}}
- onClose={() => history.goBack()}
- startAtStep={startAtStep}
- />
+ >
+
+
+
+
+
+
+
>
);