mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Prometheus: Fix autocomplete does not work on incomplete input (#29854)
* WIP, works but need to do more testing * Update solution * Fix autocomplete with metrics * Update public/app/plugins/datasource/prometheus/language_provider.ts * Update public/app/plugins/datasource/prometheus/language_provider.ts * Change test for new functionality
This commit is contained in:
@@ -42,7 +42,7 @@ export function processLabels(labels: Array<{ [key: string]: string }>, withName
|
||||
}
|
||||
|
||||
// const cleanSelectorRegexp = /\{(\w+="[^"\n]*?")(,\w+="[^"\n]*?")*\}/;
|
||||
export const selectorRegexp = /\{[^}]*?\}/;
|
||||
export const selectorRegexp = /\{[^}]*?(\}|$)/;
|
||||
export const labelRegexp = /\b(\w+)(!?=~?)("[^"\n]*?")/g;
|
||||
export function parseSelector(query: string, cursorOffset = 1): { labelKeys: any[]; selector: string } {
|
||||
if (!query.match(selectorRegexp)) {
|
||||
|
||||
Reference in New Issue
Block a user