diff --git a/public/app/plugins/datasource/cloudwatch/components/QueryEditor/QueryEditor.test.tsx b/public/app/plugins/datasource/cloudwatch/components/QueryEditor/QueryEditor.test.tsx index a9a7edb80b9..ed093bed858 100644 --- a/public/app/plugins/datasource/cloudwatch/components/QueryEditor/QueryEditor.test.tsx +++ b/public/app/plugins/datasource/cloudwatch/components/QueryEditor/QueryEditor.test.tsx @@ -347,7 +347,7 @@ describe('QueryEditor should render right editor', () => { config.featureToggles.cloudwatchMetricInsightsCrossAccount = true; props.datasource.resources.getAccounts = jest.fn().mockResolvedValue(['account123']); render(); - await screen.findByText('Metric Query'); + await screen.findByText('Metric Insights'); expect(await screen.findByText('Account')).toBeInTheDocument(); }); }); diff --git a/public/app/plugins/datasource/cloudwatch/components/QueryEditor/QueryHeader.tsx b/public/app/plugins/datasource/cloudwatch/components/QueryEditor/QueryHeader.tsx index 7e77f93b4a5..7908c3437ac 100644 --- a/public/app/plugins/datasource/cloudwatch/components/QueryEditor/QueryHeader.tsx +++ b/public/app/plugins/datasource/cloudwatch/components/QueryEditor/QueryHeader.tsx @@ -58,12 +58,16 @@ const QueryHeader = ({ onChange({ ...query, region }); } }; + const metricInsightsCrossAccountEnabled = config.featureToggles.cloudwatchMetricInsightsCrossAccount; const shouldDisplayMonitoringBadge = config.featureToggles.cloudWatchCrossAccountQuerying && isMonitoringAccount && (query.queryMode === 'Logs' || - (isCloudWatchMetricsQuery(query) && query.metricQueryType === MetricQueryType.Search)); + (isCloudWatchMetricsQuery(query) && query.metricQueryType === MetricQueryType.Search) || + (metricInsightsCrossAccountEnabled && + isCloudWatchMetricsQuery(query) && + query.metricQueryType === MetricQueryType.Insights)); return ( <>