Add view query param for deep linking to a dashboard view

Summary

Follow-up to this comment on !246227 (merged), which introduced tabbed views to the analytics dashboard.

Add a tab query parameter to the analytics dashboard URL that reflects the currently active tab. This enables deep linking directly to a specific dashboard view.

Motivation

With the introduction of multiple named views (tabs) in a single dashboard (see !246227 (merged)), users should be able to share or bookmark a URL that opens the dashboard at a specific tab. Without this, navigating to a dashboard always lands on the first tab regardless of intent.

Proposed Behaviour

  • When a user switches tabs, the URL is updated with a tab query param reflecting the index of the active tab (e.g. ?tab=1).
    • The tab index is used (rather than the tab title) because tab titles may not be URL-safe and are not guaranteed to be unique.
  • When the dashboard loads and a tab query param is present in the URL, the corresponding tab is set as the active view by default.
  • If the tab param is out of range (e.g. the dashboard has fewer views than the index), fall back gracefully to the first tab.
  • The param should be updated reactively as the user switches tabs, and cleared or reset when navigating to a different dashboard.

Acceptance Criteria

  • Switching tabs updates the URL with ?tab=<index> without triggering a full page reload.
  • Loading a dashboard URL with ?tab=<index> opens the dashboard with the corresponding tab active.
  • An out-of-range or invalid tab param falls back to the first tab (index 0).
  • Navigating to a different dashboard resets the active tab to 0 and clears/updates the tab param accordingly.
  • Unit tests cover the query param read/write behaviour.

References

Edited by 🤖 GitLab Bot 🤖