-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adds manual, editable, auto-suggested filters, and negated&globbed path-based filters #1121
Conversation
commit 3081920 Merge: 39287ab a299fab Author: Vignesh Joglekar <[email protected]> Date: Fri Jun 11 03:40:55 2021 -0500 Merge branch 'manual-filters' into manual-filters-2 commit a299fab Author: Vignesh Joglekar <[email protected]> Date: Fri Jun 11 02:20:26 2021 -0500 Changes to split and pattern matched function for time_on_page commit 10f10c9 Author: Vignesh Joglekar <[email protected]> Date: Fri Jun 11 01:53:18 2021 -0500 Fixes a couple of minor UX issues commit f2e5ce8 Author: Vignesh Joglekar <[email protected]> Date: Fri Jun 11 01:49:10 2021 -0500 Fixes time on page for globbed and negated page paths commit bb18af6 Author: Vignesh Joglekar <[email protected]> Date: Thu Jun 10 05:24:05 2021 -0500 Close to finalized version of updated version Just needs some additional testing + potentially code cleanup commit d0b7bfe Author: Vignesh Joglekar <[email protected]> Date: Fri May 28 04:21:21 2021 -0500 Real Dialyzer Fix commit 296a76a Author: Vignesh Joglekar <[email protected]> Date: Fri May 28 03:44:29 2021 -0500 Dialyzer fix commit 91f3b44 Author: Vignesh Joglekar <[email protected]> Date: Thu May 27 17:11:24 2021 -0500 Changelog commit e041f75 Author: Vignesh Joglekar <[email protected]> Date: Thu May 27 17:09:52 2021 -0500 Formatting commit f689642 Merge: e00929b 4ff25f6 Author: Vignesh Joglekar <[email protected]> Date: Thu May 27 17:08:47 2021 -0500 Merge branch 'master' into manual-filters commit e00929b Merge: 83887c4 806975e Author: Vignesh Joglekar <[email protected]> Date: Thu May 27 17:01:48 2021 -0500 Merge branch 'manual-filters' of github.com:Vigasaurus/plausible-analytics into manual-filters commit 83887c4 Author: Vignesh Joglekar <[email protected]> Date: Thu May 27 16:59:32 2021 -0500 Adds tests for suggestions, formats goals suggestion query commit 1cb7732 Author: Vignesh Joglekar <[email protected]> Date: Thu May 27 16:36:31 2021 -0500 Adds goals as auto-complete capable filter commit 4ca39cc Author: Vignesh Joglekar <[email protected]> Date: Thu May 27 16:08:22 2021 -0500 95% completed auto-complete setup Still needs: - tests - goals added as filter commit 22d38c4 Author: Vignesh Joglekar <[email protected]> Date: Thu May 27 03:47:19 2021 -0500 80% of auto-complete filters progress Still needs - countries and screen into new format - re-style dropdown and background - drop debounce time - tests commit 806975e Merge: 81c5e05 1a93542 Author: Vignesh Joglekar <[email protected]> Date: Tue May 25 15:28:21 2021 -0500 Merge branch 'master' into manual-filters commit 81c5e05 Author: Vignesh Joglekar <[email protected]> Date: Tue May 25 15:21:03 2021 -0500 Makes colorings on top bar elements consistent commit fa7f6c2 Author: Vignesh Joglekar <[email protected]> Date: Tue May 25 14:58:25 2021 -0500 Makes requested changes, adds different version of filter button commit 7dc65b9 Author: Vignesh Joglekar <[email protected]> Date: Sat May 22 04:29:01 2021 -0500 Changelog commit c684f1c Author: Vignesh Joglekar <[email protected]> Date: Sat May 22 04:26:14 2021 -0500 Various UI Improvements - Makes edit buttons full-length & properly sized - Adds remove filter button in edit menu commit a632e7a Author: Vignesh Joglekar <[email protected]> Date: Sat May 22 03:11:50 2021 -0500 Adds tests for exclusions and wildcards commit eb91a79 Author: Vignesh Joglekar <[email protected]> Date: Sat May 22 03:02:23 2021 -0500 Fixes editing UX on list view commit 6209d72 Author: Vignesh Joglekar <[email protected]> Date: Fri May 21 04:01:17 2021 -0500 Bugfix in realtime view, formatting commit 007d44d Author: Vignesh Joglekar <[email protected]> Date: Fri May 21 03:23:16 2021 -0500 Second pass - mostly everything user-facing is done Still needs: - Tests - Potentially negating other filters - Potentially some code cleanup commit cb7b5b9 Author: Vignesh Joglekar <[email protected]> Date: Fri May 21 01:49:52 2021 -0500 First pass on manual filter & path regex/negated filters Still needs: - Form structure on filter modal - Edit filter button - Filter dropdown UI improvement - Filter modal mount data collection - Tests - Potentially negating other filters
3081920
to
23c726c
Compare
…owing up Reverting to v16 was the simplest fix without diving into the issue upstream with Flatpickr
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me overall, it's getting very close. I left a couple small style comments in the code. Here are my comment about the overall behaviour:
I like how the select box works now. However, I am very much annoyed by the slight differences in border radius, border color, font size, padding, chevron color etc between these two inputs. They should be consistent.
The loading indicator is nice 👌. A small thing I noticed is when you select a value from the dropdown, the loading indicator will flash for a second. I can also see a call to the suggestions endpoint. This seems unnecessary after the user has already made a choice.
Personally I don't like the focus style on the dropdown (in light mode, at least). I think it's bg-indigo-300
with dark text. I've created a JS dropdown for the invitations UI and I used bg-indigo-600 text-white
as the hover/focus style which I think fits much better. Thoughts?
} | ||
|
||
if (selectedFilter) this.fetchSuggestions('', (defaultOptions) => this.setState({ defaultOptions })) | ||
this.setState({ updatedValue, inputValue: updatedValue, negated, forceReloadSuggestions: forceReloadSuggestions + 1 }) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can this be done in a single setState
? The current flow seems to be:
setState({selectedFilter}) -> componentDidUpdate() -> setState({updateValue, inputValue, negated, forceReloadSuggestions})
Why can't it be just:
setState({selectedFilter, updateValue, inputValue, negated, forceReloadSuggestions})
when the filter input changes?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I mostly wrote it like this to make it a bit more DRY - because the selectedFilter
could change both via the dropdown onChange
, or from componentDidMount
when loading from the URL param - it could theoretically be brought out, but would end up being duplicated.
negated: false, | ||
updatedValue: "", | ||
inputValue: "", | ||
forceReloadSuggestions: 0, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is this variable doing?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is just to force react-select
to re-fetch the suggestions when the input changed externally (when loading from the currently set filter, primarily), using the key to force it to do so. They don't expose a way to do this directly, but it's well documented that changing the key of the component forces it to re-fetch them.
@@ -691,6 +679,55 @@ defmodule Plausible.Stats.Clickhouse do | |||
|> Enum.into(%{}) | |||
end | |||
|
|||
def page_times_by_page_url(site, query, page_list \\ nil) | |||
|
|||
def page_times_by_page_url(site, query, _page_list = nil) do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the reason for adding this new definition for page_times_by_page_url
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is for the negated and/or globbed versions of the page filter - because the old version relied on a static list of page paths from top_pages
to pick which times to keep - this version is for the top stat, which passes in nil
as the page_list
, then the filter is used to decide which pages to keep, then they're averaged into the time on page top stat for a negated or globbed page path (since this type of filter can't be represented in a static page_list, whereas from
top_pages` it's always just the up to 100 pages being returned at that call).
I did a trial with |
selectedFilter: "", | ||
negated: false, | ||
updatedValue: "", | ||
inputValue: "", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the purpose of tracking inputValue
and updatedValue
in the state? Isn't react-select already tracking the input value? Can this be removed from the state?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The disparity between updatedValue
and inputValue
is a remnant of an old implementation that I've now combined into just updatedValue, but we keep track of that (and pass it into react-select as a prop) instead of letting react-select do so, because we need to update the input manually at times (to help it not be blank when re-editing, when using the filter edit flow), otherwise it'd always default to blank when going into the input.
👍 These should be all good now.
Yeah this is because it pre-fetches results as soon as we set the inputValue prop (you'll notice this if you go directly into the edit filter flow too, it searches for suggestions before you even enter the field) - there's not a whole lot I could do about it, we could potentially add some styles to hide the loader when someone makes a selection from the menu, but I think having the results pre-fetched is more often beneficial than worse.
Yeah I like the styles you chose there (it's indigo 500 as per your current PR for it, so I just used that).
Yeah it looks interesting - I hadn't seen it before. It might be nice, but also maybe something to look into down the line once there's some feedback on this version, and we can decide if re-implementing it is time well spent. |
Thanks @Vigasaurus! Putting this on staging for further testing |
It's so much better now, great work @Vigasaurus! loads very fast too! few notes from me here:
|
Good points @metmarkosaric. I'll work on these |
Changes
Remade version of #1089 as the revert + the conflicts + something weird while resolving broke it
Notes:
I still need to go back and verify that everything merged in correctly, but it should be okayI currently havepackage-lock.json
deleted, becausenpm i
was throwing me a peer dependency error between tailwind 2.1.2 and aspect-ratio 0.2.1, but I think that's present in master too (or it could just be my version of npm, I dunno)Tests
Changelog
Documentation