Skip to content

feat: share dashboard filters through the URL (#385) - #387

Open
timdegroot1996 wants to merge 1 commit into
mainfrom
feat/385-url-filters
Open

timdegroot1996 wants to merge 1 commit into
mainfrom
feat/385-url-filters

Conversation

@timdegroot1996

Copy link
Copy Markdown
Collaborator

Fixes #385

Problem

A filtered dashboard view could not be shared or bookmarked: filters lived only in the filter modal and were lost on reload.

Solution

New module js/filter/url.js:

  • Write: after every filter pass (filter modal close, page switch, overview card drill-down) the active page and the global filters that differ from the defaults are written to the query string with history.replaceState, e.g. ?page=dashboard&run=WebshopUI&tag=dev&amount=3.
  • Read: on load the query string is applied to the filter modal right after capture_default_filters(), so the filter profile "differs from default" checks still compare against the real defaults.
  • The filter state is captured/applied through the existing filter profile functions, so every global filter is covered: run, tags + tag mode, versions, from/to date and time, metadata, amount, suite path and custom filters (filter.<name>, filterMode.<name>).
  • Invalid values (malformed date, negative amount) and values that do not exist in the opened dashboard (unknown run, tag, suite path) are ignored, so a link never hides every run. Query parameters the dashboard does not own are kept.
  • The --amount default that the first filter pass clamps to the number of runs is still treated as the default, so it is not written.

Docs: new "Sharing Filters Through the URL" section in docs/filtering.md with the parameter table.

Behaviour change

A reload now keeps the filters (they are in the URL), and page is always present in the URL.

Tests

  • JS unit: tests/javascript/filter_url.test.js (build, parse, invalid values, round trip).
  • Robot (06_filters.robot): Validate Filters From The Url Are Applied, Validate Changed Filters Are Written To The Url. Both fail without the wiring, pass with it.
  • Full robot suite (Docker): 147 tests, 147 passed, 0 failed. JS: 550 passed.

🤖 Generated with Claude Code

The active page and global filters are written to the query string
after every filter pass (history.replaceState), so a filtered view can
be bookmarked or sent as a link. On load the query string is applied to
the filter modal right after the default filters are captured, so the
filter profile "differs from default" checks stay correct.

Only filters that differ from the defaults are written. The filter
state is read and applied through the filter profile functions, so all
global filters are covered (run, tags + mode, versions, dates, metadata,
amount, suite path, custom filters). Values that do not exist in the
opened dashboard are ignored instead of hiding every run, and query
parameters the dashboard does not own are kept.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Make dashboard filters shareable through the URL

1 participant