Skip to content

Commit

Permalink
do not alert on reprovision (#4588)
Browse files Browse the repository at this point in the history
  • Loading branch information
Feroze Mohideen authored Apr 29, 2024
1 parent 2e67a70 commit cb7a7b0
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -68,15 +68,15 @@ type ClusterFormContextProviderProps = {
projectId?: number;
isAdvancedSettingsEnabled?: boolean;
isMultiClusterEnabled?: boolean;
redirectOnSubmit?: boolean;
isCreatingCluster?: boolean;
children: JSX.Element;
};

const ClusterFormContextProvider: React.FC<ClusterFormContextProviderProps> = ({
projectId,
isAdvancedSettingsEnabled = false,
isMultiClusterEnabled = false,
redirectOnSubmit,
isCreatingCluster,
children,
}) => {
const history = useHistory();
Expand Down Expand Up @@ -179,20 +179,20 @@ const ClusterFormContextProvider: React.FC<ClusterFormContextProviderProps> = ({
setShowFailedPreflightChecksModal(true);
}
if (response.createContractResponse) {
void reportToAnalytics({
projectId,
step: "provisioning-started",
provider: data.cluster.cloudProvider,
region: data.cluster.config.region,
});
await api.saveOnboardingState(
"<token>",
{ current_step: "clean_up" },
{ project_id: projectId }
);
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}`
);
Expand Down Expand Up @@ -230,6 +230,9 @@ const ClusterFormContextProvider: React.FC<ClusterFormContextProviderProps> = ({
cloudProviderCredentialIdentifier: string,
region: string
): Promise<MachineType[]> => {
if (!projectId) {
return [];
}
const response = await api.cloudProviderMachineTypes(
"<token>",
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,9 @@ const CreateClusterForm: React.FC = () => {
return (
<ClusterFormContextProvider
projectId={currentProject?.id}
redirectOnSubmit={true}
isAdvancedSettingsEnabled={currentProject?.advanced_infra_enabled}
isMultiClusterEnabled={currentProject?.multi_cluster}
isCreatingCluster
>
<CreateClusterFormContainer>
{match(selectedCloudProvider)
Expand Down

0 comments on commit cb7a7b0

Please sign in to comment.