You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
analytics/lib/plausible
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>
3 years ago
..
auth Fix master build (#3432) 3 years ago
billing Warn user about Stats API when downgrading (#3471) 3 years ago
data_migration Data Migration: rewrite funnels that contain duplicate goals (#3361) 3 years ago
event Clean up after V2 migration (#2868) 4 years ago
funnel Implement backend core for funnels (#3023) 3 years ago
goal Plugins API: 2nd pass with Goals resource + SharedLinks schema changes (#3396) 3 years ago
google Upgrade Erlang/Elixir stack (#3454) 3 years ago
helpers improve transfer ownership error message (#2651) 4 years ago
imported Switch to new clickhouse adapter (ch/chto) (#2733) 4 years ago
ingestion Upgrade Erlang/Elixir stack (#3454) 3 years ago
plugins/api Implement new sites view (#3463) 3 years ago
sentry Upgrade Erlang/Elixir stack (#3454) 3 years ago
session Clean up after V2 migration (#2868) 4 years ago
site Implement new sites view (#3463) 3 years ago
stats Implement new sites view (#3463) 3 years ago
telemetry Gatekeep ingestion pipeline (#2472) 4 years ago
application.ex Upgrade Erlang/Elixir stack (#3454) 3 years ago
async_insert_repo.ex Switch to new clickhouse adapter (ch/chto) (#2733) 4 years ago
cldr.ex Revenue tracking: Add currency field to goal creation (#2948) 4 years ago
clickhouse_event_v2.ex Revenue tracking: Ingestion and breakdown queries (#2957) 3 years ago
clickhouse_repo.ex Switch to new clickhouse adapter (ch/chto) (#2733) 4 years ago
clickhouse_session_v2.ex use ecto_ch (#2890) 4 years ago
data_migration.ex Make self-hosted data migration easier (#2865) 4 years ago
debug_replay_info.ex Add debug_replay_info context to Sentry Stats reports (#3189) 3 years ago
funnel.ex Bump funnel max size to 8 steps (#3094) 3 years ago
funnels.ex Data Migration: rewrite funnels that contain duplicate goals (#3361) 3 years ago
geo.ex Upgrade Erlang/Elixir stack (#3454) 3 years ago
goals.ex Implement Stats API feature gate (#3411) 3 years ago
http_client.ex Use Phoenix LiveView for the upgrade page (#3382) 3 years ago
import_deletion_repo.ex Split clickhouse repos - making the main one read only (#2826) 4 years ago
ingest_repo.ex Switch to new clickhouse adapter (ch/chto) (#2733) 4 years ago
mailer.ex Fix and refactor invitation logic (#3376) 3 years ago
open_telemetry.ex Remove ingestion requests and Oban queries from OTEL (#2543) 4 years ago
pagination.ex Implement new sites view (#3463) 3 years ago
prom_ex.ex Implement new sites view (#3463) 3 years ago
props.ex Implement Stats API feature gate (#3411) 3 years ago
purge.ex Document reasoning behind disabling deduplication in import tables (#3439) 3 years ago
repo.ex Implement new sites view (#3463) 3 years ago
site.ex Implement new sites view (#3463) 3 years ago
sites.ex Implement new sites view (#3463) 3 years ago
stats.ex Add debug_replay_info context to Sentry Stats reports (#3189) 3 years ago
themes.ex Adds dark mode to entire dashboard (#467) 6 years ago
timezones.ex Fix timezone list when time changes (#2268) 4 years ago
users.ex Improve and simplify email verification codes generation (#3407) 3 years ago