diff --git a/public/app/plugins/datasource/grafana-azure-monitor-datasource/components/QueryEditor/QueryEditor.test.tsx b/public/app/plugins/datasource/grafana-azure-monitor-datasource/components/QueryEditor/QueryEditor.test.tsx index 766abdc1085..d6684fbce04 100644 --- a/public/app/plugins/datasource/grafana-azure-monitor-datasource/components/QueryEditor/QueryEditor.test.tsx +++ b/public/app/plugins/datasource/grafana-azure-monitor-datasource/components/QueryEditor/QueryEditor.test.tsx @@ -28,7 +28,9 @@ describe('Azure Monitor QueryEditor', () => { }; render( {}} onRunQuery={() => {}} />); - await waitFor(() => expect(screen.getByTestId('azure-monitor-metrics-query-editor')).toBeInTheDocument()); + await waitFor(() => + expect(screen.getByTestId('azure-monitor-metrics-query-editor-with-resource-picker')).toBeInTheDocument() + ); }); it('renders the Logs query editor when the query type is Logs', async () => { @@ -60,35 +62,14 @@ describe('Azure Monitor QueryEditor', () => { it('displays error messages from frontend Azure calls', async () => { const mockDatasource = createMockDatasource(); - mockDatasource.azureMonitorDatasource.getSubscriptions = jest.fn().mockRejectedValue(invalidNamespaceError()); + mockDatasource.azureMonitorDatasource.getMetricNamespaces = jest.fn().mockRejectedValue(invalidNamespaceError()); render( {}} onRunQuery={() => {}} /> ); - await waitFor(() => expect(screen.getByTestId('azure-monitor-query-editor')).toBeInTheDocument()); - - expect(screen.getByText("The resource namespace 'grafanadev' is invalid.")).toBeInTheDocument(); - }); - - it('renders the new query editor for metrics when enabled with a feature toggle', async () => { - const originalConfigValue = config.featureToggles.azureMonitorResourcePickerForMetrics; - - // To do this irl go to custom.ini file and add resourcePickerForMetrics = true under [feature_toggles] - config.featureToggles.azureMonitorResourcePickerForMetrics = true; - - const mockDatasource = createMockDatasource(); - const mockQuery = { - ...createMockQuery(), - queryType: AzureQueryType.AzureMonitor, - }; - - render( {}} onRunQuery={() => {}} />); - await waitFor(() => expect(screen.getByTestId('azure-monitor-metrics-query-editor-with-resource-picker')).toBeInTheDocument() ); - - // reset config to not impact future tests - config.featureToggles.azureMonitorResourcePickerForMetrics = originalConfigValue; + expect(screen.getByText('An error occurred while requesting metadata from Azure Monitor')).toBeInTheDocument(); }); it('should render the experimental QueryHeader when feature toggle is enabled', async () => { diff --git a/public/app/plugins/datasource/grafana-azure-monitor-datasource/components/QueryEditor/QueryEditor.tsx b/public/app/plugins/datasource/grafana-azure-monitor-datasource/components/QueryEditor/QueryEditor.tsx index bd797cd6334..479bedf30da 100644 --- a/public/app/plugins/datasource/grafana-azure-monitor-datasource/components/QueryEditor/QueryEditor.tsx +++ b/public/app/plugins/datasource/grafana-azure-monitor-datasource/components/QueryEditor/QueryEditor.tsx @@ -16,7 +16,6 @@ import { import useLastError from '../../utils/useLastError'; import ArgQueryEditor from '../ArgQueryEditor'; import LogsQueryEditor from '../LogsQueryEditor'; -import MetricsQueryEditor from '../MetricsQueryEditor'; import NewMetricsQueryEditor from '../NewMetricsQueryEditor/MetricsQueryEditor'; import { QueryHeader } from '../QueryHeader'; import { Space } from '../Space'; @@ -102,22 +101,9 @@ const EditorForQueryType: React.FC = ({ }) => { switch (query.queryType) { case AzureQueryType.AzureMonitor: - if (config.featureToggles.azureMonitorResourcePickerForMetrics) { - return ( - - ); - } return ( -