- queries are saved to localstorage history array
- one history per datasource type (plugin ID)
- 100 items kept with timestamps
- history suggestions can be pulled up with Ctrl-SPACE
* Explore: facetting for label completion
- unified metric and non-metric label completion
- label keys and values are now fetched fresh for each valid selector
- complete selector means only values are suggested that are supported
by the selector
- properly implemented metric lookup for selectors (until the first
metric was used which breaks when multiple metrics are present)
- typeahead tests now need a valid selection to demark the cursor
* Fix facetting queries for empty selector
* Refactor Explore query field
- extract typeahead field that only contains logic for the typeahead
mechanics
- renamed QueryField to PromQueryField, a wrapper around TypeaheadField
that deals with Prometheus-specific concepts
- PromQueryField creates a promql typeahead by providing the handlers
for producing suggestions, and for applying suggestions
- The `refresher` promise is needed to trigger a render once an async
action in the wrapper returns.
This is prep work for a composable query field to be used by Explore, as
well as editors in datasource plugins.
* Added typeahead handling tests
- extracted context-to-suggestion logic to make it testable
- kept DOM-dependent parts in main onTypeahead funtion
* simplified error handling in explore query field
* Refactor query suggestions
- use monaco's suggestion types (roughly), see
https://github.com/Microsoft/monaco-editor/blob/f6fb545/monaco.d.ts#L4208
- suggest functions and metrics in empty field (ctrl+space)
- copy and expand prometheus function docs from prometheus datasource
(will be migrated back to the datasource in the future)
* Added prop and state types, removed unused cwrp
* Split up suggestion processing for code readability