From eed0e0d64a341825698010afa4b66259e0c8b940 Mon Sep 17 00:00:00 2001 From: mrrishi Date: Thu, 13 Feb 2025 14:21:43 +0530 Subject: [PATCH 1/2] fix: send api calls with ami type --- containers/ClusterForms/shared/SetupForm.tsx | 18 ++++++++++++++++++ package.json | 3 ++- redux/thunks/api.thunk.ts | 11 +++++++++-- 3 files changed, 29 insertions(+), 3 deletions(-) diff --git a/containers/ClusterForms/shared/SetupForm.tsx b/containers/ClusterForms/shared/SetupForm.tsx index 8c438e77..23280191 100644 --- a/containers/ClusterForms/shared/SetupForm.tsx +++ b/containers/ClusterForms/shared/SetupForm.tsx @@ -95,6 +95,9 @@ const SetupForm: FunctionComponent = () => { const handleRegionChange = useCallback( (region: string) => { setSelectedRegion(region); + if (installType == InstallationType.AWS) { + return; + } // if using google hold off on grabbing instances // since it requires the zone as well @@ -112,6 +115,20 @@ const SetupForm: FunctionComponent = () => { [dispatch, installType, values], ); + const handleAmiTypeSelect = useCallback( + (amiType: string) => { + dispatch( + getInstanceSizes({ + installType, + region: selectedRegion as string, + values, + amiType, + }), + ); + }, + [dispatch, installType, selectedRegion, values], + ); + const handleZoneSelect = useCallback( (zone: string) => { if (cloudRegion) { @@ -228,6 +245,7 @@ const SetupForm: FunctionComponent = () => { value: amiType, }))} defaultValue={AWS_AMI_TYPES[0]} + onChange={handleAmiTypeSelect} /> )} ('api/getInstanceSizes', async ({ region, installType, values, zone }) => { +>('api/getInstanceSizes', async ({ region, installType, values, zone, amiType }) => { const { instance_sizes } = ( await axios.post<{ instance_sizes: string[] }>('/api/proxy', { url: `/instance-sizes/${installType}`, @@ -186,6 +192,7 @@ export const getInstanceSizes = createAsyncThunk< ...values, cloud_region: region, cloud_zone: zone, + ami_type: amiType, }, }) ).data; From f6e005c73d292558a22b2a01c07bf9831e258ae1 Mon Sep 17 00:00:00 2001 From: Rishi <117034340+jokestax@users.noreply.github.com> Date: Thu, 13 Feb 2025 20:30:04 +0530 Subject: [PATCH 2/2] Update package.json --- package.json | 1 - 1 file changed, 1 deletion(-) diff --git a/package.json b/package.json index dc55790a..c0d2b917 100644 --- a/package.json +++ b/package.json @@ -126,5 +126,4 @@ "node": "18.18.0", "yarn": "1.22.19" }, - "packageManager": "yarn@1.22.22+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e" }