* Moving query stuff out of dashboard folder
* Moved more stuff
* Moving more stuff
* Update
* WIP test page
* Minor change
* Before big changes
* Fixed test
* Refactor: Adds getNextAvailableId
* Refactor: Hides DependencyGraph button if there are no dependencies
* Refactor: Changes the new button
* Refactor: Removes usages of NEW_VARIABLE_ID
* Refactor: Reverts the new button
* 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>
* Refactor: Replaces initLock with state machine
* Refactor: removes some states for now
* Refactor: adds loading state in OptionsPicker
* Refactor: major refactor of load state
* Refactor: fixes updating graph in parallell
* Refactor: moves error handling to updateOptions
* Refactor: fixes the last cases
* Tests: disables variable e2e again
* Chore: removes nova config
* Refactor: small changes when going through the code again
* Refactor: fixes typings
* Refactor: changes after PR comments
* Refactor: split up onTimeRangeUpdated and fixed some error handling
* Tests: removes unused func
* Tests: fixes typing
* Chore: Remove angular dependency from data sources
* Removes default export for time and template srvs
Also uses @grafana/runtime versions of the interfaces where possible
* Replace usage of internal templateSrv where possible
* Use runtime templateSrv in a couple more places
* Refactor: initial commit
* Tests: updates tests
* Tests: updates snapshots
* Chore: updates after PR comments
* Chore: renamed initVariablesBatch
* Tests: adds transactionReducer tests
* Chore: updates after PR comments
* Refactor: renames cancelAllDataSourceRequests
* Refactor: reduces cancellation complexity
* Tests: adds tests for cancelAllInFlightRequests
* Tests: adds initVariablesTransaction tests
* Tests: adds tests for cleanUpVariables and cancelVariables
* Always cleanup dashboard on unmount, even if init is in progress. Check if init phase has changed after services init is completed
* fixed failing tests and added some more to test new scenario.
Co-authored-by: Torkel Ödegaard <torkel@grafana.com>
Co-authored-by: Marcus Andersson <marcus.andersson@grafana.com>
* Variables: turns on newVariables as default
* Chore: adds default templating state
* Some small refactorings to get the template_srv tests to get green when toggle is enabled by default.
* Refactor: adds getVariables dependency to DashboardModel
* Tests: fixes StackDriver tests
* Tests: updates snapshots
* Tests: updates snapshot for DashboardGrid.test.tsx
* Tests: fixes DashboardModel.test.ts
* fixed initDashboard tests.
* renamed variable.
* changed so we use the templating.list when running the migration work.
* changed so we always returns the variables in sorted order.
* Tests: fixed cloudwatch tests
* added so we set the global template variable props.
* Fixed tests and added moved logic to complete templateSrv variables.
* removed unneccesary updateIndex.
Co-authored-by: Marcus Andersson <marcus.andersson@grafana.com>
* Fixed issue with multi value.
* Made some refactorings after feedback from Torkel and Hugo.
* minor refactorings.
* changed so we don't make the current value to array if multi is false.
* added snapshot to contain v23.
* Fixed so we always use the correct type when setting value for multi/non-multi.
* added some more tests.
* added tests.
* some small adjustments after feedback
* Refactor: moves all the newVariables part to features/variables directory
* Feature: adds datasource type
* Tests: adds reducer tests
* Tests: covers data source actions with tests
* Chore: reduces strict null errors