Commit Graph

14 Commits

Author SHA1 Message Date
David
6316d637f1 Explore: Apply tab completion suggestion on Enter (#12904)
- if the suggestions menu is open, apply the selected item on Enter
- if not open, run the queries
2018-08-20 19:22:55 +02:00
David
0f94d2f5f1 Fix closing parens completion for prometheus queries in Explore (#12810)
- position was determined by SPACE, but Prometheus selectors can
  contain spaces
- added negative lookahead to check if space is outside a selector
- moved braces plugin into PromQueryField since braces are prom specific
2018-08-07 13:34:12 +03:00
David Kaltschmidt
eaff7b0f68 Explore: Add history to query fields
- 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
2018-08-06 14:45:03 +02:00
David
5da3584dd4 Explore: facetting for label completion (#12786)
* 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
2018-08-06 15:36:02 +03:00
David
7699451d94 Refactor Explore query field (#12643)
* 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
2018-07-26 15:04:12 +03:00
David Kaltschmidt
3297ae462d Datasource for Grafana logging platform
- new builtin datasource plugin "Logging" (likely going to be renamed)
- plugin implements no panel ctrls yet, only ships datasource
- new models for logging data as first class citizen (aside from table
  and time_series model)
- Logs as new view for Explore
- JSON view for development

Testable only against existing logish deployment.
Then test with queries like `{job="..."} regexp`.
2018-07-20 17:07:17 +02:00
David Kaltschmidt
3ab5ab3674 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
2018-07-18 13:20:18 +02:00
David Kaltschmidt
bbe6ab5096 Fix Queryfield metrics field missing 2018-06-14 16:20:33 +01:00
David Kaltschmidt
b2f497b100 batch DOM reads from query field typeahead 2018-06-14 16:20:21 +01:00
David Kaltschmidt
2ebda4bf4d Make suggestions an object 2018-06-14 16:19:55 +01:00
David Kaltschmidt
4113f7db47 Trigger typeahead on Ctrl-Space 2018-06-14 16:19:43 +01:00
David Kaltschmidt
0425b47791 refactor Explore query field 2018-06-14 16:19:29 +01:00
David Kaltschmidt
eadaff6191 Explore: Design integration
* style header like other grafana components
* use panel container for graph and same styles for query field
* fix typeahead CSS selector (was created outside of .explore)
* use navbar buttons for +/- of rows
* moved elapsed time under run query button
* fix JS error on multiple timeseries being returned
* fix color for graph lines
* show prometheus query errors
2018-05-24 10:55:00 +02:00
David Kaltschmidt
f1220fd2a4 Explore WIP 2018-04-26 20:27:19 +02:00