* Chore: adds query keys and refId reassignment on query row removal
* Chore: updates explore reducer tests to cover query row adding, removal, refId and key reassignment
* Chore: changes refId value in explore reducer from undefined to string to avoid introducing new strict null errors
* Chore: fixes a small nitpick with array spread in Explore reducer
* Chore: removes unnecessary dispatches in query row tests in Explore reducer test
* 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>
* Updated templating code to support the $__user variable to expose the current
userid, username, email and login.
Fixed the $__org variable as it was returning the user id instead of the ordId.
Updated the documentation to match
* Updated solution to retrieving $__user variables to pull directly from user record (thereby allowing future access to properties that
might not exist in the contextSvr).
Replicated this initialisation in the variables feature
Corrected typo's in documentation.
* Repaired typecheck issues.
* Updated patch to pull entirely from contextSrv without API calls.
* ... And removed the redundant comments.
* Updated documentation.
note: This is just Azure Monitor within the Azure Monitor datasource (not insights, insights analytics, or log analytics yet).
Co-authored-by: Ryan McKinley <ryantxu@gmail.com>
* added tests to verify flow.
* refactoring picker reducer.
* made all the tests green.
* removed console.log's
* fixed toggle all and making sure the correct values are set on picker open.
* added more tets.
* refactored and added table tests.
* fixed so we select values from selectedValues instead of options.
* fixed so you can navigate and select even after you have filtered a variable.
* adding tests to verify flows when toggling by highlight.
* fixed so enter always selects value before closing.
* improved the code for tags.
* Fix Loki and Prometheus query fields on mobile devices
* Add min widt to Elasticsearch Query Field
* Remove width for Elastic, works nicely without updating it
* Update public/app/plugins/datasource/loki/components/LokiQueryFieldForm.tsx
Co-authored-by: Zoltán Bedi <zoltan.bedi@gmail.com>
Co-authored-by: Zoltán Bedi <zoltan.bedi@gmail.com>
* Logs: Use result range instead of timepicker range for log histogram
If a logs datasource does not send histogram data for the requested
time range, the logs model computes a timeseries based on the log row
counts, bucketed by an automcatically calculated time interval. Even
when this histogram time series did not span the whole requested time
range it was still rendered in the graph across the whole range, leaving
an empty area at its start. Users find this confusing and are lead to
believe their log data is missing.
This change fixes this by anchoring the start of the timeseries on the
first log row's timestamp from the result, and adds this smaller range
as `visibleRange` to the logs model and passes it through to the logs
component that optionally takes it into account to not render the empty
area.
The interval (bucket size) is also adjusted to account for a potentially
finer resolution on the shorter visible time interval.
The bucketsize multiplier was also changed from 10 to 20 to account for
the space between the chart's bars.
* Aligned visible range with buckets
* Extract bucket size calculation and add test
* Chore: updates Explore result processor to sort dataframes based on their refId so results are displayed in a correct order
* Chore: adds types to Explore ResultProcessor getTableResult DataFrames
* add some padding to accommodate for vertical scrollbar
* use theme spacing
* Move padding to inner div and make it use actual scrollbar width
Co-authored-by: Torkel Ödegaard <torkel@grafana.com>
* Chore: updates add label to query method in prometheus datasource to fix loki label insert
* Chore: adds addLabelToQuery test covering differences between adding label to loki vs non-loki queries
* Chore: adds an additional comment to addLabelToQuery
* Chore: renames isLokiDatasource to hasNoMetrics in addLabelToQuery
* First pass solution
* Refactor solution
* Add test coverage, update tests
* Fix behaviour for multiple labels, add test for this
* Add recordin rules to devenv prometheus
* Update devenv/prometheus2 instead of devenv/prometheus
* Add newlines
* Fix label matching if labels include comma, add test coverage
* Refactor
* Refactor, simplify
* Shorten filter history label
* Add keyboard shortcuts for update comment in Query history
* Add test coverage for new keyboard shortcuts
* Update changed aria-label in tests
* Add test scenario for enter and ctr key