Skip to content

Commit 1e1dbf6

Browse files
committed
Resolves: MTV-3562 | Replace deprecated Modal/Tile/DragDrop components
Signed-off-by: Jeff Puzzo <[email protected]>
1 parent aa92d8c commit 1e1dbf6

File tree

20 files changed

+508
-493
lines changed

20 files changed

+508
-493
lines changed

locales/en/plugin__forklift-console-plugin.json

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
{
22
" tasks": " tasks",
33
" To troubleshoot, check the <3>Virtual machines tab</3>.": " To troubleshoot, check the <3>Virtual machines tab</3>.",
4-
"- .DiskIndex: initial volume index of the disk": "- .DiskIndex: initial volume index of the disk",
5-
"- .FileName: name of the file in the source provider (vmWare only, require guest agent)": "- .FileName: name of the file in the source provider (vmWare only, require guest agent)",
6-
"- .NetworkIndex: sequential index of the network interface (0-based)": "- .NetworkIndex: sequential index of the network interface (0-based)",
7-
"- .NetworkName: If target network is multus, name of the Multus network attachment definition, empty otherwise.": "- .NetworkName: If target network is multus, name of the Multus network attachment definition, empty otherwise.",
8-
"- .NetworkNamespace: If target network is multus, namespace where the network attachment definition is located.": "- .NetworkNamespace: If target network is multus, namespace where the network attachment definition is located.",
9-
"- .NetworkType: type of the network (\"Multus\" or \"Default\")": "- .NetworkType: type of the network (\"Multus\" or \"Default\")",
10-
"- .PlanName: name of the migration plan": "- .PlanName: name of the migration plan",
11-
"- .PVCName: name of the PVC mounted to the VM using this volume": "- .PVCName: name of the PVC mounted to the VM using this volume",
12-
"- .RootDiskIndex: index of the root disk": "- .RootDiskIndex: index of the root disk",
13-
"- .Shared: true if the volume is shared by multiple VMs, false otherwise": "- .Shared: true if the volume is shared by multiple VMs, false otherwise",
14-
"- .VmName: name of the VM": "- .VmName: name of the VM",
15-
"- .VolumeIndex: sequential index of the volume interface (0-based)": "- .VolumeIndex: sequential index of the volume interface (0-based)",
16-
"- .WinDriveLetter: Windows drive letter (lower case, if applicable, e.g. \"c\", require guest agent)": "- .WinDriveLetter: Windows drive letter (lower case, if applicable, e.g. \"c\", require guest agent)",
4+
".DiskIndex: initial volume index of the disk": ".DiskIndex: initial volume index of the disk",
5+
".FileName: name of the file in the source provider (vmWare only, require guest agent)": ".FileName: name of the file in the source provider (vmWare only, require guest agent)",
6+
".NetworkIndex: sequential index of the network interface (0-based)": ".NetworkIndex: sequential index of the network interface (0-based)",
7+
".NetworkName: If target network is multus, name of the Multus network attachment definition, empty otherwise.": ".NetworkName: If target network is multus, name of the Multus network attachment definition, empty otherwise.",
8+
".NetworkNamespace: If target network is multus, namespace where the network attachment definition is located.": ".NetworkNamespace: If target network is multus, namespace where the network attachment definition is located.",
9+
".NetworkType: type of the network (\"Multus\" or \"Default\")": ".NetworkType: type of the network (\"Multus\" or \"Default\")",
10+
".PlanName: name of the migration plan": ".PlanName: name of the migration plan",
11+
".PVCName: name of the PVC mounted to the VM using this volume": ".PVCName: name of the PVC mounted to the VM using this volume",
12+
".RootDiskIndex: index of the root disk": ".RootDiskIndex: index of the root disk",
13+
".Shared: true if the volume is shared by multiple VMs, false otherwise": ".Shared: true if the volume is shared by multiple VMs, false otherwise",
14+
".VmName: name of the VM": ".VmName: name of the VM",
15+
".VolumeIndex: sequential index of the volume interface (0-based)": ".VolumeIndex: sequential index of the volume interface (0-based)",
16+
".WinDriveLetter: Windows drive letter (lower case, if applicable, e.g. \"c\", require guest agent)": ".WinDriveLetter: Windows drive letter (lower case, if applicable, e.g. \"c\", require guest agent)",
1717
"'must-gather' CLI logs": "'must-gather' CLI logs",
1818
"(Inherited from plan)": "(Inherited from plan)",
1919
"{{completed}} of {{total}} {{name}}": "{{completed}} of {{total}} {{name}}",
@@ -52,7 +52,7 @@
5252
"<0><0>Configure disk decryption for LUKS-encrypted devices. You can use network-bound decryption (NBDE/Clevis) for automatic unlocking via Tang servers, or provide manual passphrases. These settings apply to all VMs in the migration plan.</0><1>For manual passphrases, Migration Toolkit for Virtualization (MTV) tries each passphrase until one unlocks the device. <2>Learn more</2>.</1></0>": "<0><0>Configure disk decryption for LUKS-encrypted devices. You can use network-bound decryption (NBDE/Clevis) for automatic unlocking via Tang servers, or provide manual passphrases. These settings apply to all VMs in the migration plan.</0><1>For manual passphrases, Migration Toolkit for Virtualization (MTV) tries each passphrase until one unlocks the device. <2>Learn more</2>.</1></0>",
5353
"<0><0>Duplicate plan <1>{name}</1>?</0><1><0></0></1><2>All needed Mappings and Hooks will be duplicated and attached to the new Plan.</2><3>Storage map: <1>{storageMap?.metadata?.name}</1></3><4>Network map: <1>{networkMap?.metadata?.name}</1></4></0>": "<0><0>Duplicate plan <1>{name}</1>?</0><1><0></0></1><2>All needed Mappings and Hooks will be duplicated and attached to the new Plan.</2><3>Storage map: <1>{storageMap?.metadata?.name}</1></3><4>Network map: <1>{networkMap?.metadata?.name}</1></4></0>",
5454
"<0><0>If checked, compatibility devices (SATA bus, E1000E NIC) will be used to ensure boot-ability.</0><1>If unchecked, high-performance VirtIO devices will be used. This requires VirtIO drivers already installed in the source VM.</1></0>": "<0><0>If checked, compatibility devices (SATA bus, E1000E NIC) will be used to ensure boot-ability.</0><1>If unchecked, high-performance VirtIO devices will be used. This requires VirtIO drivers already installed in the source VM.</1></0>",
55-
"<0><0>MTV behavior is based on the <1>Shared disks</1> setting in the plan.</0><1>If this is set to <1>true</1>, the shared disks will be migrated.</1><2>If this is set to <1>false</1>, the shared disks will not be migrated.</2></0>": "<0><0>MTV behavior is based on the <1>Shared disks</1> setting in the plan.</0><1>If this is set to <1>true</1>, the shared disks will be migrated.</1><2>If this is set to <1>false</1>, the shared disks will not be migrated.</2></0>",
55+
"<0><0>MTV behavior is based on the <1>Shared disks</1> setting in the plan.</0><1>If this is set to <1>true</1>, the shared disks will be migrated.<3></3>If this is set to <5>false</5>, the shared disks will not be migrated.</1></0>": "<0><0>MTV behavior is based on the <1>Shared disks</1> setting in the plan.</0><1>If this is set to <1>true</1>, the shared disks will be migrated.<3></3>If this is set to <5>false</5>, the shared disks will not be migrated.</1></0>",
5656
"<0><0>Schedule the cutover for migration <2>{getName(plan)}</2>?</0><1>You can schedule cutover for now or a future date and time. VMs included in the migration plan will be shut down when cutover starts.</1></0>": "<0><0>Schedule the cutover for migration <2>{getName(plan)}</2>?</0><1>You can schedule cutover for now or a future date and time. VMs included in the migration plan will be shut down when cutover starts.</1></0>",
5757
"<0><0>Sets the maximum number of virtual machines or disks that can be migrated simultaneously, varies by the source provider type and by the settings of the migration.</0><1>The default value is 20 virtual machines or disks.</1><2><0>Learn more</0></2></0>": "<0><0>Sets the maximum number of virtual machines or disks that can be migrated simultaneously, varies by the source provider type and by the settings of the migration.</0><1>The default value is 20 virtual machines or disks.</1><2><0>Learn more</0></2></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.",
@@ -1086,7 +1086,6 @@
10861086
"Validation Failed": "Validation Failed",
10871087
"Value": "Value",
10881088
"Values": "Values",
1089-
"Variables that can be used for the template:": "Variables that can be used for the template:",
10901089
"vCenter": "vCenter",
10911090
"VDDK init image": "VDDK init image",
10921091
"VDDK init image archive": "VDDK init image archive",

src/components/AffinityModal/AffinityEditModal.tsx

Lines changed: 21 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { type Dispatch, type SetStateAction, useState } from 'react';
22

33
import type { ModalComponent } from '@openshift-console/dynamic-plugin-sdk/lib/app/modal-support/ModalProvider';
44
import { Button, ButtonVariant } from '@patternfly/react-core';
5-
import { Modal, ModalVariant } from '@patternfly/react-core/deprecated';
5+
import { Modal, ModalBody, ModalFooter, ModalHeader, ModalVariant } from '@patternfly/react-core';
66
import { useForkliftTranslation } from '@utils/i18n';
77

88
import { useIDEntities } from './hooks/useIDEntities';
@@ -33,7 +33,23 @@ const AffinityEditModal: ModalComponent<AffinityEditModalProps> = ({
3333
return (
3434
<Modal
3535
data-testid="affinity-edit-modal"
36-
actions={[
36+
className="ocs-modal co-catalog-page__overlay"
37+
isOpen
38+
onClose={closeModal}
39+
position="top"
40+
variant={ModalVariant.medium}
41+
>
42+
<ModalHeader title={title} />
43+
<ModalBody>
44+
<AffinityForm
45+
expressions={expressions}
46+
fields={fields}
47+
focusedAffinity={focusedAffinity}
48+
setFocusedAffinity={setFocusedAffinity}
49+
setSubmitDisabled={setIsDisabled}
50+
/>
51+
</ModalBody>
52+
<ModalFooter>
3753
<Button
3854
key="confirm"
3955
data-testid="save-affinity-rule-button"
@@ -48,30 +64,16 @@ const AffinityEditModal: ModalComponent<AffinityEditModalProps> = ({
4864
variant={ButtonVariant.primary}
4965
>
5066
{t('Save affinity rule')}
51-
</Button>,
67+
</Button>
5268
<Button
5369
key="cancel"
5470
data-testid="cancel-affinity-rule-button"
5571
onClick={onCancel}
5672
variant={ButtonVariant.link}
5773
>
5874
{t('Cancel')}
59-
</Button>,
60-
]}
61-
className="ocs-modal co-catalog-page__overlay"
62-
isOpen
63-
onClose={closeModal}
64-
position="top"
65-
title={title}
66-
variant={ModalVariant.medium}
67-
>
68-
<AffinityForm
69-
expressions={expressions}
70-
fields={fields}
71-
focusedAffinity={focusedAffinity}
72-
setFocusedAffinity={setFocusedAffinity}
73-
setSubmitDisabled={setIsDisabled}
74-
/>
75+
</Button>
76+
</ModalFooter>
7577
</Modal>
7678
);
7779
};

src/components/ModalForm/ModalForm.tsx

Lines changed: 30 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,14 @@ import {
88
Button,
99
type ButtonProps,
1010
ButtonVariant,
11+
Modal,
12+
ModalBody,
13+
ModalFooter,
14+
ModalHeader,
1115
ModalVariant,
16+
Stack,
17+
StackItem,
1218
} from '@patternfly/react-core';
13-
import { Modal } from '@patternfly/react-core/deprecated';
1419
import { useForkliftTranslation } from '@utils/i18n';
1520

1621
type ModalFormProps = {
@@ -62,13 +67,26 @@ const ModalForm: ModalComponent<ModalFormProps> = ({
6267
return (
6368
<Modal
6469
variant={variant}
65-
title={title}
6670
isOpen
67-
showClose={false}
6871
position="top"
6972
onClose={closeModal}
7073
data-testid={testId}
71-
actions={[
74+
className={className}
75+
>
76+
<ModalHeader title={title} />
77+
<ModalBody>
78+
<Stack hasGutter>
79+
<StackItem>{children}</StackItem>
80+
{error && (
81+
<StackItem>
82+
<Alert title={t('Error')} variant={AlertVariant.danger} isInline>
83+
{t('{{errorMessage}}', { errorMessage: error })}
84+
</Alert>
85+
</StackItem>
86+
)}
87+
</Stack>
88+
</ModalBody>
89+
<ModalFooter>
7290
<Button
7391
key="confirm"
7492
variant={confirmVariant ?? ButtonVariant.primary}
@@ -78,32 +96,21 @@ const ModalForm: ModalComponent<ModalFormProps> = ({
7896
data-testid="modal-confirm-button"
7997
>
8098
{confirmLabel ?? t('Save')}
81-
</Button>,
82-
...(additionalAction
83-
? [
84-
<Button key="secondary" {...additionalAction}>
85-
{additionalAction?.children}
86-
</Button>,
87-
]
88-
: []),
99+
</Button>
100+
{additionalAction && (
101+
<Button key="secondary" {...additionalAction}>
102+
{additionalAction?.children}
103+
</Button>
104+
)}
89105
<Button
90106
key="cancel"
91107
variant={ButtonVariant.secondary}
92108
onClick={closeModal}
93109
data-testid="modal-cancel-button"
94110
>
95111
{cancelLabel ?? t('Cancel')}
96-
</Button>,
97-
]}
98-
className={className}
99-
>
100-
{children}
101-
102-
{error && (
103-
<Alert title={t('Error')} variant={AlertVariant.danger} isInline>
104-
{t('{{errorMessage}}', { errorMessage: error })}
105-
</Alert>
106-
)}
112+
</Button>
113+
</ModalFooter>
107114
</Modal>
108115
);
109116
};
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
11
.forklift-provider-icon-link {
22
margin-right: var(--pf-t--global--spacer--sm);
3+
width: var(--pf-t--global--icon--size--xl);
4+
height: var(--pf-t--global--icon--size--xl);
5+
display: flex;
6+
align-items: center;
7+
justify-content: center;
8+
flex-shrink: 0;
39
}

0 commit comments

Comments
 (0)