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
tabquery 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
tabquery param is present in the URL, the corresponding tab is set as the active view by default. - If the
tabparam 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
tabparam falls back to the first tab (index0). - Navigating to a different dashboard resets the active tab to
0and clears/updates thetabparam accordingly. - Unit tests cover the query param read/write behaviour.
References
- Originating comment: !246227 (comment 3570163812)
- Related MR: !246227 (merged)
- Related task: #605890 (closed)
Edited by 🤖 GitLab Bot 🤖