From cb7a7b06599e06c5936d4ad63986ec7a446fb888 Mon Sep 17 00:00:00 2001 From: Feroze Mohideen Date: Mon, 29 Apr 2024 15:07:58 -0400 Subject: [PATCH] do not alert on reprovision (#4588) --- .../ClusterFormContextProvider.tsx | 21 +++++++++++-------- .../forms/CreateClusterForm.tsx | 2 +- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/dashboard/src/main/home/infrastructure-dashboard/ClusterFormContextProvider.tsx b/dashboard/src/main/home/infrastructure-dashboard/ClusterFormContextProvider.tsx index fe405337c3..939c77a9a5 100644 --- a/dashboard/src/main/home/infrastructure-dashboard/ClusterFormContextProvider.tsx +++ b/dashboard/src/main/home/infrastructure-dashboard/ClusterFormContextProvider.tsx @@ -68,7 +68,7 @@ type ClusterFormContextProviderProps = { projectId?: number; isAdvancedSettingsEnabled?: boolean; isMultiClusterEnabled?: boolean; - redirectOnSubmit?: boolean; + isCreatingCluster?: boolean; children: JSX.Element; }; @@ -76,7 +76,7 @@ const ClusterFormContextProvider: React.FC = ({ projectId, isAdvancedSettingsEnabled = false, isMultiClusterEnabled = false, - redirectOnSubmit, + isCreatingCluster, children, }) => { const history = useHistory(); @@ -179,12 +179,6 @@ const ClusterFormContextProvider: React.FC = ({ setShowFailedPreflightChecksModal(true); } if (response.createContractResponse) { - void reportToAnalytics({ - projectId, - step: "provisioning-started", - provider: data.cluster.cloudProvider, - region: data.cluster.config.region, - }); await api.saveOnboardingState( "", { current_step: "clean_up" }, @@ -192,7 +186,13 @@ const ClusterFormContextProvider: React.FC = ({ ); await queryClient.invalidateQueries(["getCluster"]); - if (redirectOnSubmit) { + if (isCreatingCluster) { + void reportToAnalytics({ + projectId, + step: "provisioning-started", + provider: data.cluster.cloudProvider, + region: data.cluster.config.region, + }); history.push( `/infrastructure/${response.createContractResponse.contract_revision.cluster_id}` ); @@ -230,6 +230,9 @@ const ClusterFormContextProvider: React.FC = ({ cloudProviderCredentialIdentifier: string, region: string ): Promise => { + if (!projectId) { + return []; + } const response = await api.cloudProviderMachineTypes( "", { diff --git a/dashboard/src/main/home/infrastructure-dashboard/forms/CreateClusterForm.tsx b/dashboard/src/main/home/infrastructure-dashboard/forms/CreateClusterForm.tsx index 4f2f1c0634..431c0f25c3 100644 --- a/dashboard/src/main/home/infrastructure-dashboard/forms/CreateClusterForm.tsx +++ b/dashboard/src/main/home/infrastructure-dashboard/forms/CreateClusterForm.tsx @@ -51,9 +51,9 @@ const CreateClusterForm: React.FC = () => { return ( {match(selectedCloudProvider)