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); }