diff --git a/packages/forklift-console-plugin/src/modules/Providers/views/details/tabs/VirtualMachines/OVirtVirtualMachinesRow.tsx b/packages/forklift-console-plugin/src/modules/Providers/views/details/tabs/VirtualMachines/OVirtVirtualMachinesRow.tsx index affd10dac..7012959cd 100644 --- a/packages/forklift-console-plugin/src/modules/Providers/views/details/tabs/VirtualMachines/OVirtVirtualMachinesRow.tsx +++ b/packages/forklift-console-plugin/src/modules/Providers/views/details/tabs/VirtualMachines/OVirtVirtualMachinesRow.tsx @@ -6,13 +6,7 @@ import { Td } from '@kubev2v/common'; import { OVirtVM } from '@kubev2v/types'; import { PowerStateCellRenderer } from './components/PowerStateCellRenderer'; -import { VMCellProps, VMConcernsCellRenderer, VMNameCellRenderer } from './components'; - -export interface VmData { - vm: OVirtVM; - name: string; - concerns: string; -} +import { VMCellProps, VMConcernsCellRenderer, VmData, VMNameCellRenderer } from './components'; const renderTd = ({ resourceData, resourceFieldId, resourceFields }: RenderTdProps) => { const fieldId = resourceFieldId; diff --git a/packages/forklift-console-plugin/src/modules/Providers/views/details/tabs/VirtualMachines/OvaVirtualMachinesRow.tsx b/packages/forklift-console-plugin/src/modules/Providers/views/details/tabs/VirtualMachines/OvaVirtualMachinesRow.tsx index a80be7774..6d4f7cf46 100644 --- a/packages/forklift-console-plugin/src/modules/Providers/views/details/tabs/VirtualMachines/OvaVirtualMachinesRow.tsx +++ b/packages/forklift-console-plugin/src/modules/Providers/views/details/tabs/VirtualMachines/OvaVirtualMachinesRow.tsx @@ -5,13 +5,7 @@ import { ResourceField, RowProps } from '@kubev2v/common'; import { Td } from '@kubev2v/common'; import { OvaVM } from '@kubev2v/types'; -import { VMCellProps, VMConcernsCellRenderer, VMNameCellRenderer } from './components'; - -export interface VmData { - vm: OvaVM; - name: string; - concerns: string; -} +import { VMCellProps, VMConcernsCellRenderer, VmData, VMNameCellRenderer } from './components'; const renderTd = ({ resourceData, resourceFieldId, resourceFields }: RenderTdProps) => { const fieldId = resourceFieldId; diff --git a/packages/forklift-console-plugin/src/modules/Providers/views/details/tabs/VirtualMachines/VSphereVirtualMachinesRow.tsx b/packages/forklift-console-plugin/src/modules/Providers/views/details/tabs/VirtualMachines/VSphereVirtualMachinesRow.tsx index 5a45f1998..ebee08bef 100644 --- a/packages/forklift-console-plugin/src/modules/Providers/views/details/tabs/VirtualMachines/VSphereVirtualMachinesRow.tsx +++ b/packages/forklift-console-plugin/src/modules/Providers/views/details/tabs/VirtualMachines/VSphereVirtualMachinesRow.tsx @@ -9,15 +9,10 @@ import { PowerStateCellRenderer, VMCellProps, VMConcernsCellRenderer, + VmData, VMNameCellRenderer, } from './components'; -export interface VmData { - vm: VSphereVM; - name: string; - concerns: string; -} - const renderTd = ({ resourceData, resourceFieldId, resourceFields }: RenderTdProps) => { const fieldId = resourceFieldId; diff --git a/packages/forklift-console-plugin/src/modules/Providers/views/details/tabs/VirtualMachines/components/VMCellProps.ts b/packages/forklift-console-plugin/src/modules/Providers/views/details/tabs/VirtualMachines/components/VMCellProps.ts index c1c07493b..42f263479 100644 --- a/packages/forklift-console-plugin/src/modules/Providers/views/details/tabs/VirtualMachines/components/VMCellProps.ts +++ b/packages/forklift-console-plugin/src/modules/Providers/views/details/tabs/VirtualMachines/components/VMCellProps.ts @@ -4,6 +4,7 @@ import { ProviderVirtualMachine } from '@kubev2v/types'; export interface VmData { vm: ProviderVirtualMachine; name: string; + namespace: string; isProviderLocalOpenshift?: boolean; } diff --git a/packages/forklift-console-plugin/src/modules/Providers/views/details/tabs/VirtualMachines/utils/useInventoryVms.tsx b/packages/forklift-console-plugin/src/modules/Providers/views/details/tabs/VirtualMachines/utils/useInventoryVms.tsx index 0c66c64c1..f5330a53a 100644 --- a/packages/forklift-console-plugin/src/modules/Providers/views/details/tabs/VirtualMachines/utils/useInventoryVms.tsx +++ b/packages/forklift-console-plugin/src/modules/Providers/views/details/tabs/VirtualMachines/utils/useInventoryVms.tsx @@ -1,8 +1,8 @@ import { useProviderInventory, UseProviderInventoryParams } from 'src/modules/Providers/hooks'; import { ProviderData } from 'src/modules/Providers/utils'; -import { isProviderLocalOpenshift } from 'src/utils/resources'; +import { isProviderLocalOpenshift, isProviderOpenshift } from 'src/utils/resources'; -import { ProviderVirtualMachine } from '@kubev2v/types'; +import { OpenshiftVM, ProviderVirtualMachine } from '@kubev2v/types'; import { VmData } from '../components'; @@ -45,6 +45,7 @@ export const useInventoryVms = ( providerType: provider?.spec?.type, } as ProviderVirtualMachine, name: vm.name, + namespace: isProviderOpenshift(validProvider) ? (vm as OpenshiftVM).namespace : undefined, isProviderLocalOpenshift: isProviderLocalOpenshift(validProvider), })) : []; diff --git a/packages/forklift-console-plugin/src/modules/Providers/views/migrate/reducer/createInitialState.ts b/packages/forklift-console-plugin/src/modules/Providers/views/migrate/reducer/createInitialState.ts index 1040993c2..2e68d2cc0 100644 --- a/packages/forklift-console-plugin/src/modules/Providers/views/migrate/reducer/createInitialState.ts +++ b/packages/forklift-console-plugin/src/modules/Providers/views/migrate/reducer/createInitialState.ts @@ -53,7 +53,11 @@ export const createInitialState = ({ destination: undefined, }, targetNamespace: undefined, - vms: selectedVms.map((data) => ({ name: data.name, id: toId(data) })), + vms: selectedVms.map((data) => ({ + name: data.name, + namespace: data.namespace, + id: toId(data), + })), }, }, netMap: { diff --git a/packages/forklift-console-plugin/src/utils/resources.ts b/packages/forklift-console-plugin/src/utils/resources.ts index 4bcfea937..f793ef262 100644 --- a/packages/forklift-console-plugin/src/utils/resources.ts +++ b/packages/forklift-console-plugin/src/utils/resources.ts @@ -42,7 +42,13 @@ export const referenceForObj = (obj: K8sResourceCommon) => { }; /** - * Can this provider be considered a local target provider? + * Can this provider be considered a local openshift provider? */ export const isProviderLocalOpenshift = (provider: V1beta1Provider): boolean => provider?.spec?.type === 'openshift' && (!provider?.spec?.url || provider?.spec?.url === ''); + +/** + * Is this provider an openshift provider? + */ +export const isProviderOpenshift = (provider: V1beta1Provider): boolean => + provider?.spec?.type === 'openshift';