QueryField: Prevent query runs on blur in Explore (#20180)

As discussed in a UX feedback session, it's annoying that queries are
automatically executed in Explore. This change adds props to override
the blur behavior.

- add `onBlur` to Explore query field props
- Explore's query row will pass down an empty function for onBlur to the
query fields
- pass onBlur through to the QueryField component for Loki and
Prometheus
- add test to QueryField to make sure if onBlur is specified, the
onRunQuery is not executed
This commit is contained in:
David
2019-11-06 15:08:30 +00:00
committed by GitHub
parent 620a3f2f9a
commit 9507eda9d1
6 changed files with 50 additions and 4 deletions

View File

@@ -297,6 +297,7 @@ class PromQueryField extends React.PureComponent<PromQueryFieldProps, PromQueryF
query={query.expr}
onTypeahead={this.onTypeahead}
onWillApplySuggestion={willApplySuggestion}
onBlur={this.props.onBlur}
onChange={this.onChangeQuery}
onRunQuery={this.props.onRunQuery}
placeholder="Enter a PromQL query"