From 7f165729b027434f67feb8c6fea5a26055582b56 Mon Sep 17 00:00:00 2001 From: gtk-grafana <109082771+gtk-grafana@users.noreply.github.com> Date: Wed, 3 Aug 2022 09:56:32 -0500 Subject: [PATCH] remove string constant and use ids provided in lezer-promql library (#53180) --- .../app/plugins/datasource/prometheus/add_label_to_query.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/public/app/plugins/datasource/prometheus/add_label_to_query.ts b/public/app/plugins/datasource/prometheus/add_label_to_query.ts index b8db62e88db..f08c636626c 100644 --- a/public/app/plugins/datasource/prometheus/add_label_to_query.ts +++ b/public/app/plugins/datasource/prometheus/add_label_to_query.ts @@ -1,4 +1,4 @@ -import { parser } from 'lezer-promql'; +import { parser, VectorSelector } from 'lezer-promql'; import { PromQueryModeller } from './querybuilder/PromQueryModeller'; import { buildVisualQueryFromString } from './querybuilder/parsing'; @@ -45,7 +45,7 @@ function getVectorSelectorPositions(query: string): VectorSelectorPosition[] { const positions: VectorSelectorPosition[] = []; tree.iterate({ enter: (type, from, to, get): false | void => { - if (type.name === 'VectorSelector') { + if (type.id === VectorSelector) { const visQuery = buildVisualQueryFromString(query.substring(from, to)); positions.push({ query: visQuery.query, from, to }); return false;