From 3ab5ab36746194ac804123c69157df7561108635 Mon Sep 17 00:00:00 2001 From: David Kaltschmidt Date: Wed, 18 Jul 2018 13:15:45 +0200 Subject: [PATCH] Fix label suggestions in Explore query field - In 0425b477 the labels suggestions were refactored and a typo broke the look up for available lables of a metric --- public/app/containers/Explore/QueryField.tsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/public/app/containers/Explore/QueryField.tsx b/public/app/containers/Explore/QueryField.tsx index bedb955b9b9..c9d71b3b49e 100644 --- a/public/app/containers/Explore/QueryField.tsx +++ b/public/app/containers/Explore/QueryField.tsx @@ -17,6 +17,7 @@ import { processLabels, RATE_RANGES, cleanText } from './utils/prometheus'; import Typeahead from './Typeahead'; const EMPTY_METRIC = ''; +const METRIC_MARK = 'metric'; export const TYPEAHEAD_DEBOUNCE = 300; function flattenSuggestions(s) { @@ -135,7 +136,7 @@ class QueryField extends React.Component { if (!this.state.metrics) { return; } - setPrismTokens(this.props.prismLanguage, 'metrics', this.state.metrics); + setPrismTokens(this.props.prismLanguage, METRIC_MARK, this.state.metrics); // Trigger re-render window.requestAnimationFrame(() => { @@ -184,7 +185,7 @@ class QueryField extends React.Component { let typeaheadContext = null; // Take first metric as lucky guess - const metricNode = editorNode.querySelector('.metric'); + const metricNode = editorNode.querySelector(`.${METRIC_MARK}`); if (wrapperClasses.contains('context-range')) { // Rate ranges