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:
Ivana Huckova
2021-01-08 18:31:21 +01:00
committed by GitHub
parent 2221a8c5ff
commit ae1d2fb505
4 changed files with 8 additions and 7 deletions

View File

@@ -9,8 +9,9 @@ describe('parseSelector()', () => {
expect(parsed.labelKeys).toEqual([]);
});
it('throws if selector is broken', () => {
expect(() => parseSelector('{foo')).toThrow();
it('returns a clean selector from an unclosed selector', () => {
const parsed = parseSelector('{foo');
expect(parsed.selector).toBe('{}');
});
it('returns the selector sorted by label key', () => {