From 34655a47c5ad3f627788e3f59f720bb2d30c02c0 Mon Sep 17 00:00:00 2001 From: Lauren <61048546+laurenashleigh@users.noreply.github.com> Date: Thu, 21 Aug 2025 10:35:50 +0100 Subject: [PATCH] =?UTF-8?q?Alerting:=20Set=20dataSourceName=20to=20GRAFANA?= =?UTF-8?q?=5FRULES=5FSOURCE=5FNAME=20when=20switch=E2=80=A6=20(#109900)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Alerting: Set dataSourceName to GRAFANA_RULES_SOURCE_NAME when switching to Grafana‑managed --- .../query-and-alert-condition/QueryAndExpressionsStep.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/public/app/features/alerting/unified/components/rule-editor/query-and-alert-condition/QueryAndExpressionsStep.tsx b/public/app/features/alerting/unified/components/rule-editor/query-and-alert-condition/QueryAndExpressionsStep.tsx index 43579acbcc7..aa5e9afa9f1 100644 --- a/public/app/features/alerting/unified/components/rule-editor/query-and-alert-condition/QueryAndExpressionsStep.tsx +++ b/public/app/features/alerting/unified/components/rule-editor/query-and-alert-condition/QueryAndExpressionsStep.tsx @@ -37,7 +37,7 @@ import { isExpressionQueryInAlert, } from '../../../rule-editor/formProcessing'; import { RuleFormType, RuleFormValues } from '../../../types/rule-form'; -import { getDefaultOrFirstCompatibleDataSource } from '../../../utils/datasource'; +import { GRAFANA_RULES_SOURCE_NAME, getDefaultOrFirstCompatibleDataSource } from '../../../utils/datasource'; import { PromOrLokiQuery, isPromOrLokiQuery } from '../../../utils/rule-form'; import { isCloudAlertingRuleByType, @@ -422,7 +422,7 @@ export const QueryAndExpressionsStep = ({ editingExistingRule, onDataChange, mod const typeInForm = getValues('type'); if (typeInForm === RuleFormType.cloudAlerting) { setValue('type', RuleFormType.grafana); - setValue('dataSourceName', null); // set data source name back to "null" + setValue('dataSourceName', GRAFANA_RULES_SOURCE_NAME); prevExpressions.length > 0 && restoreExpressionsInQueries(); prevCondition && setValue('condition', prevCondition);