Commit 1e76f1a7 by Ryan McKinley Committed by GitHub

DataSourceApi: remove ExploreDataSourceApi (#17424)

parent 4066c552
......@@ -202,14 +202,20 @@ export abstract class DataSourceApi<
* Used by alerting to check if query contains template variables
*/
targetContainsTemplate?(query: TQuery): boolean;
}
export abstract class ExploreDataSourceApi<
TQuery extends DataQuery = DataQuery,
TOptions extends DataSourceJsonData = DataSourceJsonData
> extends DataSourceApi<TQuery, TOptions> {
/**
* Used in explore
*/
modifyQuery?(query: TQuery, action: QueryFixAction): TQuery;
/**
* Used in explore
*/
getHighlighterExpression?(query: TQuery): string[];
/**
* Used in explore
*/
languageProvider?: any;
}
......
......@@ -31,7 +31,7 @@ import {
} from './state/actions';
// Types
import { RawTimeRange, DataQuery, ExploreStartPageProps, ExploreDataSourceApi, DataQueryError } from '@grafana/ui';
import { RawTimeRange, DataQuery, ExploreStartPageProps, DataSourceApi, DataQueryError } from '@grafana/ui';
import {
ExploreItemState,
ExploreUrlState,
......@@ -62,7 +62,7 @@ interface ExploreProps {
changeSize: typeof changeSize;
changeTime: typeof changeTime;
datasourceError: string;
datasourceInstance: ExploreDataSourceApi;
datasourceInstance: DataSourceApi;
datasourceLoading: boolean | null;
datasourceMissing: boolean;
exploreId: ExploreId;
......
......@@ -16,7 +16,7 @@ import { StoreState } from 'app/types';
import {
TimeRange,
DataQuery,
ExploreDataSourceApi,
DataSourceApi,
QueryFixAction,
DataSourceStatus,
PanelData,
......@@ -38,7 +38,7 @@ interface QueryRowProps extends PropsFromParent {
changeQuery: typeof changeQuery;
className?: string;
exploreId: ExploreId;
datasourceInstance: ExploreDataSourceApi;
datasourceInstance: DataSourceApi;
datasourceStatus: DataSourceStatus;
highlightLogsExpressionAction: typeof highlightLogsExpressionAction;
history: HistoryItem[];
......
......@@ -16,7 +16,7 @@ import BracesPlugin from 'app/features/explore/slate-plugins/braces';
// Types
import { LokiQuery } from '../types';
import { TypeaheadOutput, HistoryItem } from 'app/types/explore';
import { ExploreDataSourceApi, ExploreQueryFieldProps, DataSourceStatus } from '@grafana/ui';
import { DataSourceApi, ExploreQueryFieldProps, DataSourceStatus } from '@grafana/ui';
function getChooserText(hasSyntax: boolean, hasLogLabels: boolean, datasourceStatus: DataSourceStatus) {
if (datasourceStatus === DataSourceStatus.Disconnected) {
......@@ -65,7 +65,7 @@ export interface CascaderOption {
disabled?: boolean;
}
export interface LokiQueryFieldFormProps extends ExploreQueryFieldProps<ExploreDataSourceApi<LokiQuery>, LokiQuery> {
export interface LokiQueryFieldFormProps extends ExploreQueryFieldProps<DataSourceApi<LokiQuery>, LokiQuery> {
history: HistoryItem[];
syntax: any;
logLabelOptions: any[];
......
......@@ -15,7 +15,7 @@ import BracesPlugin from 'app/features/explore/slate-plugins/braces';
import QueryField, { TypeaheadInput, QueryFieldState } from 'app/features/explore/QueryField';
import { PromQuery } from '../types';
import { CancelablePromise, makePromiseCancelable } from 'app/core/utils/CancelablePromise';
import { ExploreDataSourceApi, ExploreQueryFieldProps, DataSourceStatus, QueryHint } from '@grafana/ui';
import { DataSourceApi, ExploreQueryFieldProps, DataSourceStatus, QueryHint } from '@grafana/ui';
const HISTOGRAM_GROUP = '__histograms__';
const METRIC_MARK = 'metric';
......@@ -101,7 +101,7 @@ interface CascaderOption {
disabled?: boolean;
}
interface PromQueryFieldProps extends ExploreQueryFieldProps<ExploreDataSourceApi<PromQuery>, PromQuery> {
interface PromQueryFieldProps extends ExploreQueryFieldProps<DataSourceApi<PromQuery>, PromQuery> {
history: HistoryItem[];
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment