grafana / explore-logs

Repo for the Loki log exploration app
GNU Affero General Public License v3.0
236 stars 7 forks source link

Pages: Breakdown routes #477

Closed gtk-grafana closed 3 days ago

gtk-grafana commented 2 weeks ago

Fixes: https://github.com/grafana/explore-logs/issues/351 Fixes: https://github.com/grafana/explore-logs/issues/462

Adding routes for the breakdown pages:

Services index: /a/grafana-lokiexplore-app/explore Breakdown: /a/grafana-lokiexplore-app/explore/service/:service/:breakdownSlug

e.g.:

Service Index: /a/grafana-lokiexplore-app/explore/
Logs: /a/grafana-lokiexplore-app/explore/service/tempo-distributor/logs
Labels: /a/grafana-lokiexplore-app/explore/service/tempo-distributor/labels
Fields: /a/grafana-lokiexplore-app/explore/service/tempo-distributor/fields
Patterns: /a/grafana-lokiexplore-app/explore/service/tempo-distributor/patterns

This PR will allow users to use the browser history to go back or forward to breakdown or index pages, instead of the whole app having essentially a single entry in the browser history.

Breadcrumbs should remain unchanged, functionality should be mostly unchanged as well. This includes clearing the filters when removing the service. It might be possible to keep filters cached, so when users removing a service, and then add it again, the previous filters are applied, but the breakdown pages cache filters individually, so when a filter was removed from a single breakdown, and then the service removed, and then re-added, each breakdown would have different filters cached, although they weren't in the URL, so weren't being applied to the query, which was buggy. If we could figure out how to have a single cache for all filters in breakdown routes, users might not need to go back in the browser history as much, as filters would be cached to the service slug.

Functionality that did change:

Notes:

Follow ups (in another PR):

gtk-grafana commented 1 week ago

This is currently in a somewhat working state. Caveats are browser back button can now take you back to the index page, but filters are not cleared (but they don't exist in the URL):

image

And breadcrumbs are a bit buggy:

image

Hopefully we can fix these bugs and merge this in before refactoring the code to support new routes.

gtk-grafana commented 1 week ago

Stuff to think about: