From cc460110b1367fbb9abeea5f6a3f1d38e2d775d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=A1bor=20Farkas?= Date: Mon, 12 Jul 2021 07:55:10 +0200 Subject: [PATCH] influxdb: influxql: better tag-value filtering (#36570) --- .../influxdb/components/VisualInfluxQLEditor/Editor.tsx | 2 +- .../app/plugins/datasource/influxdb/influxQLMetadataQuery.ts | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/public/app/plugins/datasource/influxdb/components/VisualInfluxQLEditor/Editor.tsx b/public/app/plugins/datasource/influxdb/components/VisualInfluxQLEditor/Editor.tsx index b9d3aaaaad0..6be64b57794 100644 --- a/public/app/plugins/datasource/influxdb/components/VisualInfluxQLEditor/Editor.tsx +++ b/public/app/plugins/datasource/influxdb/components/VisualInfluxQLEditor/Editor.tsx @@ -130,7 +130,7 @@ export const Editor = (props: Props): JSX.Element => { onChange={handleTagsSectionChange} getTagKeyOptions={getTagKeys} getTagValueOptions={(key: string) => - withTemplateVariableOptions(getTagValues(key, measurement, policy, datasource)) + withTemplateVariableOptions(getTagValues(key, measurement, policy, query.tags ?? [], datasource)) } /> diff --git a/public/app/plugins/datasource/influxdb/influxQLMetadataQuery.ts b/public/app/plugins/datasource/influxdb/influxQLMetadataQuery.ts index 859277adeda..c03a1b0d16b 100644 --- a/public/app/plugins/datasource/influxdb/influxQLMetadataQuery.ts +++ b/public/app/plugins/datasource/influxdb/influxQLMetadataQuery.ts @@ -45,9 +45,10 @@ export async function getTagValues( tagKey: string, measurement: string | undefined, policy: string | undefined, + tags: InfluxQueryTag[], datasource: InfluxDatasource ): Promise { - const target = { tags: [], measurement, policy }; + const target = { tags, measurement, policy }; const data = await runExploreQuery('TAG_VALUES', tagKey, undefined, target, datasource); return data.map((item) => item.text); }