-
Variables: Adds named capture groups to variable regex (#28625) · f830d877
* 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>
yenalsnavaj committed
Name |
Last commit
|
Last Update |
---|---|---|
.. | ||
QueryVariableEditor.test.tsx | Loading commit data... | |
QueryVariableEditor.tsx | Loading commit data... | |
actions.test.ts | Loading commit data... | |
actions.ts | Loading commit data... | |
adapter.ts | Loading commit data... | |
reducer.test.ts | Loading commit data... | |
reducer.ts | Loading commit data... |