grafana / grafana

The open and composable observability and data visualization platform. Visualize metrics, logs, and traces from multiple sources like Prometheus, Loki, Elasticsearch, InfluxDB, Postgres and many more.
https://grafana.com
GNU Affero General Public License v3.0
61.15k stars 11.68k forks source link

Preserve variables and time range when navigating between dashboards #87966

Closed dprokop closed 2 weeks ago

dprokop commented 1 month ago

Available under preserveDashboardStateWhenNavigating feature toggle.

This is a POC of a functionality that will allow preserving currently selected ~filters and group by dimensions~ dashboard variables and time range when navigating between different dashboards. It's an early WIP to gather some opinions.

How it works?

  1. Currently selected variable and time range are captured on DashboardScene deactivation and stored in the local storage under a tab-specific key.
  2. When new dashboard scene is loaded, we read from local storage and replace the location in the browser with the saved query params, so that when the URL sync is activated, the variables will restore preserved values.
  3. When one navigates away from Grafana the preserved filters are cleared.

TODO:

dprokop commented 3 weeks ago

@torkelo @ashharrison90 - i still need to implement tests, but this should be ready for approach review and testing. Available under preserveDashboardStateWhenNavigating feature toggle.