plausible / analytics

Simple, open source, lightweight (< 1 KB) and privacy-friendly web analytics alternative to Google Analytics.
https://plausible.io
GNU Affero General Public License v3.0
19.93k stars 1.06k forks source link

Frontend: Use jsonurl, update filtering #4117

Closed macobo closed 4 months ago

macobo commented 4 months ago

Changes

This PR refactors significant parts of the dashboard react code.

Changes include:

  1. Internally representing filters in a similar manner to the backend. Related RFC: https://github.com/plausible/knowledge_base/blob/main/src/planning/rfcs/0005-filters_v2.md
    1. Note that the filters are not prefixed in the URL for the sake shorter and prettier urls.
  2. Prettier URLs for filters, e.g. http://localhost:8000/dummy.site?filters=((is,country,(US)),(is,page,(/)))&labels=(US:United%2BStates)
    1. This uses jsonurl under the hood
    2. Compatibility with bookmarked links is retained. On app load, we update the url parameters in a backwards-compatible way.
  3. Refactoring linking and url param handling in general to move that logic away from specific components
  4. Re-writing filter modal logic to unify 'regular' and 'props' modals

Note that the FE now supports multiple filters, though the request sent to the backend does not, yet.

Testing

I've extensively tested the changes locally, but also planning on recruiting Marco to test out these changes on staging.