Mixed DS: Use new DS picker (#70052)

This commit is contained in:
Ivan Ortega Alba 2023-06-16 15:12:52 +02:00 committed by GitHub
parent 6f880b713a
commit 9b1f1df9e8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 31 deletions

View File

@ -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"]

View File

@ -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<TQuery extends DataQuery = DataQuery> {
query: TQuery;

View File

@ -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<Props, State> {
isLoadingHelp: false,
helpContent: null,
isPickerOpen: false,
isAddingMixed: false,
isHelpOpen: false,
queries: [],
data: {
@ -267,20 +265,6 @@ export class QueryGroup extends PureComponent<Props, State> {
this.setState({ isDataSourceModalOpen: false });
};
renderMixedPicker = () => {
return (
<DataSourcePicker
mixed={false}
onChange={this.onAddMixedQuery}
current={null}
autoFocus={true}
variables={true}
onBlur={this.onMixedPickerBlur}
openMenuOnFocus={true}
/>
);
};
renderDataSourcePickerWithPrompt = () => {
const { isDataSourceModalOpen } = this.state;
@ -316,15 +300,6 @@ export class QueryGroup extends PureComponent<Props, State> {
);
};
onAddMixedQuery = (datasource: any) => {
this.onAddQuery({ datasource: datasource.name });
this.setState({ isAddingMixed: false });
};
onMixedPickerBlur = () => {
this.setState({ isAddingMixed: false });
};
onAddQuery = (query: Partial<DataQuery>) => {
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<Props, State> {
}
renderAddQueryRow(dsSettings: DataSourceInstanceSettings, styles: QueriesTabStyles) {
const { isAddingMixed } = this.state;
const showAddButton = !(isAddingMixed || isSharedDashboardQuery(dsSettings.name));
const showAddButton = !isSharedDashboardQuery(dsSettings.name);
return (
<HorizontalGroup spacing="md" align="flex-start">