Commit 4a85d012 by David Committed by GitHub

Merge pull request #13542 from grafana/davkal/13531-fix-default-suggestions

Explore: do not show default suggestions after expressions
parents 98071ccd 6260a6d2
...@@ -308,10 +308,10 @@ class PromQueryField extends React.PureComponent<PromQueryFieldProps, PromQueryF ...@@ -308,10 +308,10 @@ class PromQueryField extends React.PureComponent<PromQueryFieldProps, PromQueryF
} else if (_.includes(wrapperClasses, 'context-aggregation')) { } else if (_.includes(wrapperClasses, 'context-aggregation')) {
return this.getAggregationTypeahead.apply(this, arguments); return this.getAggregationTypeahead.apply(this, arguments);
} else if ( } else if (
// Non-empty but not inside known token // Show default suggestions in a couple of scenarios
(prefix && !tokenRecognized) || (prefix && !tokenRecognized) || // Non-empty prefix, but not inside known token
(prefix === '' && !text.match(/^[)\s]+$/)) || // Empty context or after ')' (prefix === '' && !text.match(/^[\]})\s]+$/)) || // Empty prefix, but not following a closing brace
text.match(/[+\-*/^%]/) // After binary operator text.match(/[+\-*/^%]/) // Anything after binary operator
) { ) {
return this.getEmptyTypeahead(); return this.getEmptyTypeahead();
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment