* Refactor `AvailableFeature` from strings to an enum everywhere
* Fix circular dependency and type
* Add "Per-project access" feature flag, premium feature, and organization switch
* Rename `OrganizationMembershipLevel` to `OrganizationAccessLevel`
* Create `ExplicitTeamMembership` model
* Show whether projects are restricted in the project switcher
* Update organizations API code
* Fix migrations
* Move organization tests that require EE to `ee`
* Revert `OrganizationMembershipLevel` rename
* Fix organization tests
* Update migration
* Fix schema and add Members to Project Settings
* Build out test memberships API with security tests
* Update `TeamMembers` and `teamMembersLogic`
* Move "Per-project access" description to tooltip
* Add moar tests
* Fix Project Members list logic
* Add additional membership checks
* Update migrations
* Fix typing
* Adjust explicit team memberships API similarly
* Fix typo
* Unify `ExplicitTeamMemberSerializer`
* Remove old changes to `membersLogic` usage
* Use `effective_membership_level` on `TeamBasicSerializer`
* Clean up organization update tests
* Explicitly disallow enabling per-project access for free
* Fix circular import
* Remove `id` from `UserSerializer`
* Fix typing
* Try to fix import
* Fix fatal typing
* Add more tests
* Update permissioning.ts
* Add clarifying comment to migration
* Fix import
* Revert `TopNavigation` changes
* Add project member addition button+modal
* minor clarifications
* Revert `TopNavigation` changes
* Make new access control entirely project-based
* Update migrations
* Add `project_based_permissioning` to `TeamBasicSerializer`
* Update test_team.py
* Fix Access Control restriction tooltip
* minor improvements
* fix frontend typing
* Fix frontend typing a bit more
* adjust copy & UI a bit
* Address feedback on field comment
* "Privacy settings" to "Access Control"
* Make `FusedTeamMemberType` comment clearer
* Remove useless `export`
* Delete 0169_project_based_permissioning.py
* Clean some code up a bit
* Project-based permissioning member removal (#6067)
* Fix `teamMembersLogic` loaders
* Allow explicit project members to leave
* Add member removal/leaving button to Members with Project Access
* Restore error message
* Fix error message
* Correct things
Co-authored-by: Paolo D'Amico <paolodamico@users.noreply.github.com>
* test(breakdown): add test for week interval rounding overshooting
This refers to https://github.com/PostHog/posthog/issues/2675
* fix(breakdown): resolve week rounding interval over shoot for trends
Previously there was a fix for another issue with weekly intervals not
spanning a large enough range, see
69ba0b1d90
for details.
The issue that this was trying to resolve was consider a date range
date_from, date_to and a week interval. The range can cross two weeks,
but prior to the above commit it would only show one tick/week on the
graph. In this case we just added on another week to show.
This doesn't help however in the case where the range is less than a
week, in which case we'd end up showing a week/tick on the graph with
a zero value.
Instead, we remove the additional 1 week and simply ensure that both
lower and upper bounds are included in the clickhouse zero fill.
Closes https://github.com/PostHog/posthog/issues/2675
* fix(lifecycle): update lifecycle to use updated week interval handling
This is due to the change in the way the week interval is handled in the
previous commi, where we removed a +1 we were adding to week intervals
and thus getting too many date axis ticks on trend graphs.
* ci(tests): only run non-ee tests for non ee action step
It seems that we are segregating tests between ee and non-ee via a
folder structure. This is a bit of a hack, but it works for now but
ideally we should converge on one set of tests for which we identify if
they are supported on clickhouse or not via pytest markers. This should
simplify working with the tests somewhat, e.g. making them easier to
locate, update, and e.g. debug in vscode/codespaces.
* test(trends): correct old week interval test. It was wrong before
Now with the change to how we create the interval, it's fixed.
* fix(trends): avoid including one week too many when deciding on bounds
Previously there was a test in here that was saying that if we request a
graph of events, with week interval ticks starting on a Sunday, we'd
actually end up also including the Sunday before due to some arithmetic
mistakes.
* fix(trends): resolve week interval rounding issues for trends query
* test(identify): update test func to accept `properties` argument
* report on self hosted duplicate ids
* satisfy mypy
* satisfy black
* adjust test to run on ch only
* black
* fix stupid test typo
* black, again
* update report
* format
* fix black pre commit hook
* update query
* report on multiple ids per person
* fix foss test
* barebones implementation for #3899
Wires up an unlabelled switch with existing functionality. Doesn't provide any persistence of the setting or user feedback for when data is loading. Doesn't highlight new rows
* align content in table config to baseline
* make auto-loading text clickable without resolving page structure
* lift exporting and auto-loading out of table content and a pass through organising the page with grid layout
* note that the fixed filters won't change per logic instance
* never display the column configurator button. to be resolved by #1534
* simplify the labelled switch component
* highlight new rows when they're added to the table
* use styling from variables for labelled switch
* load new events into the table when the toggle is clicked so the human doesn't have to wait
* saves auto-load toggle to URL and loads it from there
* clearer name for temporary, fixed featured toggle
* use clsx for row classes in the EventsTable
* remove use of window in actionToUrl of events table logic
* add a test for unusual input to toParams while looking for the source of a bug
* don't allow input that stops events loading in the table
this is a workaround not a fix
* don't allow input that stops events loading in the table
this is a workaround not a fix
Co-authored-by: Paul D'Ambra <paul@posthog.com>
I was having issues with running the clickhouse/ee tests and it was just
hanging. Clickhouse appeared to be up and I could perform queries with
`clickhouse-client`. For some reason it was hanging on querying, and on closer
inspection if looks like for each of the setup queries it was hanging for 6
seconds, failing to find zookeeper, and then continuing to run setup.
It's pretty useless to continue in this case, so it seems more sensible to raise
in this case.
* reload 4 dashboard items at a time
* reload all items WIP
* delete dead code
* make visibilityMap default to visible
* fix insight logic props
* bugfix
* pass cachedResults do element
* type for insight logic props
* type and syntax cleanup
* set cached items if present
* fix more type inconsistencies
* fix undefined bug
* simpler refresh checking
* cleanup
* clean results exception
* remove escape hatch
* Revert "make visibilityMap default to visible"
This reverts commit 5e7e1befd5.
* fix TS error
* no separate time conversion bins
* make funnels horizontal
* move exclusion filter to horizontal tab
* barebones implementation of vertical breakdowns
* refactor bar graph stuff a bit
* add visibility toggle to table
* tie in table logic visibility map to bar display
* remove dummy data
* add table legend
* add graphs to table
* breakdown indices bug
* fix toggling
* fix regression tests and add bar interaction
* remove consoles
* edge cases with long steps and many breakdowns
* fixes from review
* hide behind FF
* actually hide behind FF, fix time conversion bug, and convert visibility map to hidden map
Co-authored-by: Marius Andra <marius.andra@gmail.com>
* mockup usable logic tests
* actually filter
* a little verbosity never hurt anyone
* await
* sync toDispatchActions and toMatchValues working
* get at least one test working
* should await this
* better action awaiting
* cleanup
* smarter logic test action matching
* cleanup
* delete snapshots
* fix titles
* remove .run(), add .then-magic
* cleanup
* more cleanup
* refactor into multiple files
* refactor into multiple files WIP
* finish refactor
* make nodejs compatible
* funnel logic test WIP
* delay and printActions
* fix label
* add more mocks
* only call action if it makes sense
* fix reload issue with funnels and actions
* explicitly connect to this logic
* listener and mount functions for kea-test-utils
* improve tests
* mock out scss files
* rename antd es/ to lib/ for compatibility in jest
* add breakdown test
* funnel test updates
* set pointer to now if running a block with expectLogic
* fix mock
* more mock
* ignore if breakpoint
* reset window history and posthog-js with logic tests
* one more breakpoint
* add test mode ecxeptions
* update kea
* improve funnel test
* merge, but break
* add safeguard
* safer props
* fix test bugs
* clarify window.crypto polyfill
* simplify api.mock
* simple throw if unmocked api
* use a global actionMap pointer, so we could query between logics
* use the global querying
* remove "Scene" hack
* fix type bug
* clarify some variables
* docs(funnel): add comments around how the funnel query is build for pg
* chore(funnel): explicitly couple `_gen_lateral_bodies` to `_build_query`
`_gen_lateral_bodies` result seems to always be passed to `_build_query`
so it doesn't make too much sense to have them required to be called in
conjunction.
There are probably further changes that could be made. There is some
implicit coupling around the return value and the joining of the bodies
into a LATERAL JOIN, which should be made explicit.
* chore(funnels): reduce the query generation complexity
This is mainly just to make it a little more clear how the query fits
together.
I have done something naughty here in that I have changed from a using a
GROUP BY to using DISTINCT ON for the top level. I think you'd get
uniqueness of funnel path anyway, as each lateral join should only
produce only one result.
* perf(funnels): add filter on pdi.team_id to speed up query
Have tested on prod with team_id=2. Seems to work at making the query
complete in time. Quite quick there but not much data.
There's probably a lot more we could do here but I don't want to burn
too much time on this.
Future improvements could be:
1. Remove the first subquery and just do a join
2. Investigate if there's benefit in removing the group by and using
distinct on. I don't know enough about this tbh.
3. Remove all the string manipulations with re. Just write up the query
by hand.
4. Remove the implicit coupling between query_bodies gen and the `for step,
qb` look. It's probably best to do this in one pass.
Closes #5519
* dropdown menu
* creation buttons setup
* temp save
* editing name/description mode
* clean up
* fix bug
* new main nav button
* wording
* undo removal
* fix test
* fix logic flow with new tab insight creation
* fix functionalities
* clean up props and fix toast
* prettier
* fix lint error
* try to fix annotations menu item test
* do not create new insight upon tab switch
* view and edit mode, final clean up, bug fixes
* clean up insights without the feature flag
* update insight only when it exists
* clean up and fix bugs
* prettier
* do not run create insight code on dashboards
* split out funnel apis and fix histogram paint order bug
* fix broken tests
* simplify some more
* make this fail if no steps returned
Co-authored-by: Marius Andra <marius.andra@gmail.com>