From e9aa578e2848c0f0c7e1d0f3f35dd9b3c4cf4fcc Mon Sep 17 00:00:00 2001 From: "grafana-delivery-bot[bot]" <132647405+grafana-delivery-bot[bot]@users.noreply.github.com> Date: Tue, 29 Aug 2023 11:30:28 +0200 Subject: [PATCH] [v10.1.x] Alerting: Fix Recording Rule QueryEditor builder view (#73621) Co-authored-by: Virginia Cepeda Fix Recording Rule QueryEditor builder view (#73348) --- .../components/rule-editor/RecordingRuleEditor.tsx | 11 +++++++---- .../rule-editor/query-and-alert-condition/reducer.ts | 2 +- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/public/app/features/alerting/unified/components/rule-editor/RecordingRuleEditor.tsx b/public/app/features/alerting/unified/components/rule-editor/RecordingRuleEditor.tsx index 6221bfd4770..89416127d04 100644 --- a/public/app/features/alerting/unified/components/rule-editor/RecordingRuleEditor.tsx +++ b/public/app/features/alerting/unified/components/rule-editor/RecordingRuleEditor.tsx @@ -60,14 +60,17 @@ export const RecordingRuleEditor: FC = ({ const merged = { ...query, - refId: changedQuery.refId, - queryType: changedQuery.queryType ?? '', + ...changedQuery, datasourceUid: dataSourceId, expr, model: { - refId: changedQuery.refId, expr, - editorMode: 'code', + datasource: changedQuery.datasource, + refId: changedQuery.refId, + editorMode: changedQuery.editorMode, + instant: Boolean(changedQuery.instant), + range: Boolean(changedQuery.range), + legendFormat: changedQuery.legendFormat, }, }; onChangeQuery([merged]); diff --git a/public/app/features/alerting/unified/components/rule-editor/query-and-alert-condition/reducer.ts b/public/app/features/alerting/unified/components/rule-editor/query-and-alert-condition/reducer.ts index 0fc29628ed3..08aecf832f9 100644 --- a/public/app/features/alerting/unified/components/rule-editor/query-and-alert-condition/reducer.ts +++ b/public/app/features/alerting/unified/components/rule-editor/query-and-alert-condition/reducer.ts @@ -80,7 +80,7 @@ export const queriesAndExpressionsReducer = createReducer(initialState, (builder const query = payload.recordingRuleQueries[0]; const recordingRuleQuery = { ...query, - ...{ expr: payload.expression, model: { expr: payload.expression, refId: query.model.refId } }, + ...{ expr: payload.expression, model: query?.model }, }; state.queries = [recordingRuleQuery];