From 9b1f1df9e819c2137e0f5c493cc4d8346f4b9af0 Mon Sep 17 00:00:00 2001 From: Ivan Ortega Alba Date: Fri, 16 Jun 2023 15:12:52 +0200 Subject: [PATCH] Mixed DS: Use new DS picker (#70052) --- .betterer.results | 5 ++-- .../query/components/QueryEditorRowHeader.tsx | 2 +- .../features/query/components/QueryGroup.tsx | 28 +------------------ 3 files changed, 4 insertions(+), 31 deletions(-) diff --git a/.betterer.results b/.betterer.results index 717c08524f3..bd5f5151634 100644 --- a/.betterer.results +++ b/.betterer.results @@ -3013,9 +3013,8 @@ exports[`better eslint`] = { ], "public/app/features/query/components/QueryGroup.tsx:5381": [ [0, 0, 0, "Use data-testid for E2E selectors instead of aria-label", "0"], - [0, 0, 0, "Unexpected any. Specify a different type.", "1"], - [0, 0, 0, "Use data-testid for E2E selectors instead of aria-label", "2"], - [0, 0, 0, "Use data-testid for E2E selectors instead of aria-label", "3"] + [0, 0, 0, "Use data-testid for E2E selectors instead of aria-label", "1"], + [0, 0, 0, "Use data-testid for E2E selectors instead of aria-label", "2"] ], "public/app/features/query/components/QueryGroupOptions.tsx:5381": [ [0, 0, 0, "Do not use any type assertions.", "0"] diff --git a/public/app/features/query/components/QueryEditorRowHeader.tsx b/public/app/features/query/components/QueryEditorRowHeader.tsx index 7b9b965b796..ded3cc44677 100644 --- a/public/app/features/query/components/QueryEditorRowHeader.tsx +++ b/public/app/features/query/components/QueryEditorRowHeader.tsx @@ -3,8 +3,8 @@ import React, { ReactNode, useState } from 'react'; import { DataQuery, DataSourceInstanceSettings, GrafanaTheme2 } from '@grafana/data'; import { selectors } from '@grafana/e2e-selectors'; -import { DataSourcePicker } from '@grafana/runtime'; import { Icon, Input, FieldValidationMessage, useStyles2 } from '@grafana/ui'; +import { DataSourcePicker } from 'app/features/datasources/components/picker/DataSourcePicker'; export interface Props { query: TQuery; diff --git a/public/app/features/query/components/QueryGroup.tsx b/public/app/features/query/components/QueryGroup.tsx index 7f34958c82c..c4f89a86cfc 100644 --- a/public/app/features/query/components/QueryGroup.tsx +++ b/public/app/features/query/components/QueryGroup.tsx @@ -51,7 +51,6 @@ interface State { helpContent: React.ReactNode; isLoadingHelp: boolean; isPickerOpen: boolean; - isAddingMixed: boolean; isDataSourceModalOpen: boolean; data: PanelData; isHelpOpen: boolean; @@ -69,7 +68,6 @@ export class QueryGroup extends PureComponent { isLoadingHelp: false, helpContent: null, isPickerOpen: false, - isAddingMixed: false, isHelpOpen: false, queries: [], data: { @@ -267,20 +265,6 @@ export class QueryGroup extends PureComponent { this.setState({ isDataSourceModalOpen: false }); }; - renderMixedPicker = () => { - return ( - - ); - }; - renderDataSourcePickerWithPrompt = () => { const { isDataSourceModalOpen } = this.state; @@ -316,15 +300,6 @@ export class QueryGroup extends PureComponent { ); }; - onAddMixedQuery = (datasource: any) => { - this.onAddQuery({ datasource: datasource.name }); - this.setState({ isAddingMixed: false }); - }; - - onMixedPickerBlur = () => { - this.setState({ isAddingMixed: false }); - }; - onAddQuery = (query: Partial) => { const { dsSettings, queries } = this.state; this.onQueriesChange(addQuery(queries, query, { type: dsSettings?.type, uid: dsSettings?.uid })); @@ -424,8 +399,7 @@ export class QueryGroup extends PureComponent { } renderAddQueryRow(dsSettings: DataSourceInstanceSettings, styles: QueriesTabStyles) { - const { isAddingMixed } = this.state; - const showAddButton = !(isAddingMixed || isSharedDashboardQuery(dsSettings.name)); + const showAddButton = !isSharedDashboardQuery(dsSettings.name); return (