Skip to content

Commit 1e29b6e

Browse files
authored
Resolves: MTV-3979 | Make VDDK edit modal consistent with wizard (#2169)
Signed-off-by: Aviv Turgeman <[email protected]>
1 parent 48844d6 commit 1e29b6e

File tree

21 files changed

+407
-476
lines changed

21 files changed

+407
-476
lines changed

locales/en/plugin__forklift-console-plugin.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,11 +57,11 @@
5757
"<0><0>Target provider <1>{targetProviderName}</1> does not have network mappings available in any existing projects.</0><1>Create a project or select a different target provider.</1></0>": "<0><0>Target provider <1>{targetProviderName}</1> does not have network mappings available in any existing projects.</0><1>Create a project or select a different target provider.</1></0>",
5858
"<0>Critical: </0> VM migration will fail due to this issue. Action must be taken to remove the critical concern.": "<0>Critical: </0> VM migration will fail due to this issue. Action must be taken to remove the critical concern.",
5959
"<0>Informational:</0> Will not cause a big impact on your VMs.": "<0>Informational:</0> Will not cause a big impact on your VMs.",
60-
"<0>It is strongly recommended to use a VDDK image. Not using a VDDK image could result in significantly lower migration speeds or a plan failing. For more information, see <2>Creating a VDDK image</2>.</0>": "<0>It is strongly recommended to use a VDDK image. Not using a VDDK image could result in significantly lower migration speeds or a plan failing. For more information, see <2>Creating a VDDK image</2>.</0>",
6160
"<0>Link for the OpenShift Virtualization web console UI.</0><1>Use this link to access the user interface for the provider's virtualization management.</1><2>If no link value is specify then a default auto calculated or an empty value is set.</2>": "<0>Link for the OpenShift Virtualization web console UI.</0><1>Use this link to access the user interface for the provider's virtualization management.</1><2>If no link value is specify then a default auto calculated or an empty value is set.</2>",
6261
"<0>Link for the OpenStack dashboard UI.</0><1>Use this link to access the user interface for the provider's virtualization management.</1><2>If no link value is specify then a default auto calculated or an empty value is set.</2>": "<0>Link for the OpenStack dashboard UI.</0><1>Use this link to access the user interface for the provider's virtualization management.</1><2>If no link value is specify then a default auto calculated or an empty value is set.</2>",
6362
"<0>Link for the Red Hat Virtualization Manager landing page.</0><1>Use this link to access the user interface for the provider's virtualization management.</1><2>If no link value is specify then a default auto calculated or an empty value is set.</2>": "<0>Link for the Red Hat Virtualization Manager landing page.</0><1>Use this link to access the user interface for the provider's virtualization management.</1><2>If no link value is specify then a default auto calculated or an empty value is set.</2>",
6463
"<0>Link for the VMware vSphere UI.</0><1>Use this link to access the user interface for the provider's virtualization management.</1><2>If no link value is specify then a default auto calculated or an empty value is set.</2>": "<0>Link for the VMware vSphere UI.</0><1>Use this link to access the user interface for the provider's virtualization management.</1><2>If no link value is specify then a default auto calculated or an empty value is set.</2>",
64+
"<0>Not using a VDDK image could result in significantly lower migration speeds or a plan failing. For more information, see <2>Creating a VDDK image</2></0>": "<0>Not using a VDDK image could result in significantly lower migration speeds or a plan failing. For more information, see <2>Creating a VDDK image</2></0>",
6565
"<0>Open a support case</0> on your Red Hat Customer Portal and attach the compressed file.": "<0>Open a support case</0> on your Red Hat Customer Portal and attach the compressed file.",
6666
"<0>Select <1>Skip certificate validation</1> to skip certificate verification, which proceeds with an insecure migration and then the certificate is not required. Insecure migration means that the transferred data is sent over an insecure connection and potentially sensitive data could be exposed.</0>": "<0>Select <1>Skip certificate validation</1> to skip certificate verification, which proceeds with an insecure migration and then the certificate is not required. Insecure migration means that the transferred data is sent over an insecure connection and potentially sensitive data could be exposed.</0>",
6767
"<0>Start the {migrationType} migration for plan <4>{name}</4>?</0><1>{migrationMessage}</1>": "<0>Start the {migrationType} migration for plan <4>{name}</4>?</0><1>{migrationMessage}</1>",
@@ -354,7 +354,7 @@
354354
"Edit target name": "Edit target name",
355355
"Edit target power state": "Edit target power state",
356356
"Edit URL": "Edit URL",
357-
"Edit VDDK init image": "Edit VDDK init image",
357+
"Edit VDDK image": "Edit VDDK image",
358358
"Edit VM target affinity rules": "Edit VM target affinity rules",
359359
"Edit VM target labels": "Edit VM target labels",
360360
"Edit VM target node selector": "Edit VM target node selector",
@@ -521,6 +521,7 @@
521521
"Is the guest operating system of your source VM officially supported by OpenShift Virtualization?": "Is the guest operating system of your source VM officially supported by OpenShift Virtualization?",
522522
"Issuer": "Issuer",
523523
"Issues we have detected that might impact your virtual machines or their ability to migrate. There is no guarantee for a successful migration with any of the issues.": "Issues we have detected that might impact your virtual machines or their ability to migrate. There is no guarantee for a successful migration with any of the issues.",
524+
"It is highly recommended to use a VDDK image.": "It is highly recommended to use a VDDK image.",
524525
"Jobs": "Jobs",
525526
"Key": "Key",
526527
"Key terminology": "Key terminology",
@@ -937,7 +938,6 @@
937938
"Skip guest conversion": "Skip guest conversion",
938939
"Skip to review": "Skip to review",
939940
"Skip VDDK setup (not recommended)": "Skip VDDK setup (not recommended)",
940-
"Skip VMware Virtual Disk Development Kit (VDDK) SDK acceleration (not recommended).": "Skip VMware Virtual Disk Development Kit (VDDK) SDK acceleration (not recommended).",
941941
"Small precopy interval": "Small precopy interval",
942942
"Snapshot polling interval": "Snapshot polling interval",
943943
"Some fields may not be supported.": "Some fields may not be supported.",

src/modules/Providers/views/details/ProviderDetailsPage.style.css

Lines changed: 0 additions & 53 deletions
This file was deleted.

src/modules/Providers/views/migrate/reducer/getNetworksUsedBySelectedVMs.ts

Lines changed: 0 additions & 53 deletions
This file was deleted.

src/plans/create/steps/network-map/utils.ts

Lines changed: 48 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { toNetworks } from 'src/modules/Providers/views/migrate/reducer/getNetworksUsedBySelectedVMs';
21
import { PROVIDER_TYPES } from 'src/providers/utils/constants';
32

43
import type {
@@ -16,7 +15,6 @@ import { hasMultiplePodNetworkMappings } from '../../utils/hasMultiplePodNetwork
1615
import { getMapResourceLabel } from '../utils';
1716

1817
import { defaultNetMapping, NetworkMapFieldId, type NetworkMapping } from './constants';
19-
2018
type NetworkMappingId = `${NetworkMapFieldId.NetworkMap}.${number}.${keyof NetworkMapping}`;
2119

2220
type ValidateNetworkMapParams = {
@@ -26,6 +24,54 @@ type ValidateNetworkMapParams = {
2624
oVirtNicProfiles: OVirtNicProfile[];
2725
};
2826

27+
import type { EnhancedOvaVM } from '@utils/crds/plans/type-enhancements';
28+
29+
const toNetworksOrProfiles = (vm: ProviderVirtualMachine): string[] => {
30+
switch (vm.providerType) {
31+
case 'vsphere': {
32+
return vm?.networks?.map((network) => network?.id) ?? [];
33+
}
34+
case 'openstack': {
35+
return Object.keys(vm?.addresses ?? {});
36+
}
37+
case 'ovirt': {
38+
return vm?.nics?.map((nic) => nic?.profile) ?? [];
39+
}
40+
case 'openshift': {
41+
return (vm?.object?.spec?.template?.spec?.networks ?? []).reduce((acc: string[], network) => {
42+
const networkName = network?.multus?.networkName ?? network?.name;
43+
44+
if (network?.pod) {
45+
acc.push(DEFAULT_NETWORK);
46+
} else if (networkName) {
47+
acc.push(networkName);
48+
}
49+
return acc;
50+
}, []);
51+
}
52+
case 'ova': {
53+
return (vm as EnhancedOvaVM)?.networks?.map((network) => network.ID) ?? [];
54+
}
55+
default:
56+
return [];
57+
}
58+
};
59+
60+
const toNetworks = (vm: ProviderVirtualMachine, nicProfiles?: OVirtNicProfile[]): string[] => {
61+
return toNetworksOrProfiles(vm).reduce((acc: string[], network) => {
62+
const nicProfileNetwork = nicProfiles?.find(
63+
(nicProfile) => nicProfile?.id === network,
64+
)?.network;
65+
if (vm.providerType === 'ovirt' && nicProfileNetwork) {
66+
acc.push(nicProfileNetwork);
67+
} else {
68+
acc.push(network);
69+
}
70+
71+
return acc;
72+
}, []);
73+
};
74+
2975
/**
3076
* Creates a field ID for a network mapping at a specific index
3177
* Used for form field identification and validation
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import type { FC } from 'react';
2+
import { CREATE_VDDK_HELP_LINK } from 'src/plans/details/utils/constants';
3+
4+
import { ExternalLink } from '@components/common/ExternalLink/ExternalLink';
5+
import { Alert, AlertVariant } from '@patternfly/react-core';
6+
import { ForkliftTrans, useForkliftTranslation } from '@utils/i18n';
7+
8+
const SkipVddkAlert: FC = () => {
9+
const { t } = useForkliftTranslation();
10+
11+
return (
12+
<Alert
13+
variant={AlertVariant.warning}
14+
isInline
15+
title={t('It is highly recommended to use a VDDK image.')}
16+
>
17+
<ForkliftTrans>
18+
<p>
19+
Not using a VDDK image could result in significantly lower migration speeds or a plan
20+
failing. For more information, see{' '}
21+
<ExternalLink isInline href={CREATE_VDDK_HELP_LINK}>
22+
Creating a VDDK image
23+
</ExternalLink>
24+
</p>
25+
</ForkliftTrans>
26+
</Alert>
27+
);
28+
};
29+
30+
export default SkipVddkAlert;
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
import type { FC } from 'react';
2+
import { useController, useFormContext } from 'react-hook-form';
3+
4+
import { Checkbox } from '@patternfly/react-core';
5+
import { useForkliftTranslation } from '@utils/i18n';
6+
7+
import { ProviderFormFieldId } from '../create/fields/constants';
8+
9+
const VDDKAioOptimizationCheckbox: FC = () => {
10+
const { t } = useForkliftTranslation();
11+
12+
const { control } = useFormContext();
13+
14+
const {
15+
field: { onChange, value },
16+
} = useController({
17+
control,
18+
name: ProviderFormFieldId.VsphereUseVddkAioOptimization,
19+
});
20+
21+
return (
22+
<Checkbox
23+
label={t('Use VMware Virtual Disk Development Kit (VDDK) async IO Optimization.')}
24+
isChecked={value}
25+
onChange={onChange}
26+
id={ProviderFormFieldId.VsphereUseVddkAioOptimization}
27+
name={ProviderFormFieldId.VsphereUseVddkAioOptimization}
28+
data-testid="vddk-aio-optimization-checkbox"
29+
className="pf-v6-u-mt-xs"
30+
/>
31+
);
32+
};
33+
34+
export default VDDKAioOptimizationCheckbox;
File renamed without changes.

0 commit comments

Comments
 (0)