analytics/test/plausible_web/controllers
Adrian Gruntkowski 07cab27fef
Implement new sites view (#3463)
* Implement complete basics of LV sites

* Reimplement everything in LV except pagination

* Implement basic search capability

* PoC: plot visitors on sites index

* Add rudimentary clipped gradient in minicharts

* Fix clipping gradient, define once

* Format

* Add moduledoc to visitors component

* Move paginator helpers to the top core namespace

* Fix typespec of `Plausible.Sites.list`

* Split sites component into subcomponents

* Add function to uniformly calculate 24h intervals
and visitor totals across multiple sites.

* Integrate batch 24h interval query with plots on sites view

* Don't confuse heex compiler with alpine @ shorthands

* Make linear gradient svg definition truly invisible

* Implement basic pagination

* Extract `site_stats` from site and invitation cards

* Improve pagination

* Tweak css

* Improve filtering on pagination and make WSS fail graceful

* Test `last_24h_visitors_hourly_intervals/2`

* Replace /sites with LV implementation

* Add debounce to search filter

* Fix typespecs

* Fix styling

* Fix mini graph scaling factor calculation

* Fix search consuming itself

* Minimal tweaks to the plots

* Fixup

* Remove magic numbers from the plot

* Create `site_pins` table

* Add `SitePin` schema

* Implement listing invitations, sites and pins in a single query

* Add FIXME note

* Remove site pins for now

* Add tests for `Plausible.Sites.list/3`

* Add a couple more tests to sites dead view

* Remove unnecessary FIXME

* Add LV tests for Sites

* Calculate and display 24h visitors change

* Render the change in bold

* Add clarfying comment on virtual field in `Site` schema

* Remove unnecessary function from Invitations API

* Remove unused list opt from type definition in `Sites`

* Improve joins in list query slightly

* Add comment on manually computing sites list total

* Start searching from a singly character in domain field

* Add typespec to `last_24h_visitors_hourly_intervals`

* Extend moduledoc in visitors component

* Simplify loading sites in LV

* Simplify assigns in LV

* Add missing group for shadow under site card

* Make invitation modal render

* Make HTML in sites LV semantically correct

* Remove autofocus and focus search on `/`

* Remove shadow from search input

* Make search cancel on escape

* Fix tests relying on outdated HTML structure

* Make visitor chart color scheme consistent with dashboard chart

* Update styling of trend labels

* Fix empty state and improve search blur/focus handling

* Use live navigation for pagination

* Implement spinner on load from search

* Remove unused `Plausible.Stats.Clickhouse.last_24h_visitors/1`

* Calculate uniques correctly across hour boundaries

* Swap inlined svg for Heroicons component in invitation modal

* Add order by to base query in 24h hourly intervals

* Revert "Add order by to base query in 24h hourly intervals"

This reverts commit a6be5e3026.

* Query clickhouse 24h visitors only on second mount

* Remove redundant sign from percentage change when negative

* Switch to offset-based pagination

  - offset seems easier to deal with for when actions on
    paginated list will be performed such as site pinning;
    tracking cursor data makes some entries disappear in
    edge cases. The data set is still fairly small and
    static, even for large customers.
  - we're removing Phoenix.Pagination as it doesn't really
    fir any use case, and it was only used to limit the number
    of sites in the site picker
  - site picker is now limited to 9 sites (future: pinned
    sites will be prioritized there)
  - no need to re-query for total count any more
  - BTW, the old /sites template was removed

* Refine the plot queries; Tests pass snapshot

* Add PromEx plugin for LiveView

* Fix tiny plot cut-off at the top

---------

Co-authored-by: Adam Rutkowski <hq@mtod.org>
2023-11-02 13:18:11 +01:00
..
api Upgrade Erlang/Elixir stack (#3454) 2023-10-24 10:33:48 +02:00
auth_controller add LOG_FAILED_LOGIN_ATTEMPTS (#2936) 2023-05-25 10:37:10 +03:00
CSVs Filter out empty entries when listing stats for UTM props (#3339) 2023-09-12 09:11:50 +02:00
site Feature gates (#3401) 2023-10-11 09:40:01 -03:00
admin_auth_controller_test.exs improve first launch experience for self-hosters (#2357) 2022-11-10 12:42:22 +01:00
auth_controller_sync_test.exs Fix email update flow for selfhosted setup with verification disabled (#3408) 2023-10-11 15:12:57 +02:00
auth_controller_test.exs Upgrade Erlang/Elixir stack (#3454) 2023-10-24 10:33:48 +02:00
avatar_controller_test.exs Nolt sso (along with a better nav dropdown) (#3395) 2023-10-17 12:01:27 +03:00
billing_controller_test.exs Restrict subscribing to a plan when exceeding its limits + warning for losing feature access (#3461) 2023-10-26 18:20:38 +03:00
error_report_controller_test.exs Funnel site settings (#3039) 2023-06-22 09:00:07 +02:00
invitation_controller_test.exs Feature gates (#3401) 2023-10-11 09:40:01 -03:00
page_controller_test.exs add landing page (#2989) 2023-06-01 14:34:48 +03:00
site_controller_test.exs Implement new sites view (#3463) 2023-11-02 13:18:11 +01:00
stats_controller_test.exs Upgrade Erlang/Elixir stack (#3454) 2023-10-24 10:33:48 +02:00
unsubscribe_controller_test.exs Run tests in async mode where applicable (#2542) 2022-12-26 10:20:29 -03:00