grafana/public/app/features/variables
yenalsnavaj f830d8772a
Variables: Adds named capture groups to variable regex (#28625)
* Dashboard: Add named capture groups to variable query regex

Variable query regex are able to use 'text' and 'value' named capture
groups to allow for separate display text to be extracted from the
query result. e.g.

Using a regex of /foo="(?<text>[^"]+)|bar="(?<value>[^"]+)/g on a query
result of metric{foo="FOO", bar="BAR"} would result in the variable
value being set to 'BAR' but display text being set to 'FOO'

Resolves #21076

* Improve regex capture group documentation

* Update docs/sources/variables/filter-variables-with-regex.md

Co-authored-by: Diana Payton <52059945+oddlittlebird@users.noreply.github.com>

* Apply suggestions from code review

Co-authored-by: Diana Payton <52059945+oddlittlebird@users.noreply.github.com>

* Apply suggestions from code review

Co-authored-by: Hugo Häggmark <hugo.haggmark@gmail.com>

* Use text capture if value capture does not match

This is to keep the behaviour consistent with the current behavior. See
discussion https://github.com/grafana/grafana/pull/28625/files#r516490942

* Improve regex field placeholder and tooltip message

To make the feature more discoverable to users the place holder example
now includes the named capture groups. The tool tip message also
includes a reference and link to the documentation.

Co-authored-by: Diana Payton <52059945+oddlittlebird@users.noreply.github.com>
Co-authored-by: Hugo Häggmark <hugo.haggmark@gmail.com>
2020-11-04 09:31:38 +01:00
..
adhoc Variables: prevent adhoc filters from crashing when they are not loaded properly (#28226) 2020-10-14 12:55:28 +02:00
constant Variables: Adds loading state and indicators (#27917) 2020-10-02 07:02:06 +02:00
custom Templating: Custom variable edit UI, change text input into textarea (#28312) (#28322) 2020-10-26 08:38:39 +01:00
datasource Variables: Adds loading state and indicators (#27917) 2020-10-02 07:02:06 +02:00
editor Variables: Adds loading state and indicators (#27917) 2020-10-02 07:02:06 +02:00
interval Variables: Adds loading state and indicators (#27917) 2020-10-02 07:02:06 +02:00
pickers Templating: Replace all '$tag' in tag values query (#28343) 2020-10-17 21:12:05 +02:00
query Variables: Adds named capture groups to variable regex (#28625) 2020-11-04 09:31:38 +01:00
shared Variables: Fixes URL values for dependent variables (#28798) 2020-11-04 08:56:02 +01:00
state Variables: Fixes URL values for dependent variables (#28798) 2020-11-04 08:56:02 +01:00
system Variables: Adds loading state and indicators (#27917) 2020-10-02 07:02:06 +02:00
textbox Variables: Adds loading state and indicators (#27917) 2020-10-02 07:02:06 +02:00
adapters.ts Templating: fixes variables not being interpolated after dashboard refresh (#25698) 2020-06-25 07:38:55 +02:00
guard.ts Templating: removes old Angular variable system and featureToggle (#24779) 2020-06-04 13:44:48 +02:00
types.ts Variables: Adds loading state and indicators (#27917) 2020-10-02 07:02:06 +02:00
utils.test.ts Variables: Fixes URL values for dependent variables (#28798) 2020-11-04 08:56:02 +01:00
utils.ts Variables: Fixes URL values for dependent variables (#28798) 2020-11-04 08:56:02 +01:00