From b9997d833fa1e2731b7d7da6dce073eb2abe1250 Mon Sep 17 00:00:00 2001 From: Victor Marin <36818606+mdvictor@users.noreply.github.com> Date: Tue, 22 Jul 2025 10:14:57 +0300 Subject: [PATCH] DataSourceAPI: Rename `getApplicableFilters` to `getFiltersApplicability` (#107775) * refactor getApplicableFilters to getFiltersApplicability * add origin property as well * add comments --- packages/grafana-data/src/index.ts | 1 + packages/grafana-data/src/types/datasource.ts | 12 +++++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/packages/grafana-data/src/index.ts b/packages/grafana-data/src/index.ts index 2fced788c3e..b767026c7a2 100644 --- a/packages/grafana-data/src/index.ts +++ b/packages/grafana-data/src/index.ts @@ -660,6 +660,7 @@ export { type QueryFixAction, type QueryHint, type MetricFindValue, + type FiltersApplicability, type DataSourceJsonData, type DataSourceSettings, type DataSourceInstanceSettings, diff --git a/packages/grafana-data/src/types/datasource.ts b/packages/grafana-data/src/types/datasource.ts index 416855f5c95..16b0dfe79a1 100644 --- a/packages/grafana-data/src/types/datasource.ts +++ b/packages/grafana-data/src/types/datasource.ts @@ -309,7 +309,7 @@ abstract class DataSourceApi< /** * Verify adhoc filters applicability based on queries and current filters */ - getApplicableFilters?(options?: DataSourceGetTagKeysOptions): Promise; + getFiltersApplicability?(options?: DataSourceGetTagKeysOptions): Promise; /** * Get tag keys for adhoc filters @@ -643,6 +643,16 @@ export interface MetricFindValue { expandable?: boolean; } +export interface FiltersApplicability { + key: string; + applicable: boolean; + // message explaining why the filter is not applicable + reason?: string; + // needed to differentiate between filters with same key + // but different origin + origin?: string; +} + export interface DataSourceJsonData { authType?: string; defaultRegion?: string;