From e49e614893a9d772aab82a07ff0c1ec4cbd93126 Mon Sep 17 00:00:00 2001 From: "grafana-delivery-bot[bot]" <132647405+grafana-delivery-bot[bot]@users.noreply.github.com> Date: Fri, 17 May 2024 21:26:10 +0300 Subject: [PATCH] [v11.0.x] CloudMonitoring: Fix query type selection issue (#88024) CloudMonitoring: Fix query type selection issue (#87990) * Use deepEqual to ensure migratedQuery is only returned when query is unchanged * Add selectors for query editors * Add more tests for query editor component * Clarifying comments * Fix how state is set * Simplify query editor loading and migration (cherry picked from commit 58d382e5dd1b640dd707701f77671a7fc59a9acf) Co-authored-by: Andreas Christou --- .../components/MQLQueryEditor.tsx | 6 +- .../components/PromQLEditor.tsx | 5 +- .../components/QueryEditor.test.tsx | 97 ++++++++++++- .../components/QueryEditor.tsx | 134 +++++++++--------- .../components/SLOQueryEditor.tsx | 5 +- .../components/VisualMetricQueryEditor.tsx | 5 +- .../cloud-monitoring/e2e/selectors.ts | 30 ++++ 7 files changed, 202 insertions(+), 80 deletions(-) create mode 100644 public/app/plugins/datasource/cloud-monitoring/e2e/selectors.ts diff --git a/public/app/plugins/datasource/cloud-monitoring/components/MQLQueryEditor.tsx b/public/app/plugins/datasource/cloud-monitoring/components/MQLQueryEditor.tsx index 324b55b5e02..6c2c635bb1e 100644 --- a/public/app/plugins/datasource/cloud-monitoring/components/MQLQueryEditor.tsx +++ b/public/app/plugins/datasource/cloud-monitoring/components/MQLQueryEditor.tsx @@ -2,6 +2,8 @@ import React from 'react'; import { TextArea } from '@grafana/ui'; +import { selectors } from '../e2e/selectors'; + export interface Props { onChange: (query: string) => void; onRunQuery: () => void; @@ -17,7 +19,7 @@ export function MQLQueryEditor({ query, onChange, onRunQuery }: React.PropsWithC }; return ( - <> +