From c8a5f02c3b3532be9a7ed012c59d654c5ae2f447 Mon Sep 17 00:00:00 2001 From: Rares Mardare Date: Thu, 18 Apr 2024 17:23:06 +0300 Subject: [PATCH] Prevent calling contact point endpoint for other integrations (#4250) # What this PR does Right now there's an issue where we call the contact point endpoint upon integration creation, even though the integration is not grafana_alerting. The PR addresses this issue --- .../containers/IntegrationForm/IntegrationForm.tsx | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/grafana-plugin/src/containers/IntegrationForm/IntegrationForm.tsx b/grafana-plugin/src/containers/IntegrationForm/IntegrationForm.tsx index 1d083c31..c417a2f4 100644 --- a/grafana-plugin/src/containers/IntegrationForm/IntegrationForm.tsx +++ b/grafana-plugin/src/containers/IntegrationForm/IntegrationForm.tsx @@ -445,14 +445,16 @@ export const IntegrationForm = observer( return; } - if (!IntegrationHelper.isSpecificIntegration(selectedIntegration.value, 'grafana_alerting')) { - pushHistory(response.id); + if (IntegrationHelper.isSpecificIntegration(selectedIntegration.value, 'grafana_alerting')) { + await (formData.is_existing + ? AlertReceiveChannelHelper.connectContactPoint + : AlertReceiveChannelHelper.createContactPoint)( + response.id, + formData.alert_manager, + formData.contact_point + ); } - await (formData.is_existing - ? AlertReceiveChannelHelper.connectContactPoint - : AlertReceiveChannelHelper.createContactPoint)(response.id, formData.alert_manager, formData.contact_point); - pushHistory(response.id); } }