mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
AdhocFilters: Improve typing and signature of getTagKeys and getTagValues and behaviors (#74962)
* Add adhocFilters to DataQueryRequest * More changes * Progress * Working * added baseFilters to picker * Remove unused code * minor fix
This commit is contained in:
@@ -14,7 +14,7 @@ import { DataQuery } from './query';
|
||||
import { RawTimeRange, TimeRange } from './time';
|
||||
import { CustomVariableSupport, DataSourceVariableSupport, StandardVariableSupport } from './variables';
|
||||
|
||||
import { DataSourceRef, WithAccessControlMetadata } from '.';
|
||||
import { AdHocVariableFilter, DataSourceRef, WithAccessControlMetadata } from '.';
|
||||
|
||||
export interface DataSourcePluginOptionsEditorProps<
|
||||
JSONData extends DataSourceJsonData = DataSourceJsonData,
|
||||
@@ -287,12 +287,12 @@ abstract class DataSourceApi<
|
||||
/**
|
||||
* Get tag keys for adhoc filters
|
||||
*/
|
||||
getTagKeys?(options?: any): Promise<MetricFindValue[]>;
|
||||
getTagKeys?(options?: DataSourceGetTagKeysOptions): Promise<MetricFindValue[]>;
|
||||
|
||||
/**
|
||||
* Get tag values for adhoc filters
|
||||
*/
|
||||
getTagValues?(options: any): Promise<MetricFindValue[]>;
|
||||
getTagValues?(options: DataSourceGetTagValuesOptions): Promise<MetricFindValue[]>;
|
||||
|
||||
/**
|
||||
* Set after constructor call, as the data source instance is the most common thing to pass around
|
||||
@@ -370,6 +370,35 @@ abstract class DataSourceApi<
|
||||
getDefaultQuery?(app: CoreApp): Partial<TQuery>;
|
||||
}
|
||||
|
||||
/**
|
||||
* Options argument to DataSourceAPI.getTagKeys
|
||||
*/
|
||||
export interface DataSourceGetTagKeysOptions {
|
||||
/**
|
||||
* The other existing filters or base filters. New in v10.3
|
||||
*/
|
||||
filters: AdHocVariableFilter[];
|
||||
/**
|
||||
* Context time range. New in v10.3
|
||||
*/
|
||||
timeRange?: TimeRange;
|
||||
}
|
||||
|
||||
/**
|
||||
* Options argument to DataSourceAPI.getTagValues
|
||||
*/
|
||||
export interface DataSourceGetTagValuesOptions {
|
||||
key: string;
|
||||
/**
|
||||
* The other existing filters or base filters. New in v10.3
|
||||
*/
|
||||
filters: AdHocVariableFilter[];
|
||||
/**
|
||||
* Context time range. New in v10.3
|
||||
*/
|
||||
timeRange?: TimeRange;
|
||||
}
|
||||
|
||||
export interface MetadataInspectorProps<
|
||||
DSType extends DataSourceApi<TQuery, TOptions>,
|
||||
TQuery extends DataQuery = DataQuery,
|
||||
|
||||
@@ -55,6 +55,10 @@ export interface AdHocVariableModel extends BaseVariableModel {
|
||||
type: 'adhoc';
|
||||
datasource: DataSourceRef | null;
|
||||
filters: AdHocVariableFilter[];
|
||||
/**
|
||||
* Filters that are always applied to the lookup of keys. Not shown in the AdhocFilterBuilder UI.
|
||||
*/
|
||||
baseFilters?: AdHocVariableFilter[];
|
||||
}
|
||||
|
||||
export interface VariableOption {
|
||||
|
||||
Reference in New Issue
Block a user