Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking β€œSign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

upcoming: [M3-7621] - Add PlacementGroups to Linode Migrate Flow #10339

Merged
merged 16 commits into from
Apr 16, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
improve selection types
  • Loading branch information
abailly-akamai committed Apr 11, 2024
commit 49613647327e0dc2a99587cc7b79b739761ab30c
Original file line number Diff line number Diff line change
@@ -35,11 +35,11 @@ interface Props {
backupEnabled: Linode['backups']['enabled'];
currentRegion: string;
errorText?: string;
handlePlacementGroupChange: (selected: PlacementGroup) => void;
handlePlacementGroupChange: (selected: PlacementGroup | null) => void;
handleSelectRegion: (id: string) => void;
helperText?: string;
linodeType: Linode['type'];
selectedRegion: string;
selectedRegion: null | string;
}

export type MigratePricePanelType = 'current' | 'new';
@@ -70,6 +70,10 @@ export const ConfigureForm = React.memo((props: Props) => {
setSelectedPlacementGroup,
] = React.useState<PlacementGroup | null>(null);

React.useEffect(() => {
handlePlacementGroupSelection(null);
}, [selectedRegion]);

const currentActualRegion = regions?.find((r) => r.id === currentRegion);

const newRegion = regions?.find(
@@ -87,7 +91,9 @@ export const ConfigureForm = React.memo((props: Props) => {
const isPlacementGroupSelectDisabled =
!newRegion || !hasRegionPlacementGroupCapability;
abailly-akamai marked this conversation as resolved.
Show resolved Hide resolved

const handlePlacementGroupSelection = (placementGroup: PlacementGroup) => {
const handlePlacementGroupSelection = (
placementGroup: PlacementGroup | null
) => {
setSelectedPlacementGroup(placementGroup);
handlePlacementGroupChange(placementGroup);
};
Original file line number Diff line number Diff line change
@@ -98,11 +98,13 @@ export const MigrateLinode = React.memo((props: Props) => {
const { data: regionsData } = useRegionsQuery();
const flags = useFlags();

const [selectedRegion, handleSelectRegion] = React.useState<string>('');
const [selectedRegion, handleSelectRegion] = React.useState<null | string>(
null
);
const [
placementGroupSelection,
setPlacementGroupSelection,
] = React.useState<PlacementGroup>();
] = React.useState<PlacementGroup | null>();

const [hasConfirmed, setConfirmed] = React.useState<boolean>(false);

@@ -127,7 +129,7 @@ export const MigrateLinode = React.memo((props: Props) => {
if (open) {
reset();
setConfirmed(false);
handleSelectRegion('');
handleSelectRegion(null);
}
}, [open]);

Loading