0
0
mirror of https://github.com/PostHog/posthog.git synced 2024-12-01 12:21:02 +01:00
Commit Graph

2171 Commits

Author SHA1 Message Date
Marius Andra
b5a02e2ca7
Bundle our frontend via esbuild (#6758)
* esbuild package

* almost get esbuild working

* fix react-virtualized imports

* add splitting

* fix funny import reorder bug

* fix squeakAudio referring to itself

* write index.html file

* fix some bad imports

* update antd paths

* remove raw-loader usage, it didn't work anyway

* refactor and copy public

* build app and toolbar

* get toolbar working, but without styles

* make toolbar and its styles work

* shared dashboards

* clean frontend build before rebuilding

* add watch mode

* reorder tasks

* revert js url

* incremental builds of app with debounced chokidar watching

* common build/watch script

* improve logs

* watch during firrst build

* fix toolbar url

* fix wrongly exported scene

* create sceneProxyLogic to untangle sceneLogic from all bundles

* disconnect sceneLogic and refactor setPageTitle

* live reloading server

* rename utils file

* only wait for /static

* fix encoding

* simplify

* add missing dayjs plugins

* fix pathless logics

* simplify options

* add jsx for webapck

* slight delay to catch changes

* a type is a type

* fix build

* esbuild in start

* funnelLogic path

* include all files with a "." (so .mjs, etc) in /frontend/ to docker

* rename to "utils.mjs", make "build.mjs" executable

* improve erroring

* revert some needless changes

* more reverts

* change some scripts

* remove setuff

* clarify function

* make "--host 0.0.0.0" work

* fix import order issue in webpack

* remove webpack css inlining for toolbar to simplify config

* make toolbar with external styles work in storybook

* move live server injection into django

* fix undefined bug

* simplify setup to work with injection directly in http://localhost:8000 (no proxying needed on :8234)

* add comments

* Fix `fse` usage

I was getting this otherwise:

$ node frontend/build.mjs
file:///Users/twixes/Developer/posthog/frontend/utils.mjs:46
    fse.copySync(srcDir, destDir, { overwrite: true }, function (err) {
        ^

TypeError: fse.copySync is not a function
    at copyPublicFolder (file:///Users/twixes/Developer/posthog/frontend/utils.mjs:46:9)
    at file:///Users/twixes/Developer/posthog/frontend/build.mjs:5:1
    at ModuleJob.run (internal/modules/esm/module_job.js:146:23)
    at async Loader.import (internal/modules/esm/loader.js:165:24)
    at async Object.loadESM (internal/process/esm_loader.js:68:5)

* Mock `process` for VFile used by ReactMarkdown

I was getting this otherwise:

core.js:55 Uncaught ReferenceError: process is not defined
    at new VFile (core.js:55)
    at VFile (core.js:49)
    at Function.parse (index.js:273)
    at ReactMarkdown2 (react-markdown.js:42)
    at renderWithHooks (react-dom.development.js:14803)
    at mountIndeterminateComponent (react-dom.development.js:17482)
    at beginWork (react-dom.development.js:18596)
    at HTMLUnknownElement.callCallback2 (react-dom.development.js:188)
    at Object.invokeGuardedCallbackDev (react-dom.development.js:237)
    at invokeGuardedCallback (react-dom.development.js:292)

* Mock `process.env` for VFile used by ReactMarkdown

I was getting this otherwise:

platform.ts:73 Uncaught TypeError: Cannot read properties of undefined (reading 'ENABLE_VSCODE_BROWSER_CODE_LOADING')
    at platform.ts:73
    at platform.ts:79
    at Function.r._invokeFactory (loader.js:1118)
    at r.complete (loader.js:1128)
    at r._onModuleComplete (loader.js:1754)
    at r._resolve (loader.js:1714)
    at r.defineModule (loader.js:1357)
    at _ (loader.js:1804)
    at numbers.ts:10
    at fake:1

* pass the heavy appScenes to sceneLogic through props via App.tsx

* remove sceneProxyLogic

* remove exported variables

* fix sceneLogic test

Co-authored-by: Michael Matloka <dev@twixes.com>
2021-11-03 09:50:24 +01:00
Michael Matloka
a0dfa17866
Add top level danger TopBar indicator for potential system issues (#6789)
* Add top level danger `TopBar` indicator for potential system issues

* Update frontend/src/layout/lemonade/TopBar/SitePopover.tsx

Co-authored-by: Paolo D'Amico <paolodamico@users.noreply.github.com>

* Run prettier

Co-authored-by: Paolo D'Amico <paolodamico@users.noreply.github.com>
2021-11-02 18:01:03 +01:00
Michael Matloka
ab3b33bd35
Show org access level in site popover (#6763)
* Show org access level in site popover

* Simplify access level indicator code and shorten "administrator"
2021-11-02 17:37:35 +01:00
Harry Waye
bc5cc504ed
Add storybook support for updating correlation config (#6785) 2021-11-02 12:16:18 +00:00
Harry Waye
b7c898d23e
feat(correlation): load exclude properties from team settings (#6715)
* feat(correlation): add team wide person property exclusion list

This change just adds the exclusion list to the `Team` model and checks
that it can be updated. Separately we can:

 1. add interface for the Project page to display
 2. pull and update this list from the funnels correlation page

NOTE: We don't perform any validation on the structure, :fingerscrossed:
this won't be an issue. Alternative would be to use ArrayField, but use
of JSONField is consistent with other fields.

* test(correlation): add test checking exclude properties pulled from team

* feat(correlation): load exclude properties from team settings

Previously we were loading exclude properties from local storage, so we
would not be sharing the exclusion list between users. This change
simply plugs the `excludePropertyNames` into the `teamLogic` for the
purpose of persisting and loading the values.

* use [teamLogic.actionTypes.loadCurrentTeamSuccess]

* get tests passing

* switch frontend to using `correlation_config`

* refactor: use Team.correlation_config for persistence

* add project settings for correlation

* fix lint

* ensure excluded properties are saved to project config

* Add default excluded properties

* format

* make propertyCorrelations not null

* ensure excluded property names config is unique

* rename excludeProperty to excludePropertyFromProject

* update var names

* change to targetProperties

* remove null special casing

* update to filter client side on exclude from project clicked

* update test name to reflect new functionality

* fix tests
2021-11-02 11:12:13 +00:00
Michael Matloka
8a52b27b12
Unify new correlation icons (#6773) 2021-11-02 10:03:19 +00:00
Neil Kakkar
3e205225e9
Fixes for Correlation UI: pagination & persons modal (#6767)
* Fixes for Correlation  UI: pagination & persons modal
2021-11-02 09:54:44 +00:00
Neil Kakkar
8477c1d962
Only load correlations for Funnels (#6765)
* Only load correlations for Funnels
2021-11-01 15:20:23 +00:00
Neil Kakkar
08251918f5
Some more polishing & restore property selector semantics (#6748)
* restore property selector semantics

* fix tests

* add another test
2021-11-01 10:52:04 +00:00
Alex Gyujin Kim
2ce78dcf30
Split out v1 and v2 of sessionsPlayLogic to fix bugs in prod (#6727)
Co-authored-by: Rick Marron <rcmarron@gmail.com>
2021-10-29 18:20:55 +00:00
Paolo D'Amico
9a4062e289
Instance preferences - disable feature upselling stub (#6706) 2021-10-29 11:45:22 -05:00
Michael Matloka
2d9ae8c192
Fix "Manage account" positioning (#6750) 2021-10-29 15:35:14 +00:00
Michael Matloka
137c699150
Add site popover on profile picture to fresh top bar (#6701)
* Keep top bar always visible

* Add `LemonPopover`

* Add empty account control sections

* Rename `AccountControl` to `SitePopover`

* Add basic Sign out button

* Add `LemonButton` and use it for sign out

* Scale down popover scaling

* Remove `LemonPopover` in favor of `Popup`

* Improve icons story

* Polish account info

* Add organizations to site popover

* Add `CreateOrganizationModal` to  `TopBar`

* Polish things

* Add PostHog status items

* Update FunnelTab.tsx

* Rename `InitialBlob` to `Lettermark`

* Update utils.test.ts

* Address feedback

* Handle long emails

* Update Cypress test for sentence case title
2021-10-29 16:36:08 +02:00
Eric Duong
5bef4185f0
make sure edge filters are used (#6723) 2021-10-28 20:53:19 +00:00
Eric Duong
18a22c0642
remove heigh check (#6718) 2021-10-28 16:19:36 -04:00
Alex Gyujin Kim
5d73df7090
Use separated session recording endpoints (#6641) 2021-10-28 19:40:20 +00:00
Neil Kakkar
5417ce2af4
Polish Correlation Analysis UI - Part 1 (#6716)
* things finally look amahzing

* update tests
2021-10-28 17:25:45 +01:00
Marius Andra
47892972a1
Saved insight fixes 2 (#6674)
* insights buttons padding right fix

* add icon column

* fix all types

* fix select icons

* improve display and empty states

* searching for a number gives a direct result

* more debouncing time to throttle typing in the searchfield

* 2 columns > 960px, 3 columns > 1580px

* more height for card view

* split options column

* add person icon

* added profile picture

* fix column sort

* add min-width to funnels to make them readable on tiny dashboards

* add "trends" as default type

* stop screaming

* fix api call
2021-10-28 18:05:44 +02:00
Michael Matloka
b0aa8f0c91
Migrate cohort-related logics to be project-based (#6683)
* Migrate cohort-related logics to be project-based

* Fix `cohortsDetail`

* Remove `teamId` param from `determineEndpoint` methods
2021-10-28 13:29:53 +02:00
Paolo D'Amico
e32db915f0
Improve correlation analysis feedback (#6705)
* improve the UI of the box

* fix tests

Co-authored-by: Neil Kakkar <neilkakkar@gmail.com>
2021-10-28 12:03:54 +01:00
Marius Andra
ea041ba49a
Persist view/edit for insight in URL + refactor insightLogic tests (#6708)
* refactor tests

* persist edit=true in edit mode
2021-10-28 12:36:52 +02:00
Karl-Aksel Puulmann
0e31bdc3e2
Refactor taxonomy selector/property naming (#6709)
* Rename groups => taxonomicGroups

Avoids confusion with group analytics down the line

* Rename groupTypes => taxonomicGroupTypes

This avoids confusion with groups
2021-10-28 12:18:55 +02:00
Harry Waye
28469b0e2d
chore(correlation): switch to exclude for property correlation (#6597)
* chore: fix typo in usePersonProperties

* refactor(property-select): introduce useSelectedPropertiesContext

This is largely just me copying from
https://react-hook-form.com/api/useformcontext but the intent is to
remove the requirement for introducing a Provider in simple cases.

I could I suppose use react-hook-form for some of this, but I'm using it
as a little bit of a learning exercise as well.

* feat(correlation): add exclude property button next to correlations

This is quick and dirty and still uses the include logic. I'll follow up
with something to make this into a specific exclude of properties, and
make it sticky.

* chore(correlation): switch to exclude for property correlation

* fix lint

* Fix serialization to localstorage

* once more

* refactor(correlation): update popup to use kea logic
This commit creates a new kea logic that is intended to be the logic for
the PropertyNamesSelect component. This commit however only implements
the popup aspect of the component as a logic, with the intention that
the search implementation and selection logic will be handled in a
follow-up commit.

Note that this implementation doesn't actually currently work and I'm
still debugging what is wrong.

* chore(correlation): remove manual typing from kea logic

* refactor(property-selection): use concise action definitions

This makes the logic more consistent with others in the codebase. As
mentioned in the docs:

https://keajs.org/docs/guide/concepts#actions

* refactor(property-select): move ref prop reference outside of logic

The logic shouldn't be referencing anything relevant to `React` (or
anything else specific to a particular view implementation)

* chore(property-select): fix typing issues

* chore(property-select): make reducers a little neater

* refactor(property-select): move logic to separate file

This is to highlight that we should not have any React dependencies in
the logic. We still encapsulate the React specifics as the `usePopup`
hook.

* chore(property-select): make listeners functional

* wip: move selection into property names select logic as well

* refactor(property-select): complete select logic migration

This gets the tests passing again with logics!

* refactor(property-select): remove usePersonProperties

* fix typing

* remove unused import

* refactor: remove custom hooks and context

* wip

* add excludeProperty action, isSelect value

* chore: get storybook funnel working again

* refactor: move property search into logic

* refactor: rename popup actions/values/selectors/listeners

* chore: fix typing

* refactor: use kea-localstorage to persist excluded property names

* rename isSelected funnel logic selector to isPropertyExcluded

* chore: simplify storybook for `PropertyNamesSelect`

* avoid specifying key on propertynamesselect

* ensure excludeProperty triggers refresh

* button with a B

* use values in loadpropertycorrelations

* remove localstorage, fix action call on refresh

* chore: rename PropertyNamesSelectLogic to propertyNamesSelectLogic

* test(correlations): add tests for property exclusions

* chore: fix load correlations on loadResultsSuccess

* add initial select logic tests

* rename logic filename to lower

* feat: remove exclude properties select box

I'm removing this as we have the "Exclude Property" button which should
give us what we want for now wrt excluding properties to reveal more
relevant correlations past the first few ones.

* restrict changes to just the Exclude property button

* Revert "restrict changes to just the Exclude property button"

This reverts commit cd35674489.

* Revert "feat: remove exclude properties select box"

This reverts commit 5b2e6202fb.

Co-authored-by: Neil Kakkar <neilkakkar@gmail.com>
2021-10-28 11:02:33 +01:00
Michael Matloka
20d52a5d36
Fix addFilter edge case (#6702) 2021-10-27 23:43:46 +02:00
Rick Marron
09a8548675
quick fix (#6703) 2021-10-27 21:19:53 +00:00
Marius Andra
8abe7bc14f
Take posthog-js from the props to the toolbar (#6699)
* take posthog-js from the props to the toolbar

* fix test

* fix typing

Co-authored-by: Rick Marron <rcmarron@gmail.com>
2021-10-27 20:51:10 +00:00
Paolo D'Amico
8515fee744
Duplicate filters on insights (#6677) 2021-10-27 08:53:46 -07:00
Marius Andra
bf83d24e6b
Move toast to bottom of screen (#6687) 2021-10-27 08:11:47 -07:00
Harry Waye
31c242f2c3
feat(correlation): ability to exclude property correlations for events (#6665) 2021-10-27 15:36:09 +01:00
Harry Waye
e99ffae525
feat: remove exclude properties select box from funnel correlation, add exclude property button (#6694)
* chore: fix typo in usePersonProperties

* refactor(property-select): introduce useSelectedPropertiesContext

This is largely just me copying from
https://react-hook-form.com/api/useformcontext but the intent is to
remove the requirement for introducing a Provider in simple cases.

I could I suppose use react-hook-form for some of this, but I'm using it
as a little bit of a learning exercise as well.

* feat(correlation): add exclude property button next to correlations

This is quick and dirty and still uses the include logic. I'll follow up
with something to make this into a specific exclude of properties, and
make it sticky.

* chore(correlation): switch to exclude for property correlation

* fix lint

* Fix serialization to localstorage

* once more

* refactor(correlation): update popup to use kea logic
This commit creates a new kea logic that is intended to be the logic for
the PropertyNamesSelect component. This commit however only implements
the popup aspect of the component as a logic, with the intention that
the search implementation and selection logic will be handled in a
follow-up commit.

Note that this implementation doesn't actually currently work and I'm
still debugging what is wrong.

* chore(correlation): remove manual typing from kea logic

* refactor(property-selection): use concise action definitions

This makes the logic more consistent with others in the codebase. As
mentioned in the docs:

https://keajs.org/docs/guide/concepts#actions

* refactor(property-select): move ref prop reference outside of logic

The logic shouldn't be referencing anything relevant to `React` (or
anything else specific to a particular view implementation)

* chore(property-select): fix typing issues

* chore(property-select): make reducers a little neater

* refactor(property-select): move logic to separate file

This is to highlight that we should not have any React dependencies in
the logic. We still encapsulate the React specifics as the `usePopup`
hook.

* chore(property-select): make listeners functional

* wip: move selection into property names select logic as well

* refactor(property-select): complete select logic migration

This gets the tests passing again with logics!

* refactor(property-select): remove usePersonProperties

* fix typing

* remove unused import

* refactor: remove custom hooks and context

* wip

* add excludeProperty action, isSelect value

* chore: get storybook funnel working again

* refactor: move property search into logic

* refactor: rename popup actions/values/selectors/listeners

* chore: fix typing

* refactor: use kea-localstorage to persist excluded property names

* rename isSelected funnel logic selector to isPropertyExcluded

* chore: simplify storybook for `PropertyNamesSelect`

* avoid specifying key on propertynamesselect

* ensure excludeProperty triggers refresh

* button with a B

* use values in loadpropertycorrelations

* remove localstorage, fix action call on refresh

* chore: rename PropertyNamesSelectLogic to propertyNamesSelectLogic

* test(correlations): add tests for property exclusions

* chore: fix load correlations on loadResultsSuccess

* add initial select logic tests

* rename logic filename to lower

* feat: remove exclude properties select box

I'm removing this as we have the "Exclude Property" button which should
give us what we want for now wrt excluding properties to reveal more
relevant correlations past the first few ones.

* restrict changes to just the Exclude property button

Co-authored-by: Neil Kakkar <neilkakkar@gmail.com>
2021-10-27 14:09:19 +00:00
Paolo D'Amico
d3dd258b40
UX improvements to insights (#6675) 2021-10-27 05:05:30 -07:00
Neil Kakkar
dd21686bdb
Convert to logic and write tests (#6689) 2021-10-27 11:33:04 +00:00
Tim Glaser
8908753a06
Allow wildcard app urls (#6660)
* Allow wildcard app urls

* typing
2021-10-27 13:22:21 +02:00
Michael Matloka
c039c95be4
Fix Cohort component importing raw AntD CSS (#6685) 2021-10-27 08:02:06 +00:00
Michael Matloka
88c6623b7c
Fresh top bar base (#6657)
* Add base header with logo, search, account icon, and announcement

* Rearrange code, add logic, and add announcement X button

* Add help button to top bar and create a story

* Make the top bar logo a link to posthog.com

* Only display help button caret in new top bar

* Fix help button position a bit
2021-10-27 09:14:58 +02:00
Michael Matloka
62cee334af
Fix missing space in funnel persons modal (#6682) 2021-10-27 08:48:06 +02:00
Sam Winslow
3c6a678b62
Fix whitescreen on PersonsModal: add nullish coercion for empty string 2021-10-27 01:44:28 +00:00
Marius Andra
d7ddf06da1
Saved insight fixes 1 (#6661)
* remove "view" button on dashboard

* prevent insight card views from opening in a new window

* create a storybook for all icons

* add funnel icons and improve new insight menu

* remove debug

* add insights sessions icon

* link without a link is a button

* fix icons in select box
2021-10-27 00:07:16 +02:00
Paolo D'Amico
f3222d2643
UX revamp for split/merge persons (#6544) 2021-10-26 14:27:00 -07:00
Paolo D'Amico
6efbd5adaf
Clarify unique users vs. total count (#6648) 2021-10-26 13:49:46 -07:00
Marius Andra
f76d0b6521
Turbo mode (#6632)
* fix router redirect

* remove dependence on user var

* split scenes and sceneTypes out of sceneLogic

* rename LoadedScene type to SceneExport

* export SceneExport from most scenes

* use exported scene objects, warn if not exported

* fix type import bugs

* remove dashboard

* keep all loaded scene logics in memory

* fix sorting bugs

* support scenes with params, make it work with dashboards

* fetch result from dashboard if mounted

* fix mutations

* add lastTouch

* refactor scene parameters to include searchParams and hashParams

* add insights scene to scene router

* add insight router scene to scene router

* fix cohort back/forward bug

* this works

* bring back delayed loading of scenes

* set insight from dashboard also in afterMount

* split events, actions, event stats and properties stats into their own scenes

* refactor to options object for setInsight

* override filters

* clean filters for comparison

* fix cohort bug

* get a better feature flag

* make turbo mode faster by making non-turbo-mode slower

* less noise in failed tests

* fix tests

* flyby: add jest tests pycharm launcher

* clean up scenes

* add test for loading from dashboardLogic

* fix bug

* split test init code into two

* have the same data in the context and in the api

* add basic tests for sceneLogic

* run the latest and greatest

* fix menu highlight

* implement screaming snake

* only show scenes with logics
2021-10-26 20:08:45 +00:00
Eric Duong
df583d528b
6331 pie chart persons bug (#6642)
* backend fixes and test

* add breakdown value to pie chart

* adjust test

* fix faulty test

* fill param

* fix formula tests

* more date passing

* more cleanup

* all tests working

* make test data explicit and add better checks

* support both ee and postgres

* length checks
2021-10-26 14:53:34 -04:00
Michael Matloka
a4cc81e321
Add new api composition approach (#6612)
* Instrument legacy endpoint debugging

* Add `currentTeamId` to `teamLogic`

* Add logics utils

* Update annotations endpoint in the frontend

* Limit legacy endpoint logging to DEBUG

* Fix `annotationsTableLogic` usage

* Update test_annotation.py

* Add `test_deleting_annotation_of_other_team_prevented`

* Comment out debug code

* Migrate actions-related code to project-based approach

* Fix `infiniteTestLogic`

* Rework approach

* Remove redundant lines

* Fix mixup

* Fix non-logged-in scenes

* Fix Python cast

* Align approach to `teamLogic`-based

* Fix logic tests

* Clean up code

* Fix stupid omission

* Restore `props` in `connect`s

* Fix capitalization

* Fix action creation

* Fix `ActionEdit` props type

* Fix duplicate imports

* Update infiniteListLogic.ts

* Update ActionsTable.tsx

* Fix link to new action in Toolbar

* Add new `api` composition approach

* Use feedback

* Add premade compositions

* Fix `createActionFromEvent` tests

* Fix code structure

* Fix typing

* Update api.ts
2021-10-26 16:01:32 +00:00
Neil Kakkar
efdde1c0a2
Instrumentation for feedback with emojis (#6484)
* WIP: Instrumentation for feedback

* update feedback form & cleanup

* use const
2021-10-26 16:33:11 +01:00
Li Yi Yu
758d322e5f
Update paths dashboard items (#6459)
* coloring updates

* set a min width for paths canvas

* account for steps less than 3
2021-10-26 08:50:58 -04:00
Michael Matloka
f134778336
Fix clicking in command palette (#6653) 2021-10-26 12:55:12 +02:00
Alex Gyujin Kim
1d8a3ef2ed
Better seekbar for session recordings (#6529)
* rename sessionRecording to session-recording

* logic for new player

* move rrweb-player into repo

* remove awkward wrapper and fix time not updating bug

* chunk load meta timing

* fix duration setting bug

* update icons and styling for controller

* styling icons

* slider styling

* ugly slider

* remove consoles

* sonarqube

* typescript

* typescript

* implement working seekbar

* fix time mismatches

* remove hardcode

* Fix icon from merge

* move report usage back to sessionsplaylogic

* refactor to seekbar

* implement real time seek time

* play on paused fixed

* bug with play pause

* fix buffer play state bug

* add comments back

* remove consoles and revert limit

* remove empty file

* address feedback

* fix scrubbing issue and onclick lag

* remove console

Co-authored-by: Rick Marron <rcmarron@gmail.com>
2021-10-25 19:00:16 +00:00
Neil Kakkar
aee58efc64
Enable support for Autocapture events in correlations - UI (#6635) 2021-10-25 15:57:53 +00:00
Tim Glaser
ee35d18d9f
Remove papercups widget (#6415)
* Remove papercups widget

* remove unused import

* helper button in the nav bar

* post-merge fix

* extra fixes & improvements

Co-authored-by: Paolo D'Amico <paolodamico@users.noreply.github.com>
2021-10-25 16:50:11 +02:00
Michael Matloka
d5d497f11f
Migrate dashboard-related logics to be project-based (#6623)
* Migrate dashboard-related logics to be project-based

* Update test_personal_api_keys.py

* Update dashboard.py

* Update test_dashboard.py

* Make mypy happy
2021-10-25 16:16:55 +02:00
Michael Matloka
d307429732
Fix teamId usage in pluginsLogsLogic (#6634) 2021-10-25 14:15:41 +00:00
Neil Kakkar
6ab4b2673a
Backend support for autocapture elements chain in Correlations (#6627)
* Backend support for autocapture elements chain properties

* address some comments
2021-10-25 13:21:57 +01:00
Marcus Hyett (PostHog)
a2b582db73
Tweak lifecycle tooltip copy (#6404)
* Update InsightsNav.tsx

Tweaked lifecycle tooltip copy

* Update InsightsNav.tsx

Pushed last two words to new line to fix prettier issue.

* prettier format InsightsNav.tsx

Co-authored-by: Harry Waye <harry@microwayes.net>
2021-10-25 11:05:12 +00:00
Michael Matloka
53a58c9d2c
Rename DashboardItem model to Insight and deprecate DashboardItem{Serializer,ViewSet} (#6567)
* Only run `test_migrations_are_null` on new migrations

* Rename `DashboardItem` to `SavedInsight`

* Add explanation to `test_migrations_are_null` script

* Rename `test_dashboard` to `test_saved_insight_model`

* Ditch `DashboardItem{ViewSet,Serializer}` altogether

* Fix refresh via `InsightSerializer`

* "SavedInsight" to just "Insight"

* Update file names

* Update insight.py

* Update dashboardLogic.test.ts

* Update migration

Co-authored-by: Paolo D'Amico <paolodamico@users.noreply.github.com>
2021-10-25 09:12:37 +02:00
Michael Matloka
165ffcaffb
Migrate event-related logics to be project-based (#6566)
* Instrument legacy endpoint debugging

* Add `currentTeamId` to `teamLogic`

* Add logics utils

* Update annotations endpoint in the frontend

* Limit legacy endpoint logging to DEBUG

* Fix `annotationsTableLogic` usage

* Update test_annotation.py

* Add `test_deleting_annotation_of_other_team_prevented`

* Comment out debug code

* Migrate actions-related code to project-based approach

* Fix `infiniteTestLogic`

* Rework approach

* Remove redundant lines

* Fix mixup

* Fix non-logged-in scenes

* Fix Python cast

* Align approach to `teamLogic`-based

* Fix logic tests

* Clean up code

* Fix stupid omission

* Restore `props` in `connect`s

* Fix capitalization

* Fix action creation

* Fix `ActionEdit` props type

* Migrate events-related code to project-based approach

* Remove `MOCK_ORGANIZATION_ID`

* Update sessionsPlayLogic.test.ts

* Fix logic tests

* Fix duplicate imports

* Reduce duplication in URL test instrumentation

* Update API interception paths in tests

* Fix `Person.cy-spec.js`

* Add comments in `posthog/api/__init__.py`

* reduce test noise

* Update infiniteListLogic.ts

* Simplify `teamLogic` seeding

* Simplify `teamLogic` seeding better

* Fix `organizationLogic` tests

* Migrate feature flags-related logics to be project-based (#6603)

* Migrate feature flags-related logics to be project-based

* Add comment

* Migrate insight-related logics to be project-based (#6574)

* Migrate insight-related logics to be project-based

* Migrate over the rest and fix logic tests

* Update funnelLogic.ts

* Fix URL formatting in tests

* Update dashboardLogic.tsx

* Remove now redundant `initTeamLogic`

* Add tracking comments

Co-authored-by: Marius Andra <marius.andra@gmail.com>
2021-10-22 18:32:58 +02:00
Eric Duong
1f143d109e
Path cleaning integration (#6488)
* initial refactoring

* popup UI

* refactor path cleaning logic

* add nullable

* all ui working

* fix migration

* use regex replacement from team object

* add flag

* add switch

* fix type

* fix type

* UI update

* restore removed arg

* add local path cleaning filters to api

* add test for local path filters

* working new UI

* reduced repeated code

* fix numbering

* minor refactoring

* update copy

* add under advanced features

* address comments, minor cleanup

Co-authored-by: Neil Kakkar <neilkakkar@gmail.com>
2021-10-22 11:51:45 -04:00
Tim Glaser
b48adcaa99
Try localStorage+cookie as persistence type (#6540) 2021-10-22 11:49:42 -04:00
Michael Matloka
8ca4c26c4e
Migrate action-related and some insight-related logics to be project-based (#6464)
* Instrument legacy endpoint debugging

* Add `currentTeamId` to `teamLogic`

* Add logics utils

* Update annotations endpoint in the frontend

* Limit legacy endpoint logging to DEBUG

* Fix `annotationsTableLogic` usage

* Update test_annotation.py

* Add `test_deleting_annotation_of_other_team_prevented`

* Comment out debug code

* Migrate actions-related code to project-based approach

* Fix `infiniteTestLogic`

* Rework approach

* Remove redundant lines

* Fix mixup

* Fix non-logged-in scenes

* Fix Python cast

* Align approach to `teamLogic`-based

* Fix logic tests

* Clean up code

* Fix stupid omission

* Restore `props` in `connect`s

* Fix capitalization

* Fix action creation

* Fix `ActionEdit` props type

* Fix duplicate imports

* Update infiniteListLogic.ts

* Update ActionsTable.tsx

* Fix link to new action in Toolbar
2021-10-22 15:42:11 +02:00
Neil Kakkar
d92ca6ee44
Enable persons modal for properties correlation (#6611)
* Enable persons modal for properties correlation

* adjust header

* fix typings
2021-10-22 14:37:17 +01:00
Neil Kakkar
6f7c116fb1
Fix 'Load more People' (#6609) 2021-10-22 13:45:46 +01:00
Marius Andra
b720da94ab
Saved insights filter & url sync (#6388)
* saved insights url sync WIP

* sync filters with the url

* improve trend and date filters

* convert utils test to typescript

* create simple object shallow diff function

* only persist the difference from the default filters in the url

* add tests and simplify operations

* improve tests

* better load checking
2021-10-22 11:53:40 +02:00
Rick Marron
3f8eaeb843
Fix error in recordings table (#6598)
* fix

* Make person header seem more click-able

* clean up
2021-10-21 18:58:28 +00:00
Jaspreet singh
10a4a6a662
Closes 6541 add step to empty funnel (#6556)
* Closes 6541 add step to empty funnel

* added comments back

* hide delete button when single step exists

* use values directly in first step

* Update frontend/src/scenes/insights/ActionFilter/ActionFilterRow/ActionFilterRow.tsx

Co-authored-by: Neil Kakkar <neilkakkar@gmail.com>
2021-10-21 16:44:32 +00:00
Neil Kakkar
716e8f1943
Open modals for everything in correlation events (#6592)
* Open modals for everything in correlation events

* address comment
2021-10-21 14:57:27 +00:00
Paul D'Ambra
9e552d51e4
Search toolbar actions (#6587)
* add search to toolbar actions display for #6202

* better markup and spacing

* removes a console.log that snuck in
2021-10-21 10:37:14 +02:00
Harry Waye
e4939b767e
chore(eslint): explicitly disable exhaustive deps on historical code (#6576)
I haven't made any attept here to resolve anything here, just to
explicitly acknowledge that these are issues that eslint has highlighted
and we should ignore, for the sake of easily picking up new issues. If
these are truely problematic, then I am assuming they should have been
picked up as bugs with the system.

This doesn't stop someone from coming in and reviewing the code in this
pr retrospectively.
2021-10-21 09:35:34 +01:00
Eric Duong
6160d0c30e
add properties to path cleanfilters (#6554) 2021-10-21 10:29:01 +02:00
Paul D'Ambra
a957f0abb0
adds a search box to the toolbar featureflag list (#6527)
* adds a search box to the toolbar featureflag list

* test flakes because react is re-rendering between the get and the click. add an assertion to try and slow cypress down to avoid this

* move filtering toolbar feature flags to a Set and out of CSS

* support initKeaTestLogic() with no args

* fix query-selector-all-deep jest bug

* add simple test case for feature flags logic

* combine selectors

* with more understanding of Fuse

* add simple test for flag filtering

Co-authored-by: Marius Andra <marius.andra@gmail.com>
2021-10-20 22:02:02 +00:00
Marius Andra
f84b447fce
Include the insight ID in the url for "saved funnels" (#6531) 2021-10-20 14:17:40 -07:00
Paolo D'Amico
4fd848d4d3
Debug queries (#6577) 2021-10-20 14:17:30 -07:00
Michael Matloka
4a7d0b7a7e
Use app context in organizationLogic too (#6565)
* Use app context in `organizationLogic` too

* Add `organizationLogic.test.ts`
2021-10-20 18:46:58 +02:00
Harry Waye
01873b1780
feat(correlation): add multiselect for property names (#6407)
* refactor(taxonomic-filter): add api mock functions

* chore: remove makeApi from storybook preview.js

* feat(correlation): add multiselect for property names

Previously we had a simple text input box that was splitting the input
to get a list of property names. This doesn't give the greatest user
experience.

Now we have a simple select box that includes:

 1. search filtering for options
 2. multiselecting options
 3. a select $all, although this is pretty poorly implemented at the
    moment, for instance you can select $all, at the same time as
    selecting a subset of properties.

* add a little commentary around PropertyNamesSelect

* add deps to useEffect

* ignore return type eslint issues

* just use console.log instead of actions

* remove unused import

* chore: add error condition

* chore(correlation): update styling of property select

This puts it more in line with
https://www.figma.com/file/gQBj9YnNgD8YW4nBwCVLZf/PostHog-App?node-id=4200%3A30715

* Add no search results message

* input focus border

* fix type

* use onBlur

* make checkbox checked colour change

* make query bold in no results message

* add clear

* Implement search highlighting

* fix typing

* add regex split comment

* if no property names selected, default to $all

* typo

* Add test for selection component

* Add test highlighting onChange lag and clicking outside

* click out side should depend on hide

* make sure onChange triggered on clear or select all
2021-10-20 14:12:32 +00:00
Paolo D'Amico
b326eba355
Hide conversion rate on trends (#6561) 2021-10-20 11:37:57 +01:00
Paul D'Ambra
1cb0ba2bbd
Simplified UI for breakdown properties (#6557)
* wip implementation of grey pills for breakdown properties

* cohort pills need coercing differently to line up with the close icon

* which allows removal of some markup

* much better layout and matching behaviour

* resolve type errors in trends tab

* resolve type errors on funnels tab

* remove console.logs
2021-10-20 09:48:42 +01:00
Alex Gyujin Kim
ba33121d33
Move rrweb player into repo (#6505)
* rename sessionRecording to session-recording

* logic for new player

* move rrweb-player into repo

* remove awkward wrapper and fix time not updating bug

* chunk load meta timing

* fix duration setting bug

* update icons and styling for controller

* styling icons

* slider styling

* ugly slider

* remove consoles

* sonarqube

* typescript

* typescript

* remove hardcode

* Fix icon from merge

* move report usage back to sessionsplaylogic

* add comments back

* bug fix

Co-authored-by: Rick Marron <rcmarron@gmail.com>
2021-10-19 21:33:43 -07:00
Michael Matloka
9b54eb7c41
Pilot migration for logics to be project-based (#6430)
* Instrument legacy endpoint debugging

* Add `currentTeamId` to `teamLogic`

* Add logics utils

* Update annotations endpoint in the frontend

* Limit legacy endpoint logging to DEBUG

* Fix `annotationsTableLogic` usage

* Update test_annotation.py

* Add `test_deleting_annotation_of_other_team_prevented`

* Comment out debug code

* Rework approach

* Remove redundant lines

* Fix mixup

* Fix non-logged-in scenes

* Fix Python cast
2021-10-20 04:55:39 +02:00
Paul D'Ambra
f472b163e2
adds a feature flag constant for #938 (#6555) 2021-10-19 16:32:30 +00:00
Yuvaraj J
f34bd5551f
Allow duplicating dashboard (#6476)
* Closes #1688 Allow dashboards to be duplicated in the backend

* Allow dashboards to be duplicated in the frontend

* Remove unused method

* Filter existing dashboard along with team id

* Add title attributes to actions in dashboard listing page
2021-10-19 18:10:27 +02:00
Neil Kakkar
8edd14a16a
Create a very basic property correlations over event table (#6549)
* Create basic nested tables for correlation properties results

* use correct API responses

* clean up

* fix typing

* try 2
2021-10-19 16:20:11 +01:00
Yakko Majuri
500cf5bc7f
export from the beginning -> export historical events (#6542) 2021-10-19 12:55:19 +00:00
Tim Glaser
6be8918c12
fix cohort static select (#6519)
* fix cohort static select

* Remove unused button
2021-10-19 14:27:33 +02:00
Paul D'Ambra
23cf2e9280
Remove expensive person header logic allocation (#6532)
* remove expensive person header logic allocation

* rename the person header test
2021-10-19 10:23:18 +00:00
Paolo D'Amico
c587fa922d
Correlation - Skew banner (#6511)
* fix override on debug

* new skew warning
2021-10-19 09:12:28 +02:00
Alex Gyujin Kim
192c2e293c
time conversion zero (#6521) 2021-10-19 09:04:51 +02:00
Michael Matloka
faa1323960
Proposed cleanup of events table column configurator (#6523)
* Proposed cleanup of events table column configurator

* Fix modal footer spacing
2021-10-18 21:44:55 +02:00
Paolo D'Amico
ff74653af2
No history on saved insights (#6510) 2021-10-18 20:15:28 +03:00
Michael Matloka
23195788e4
Improve wording of ErrorProjectUnavailable (#6516) 2021-10-18 17:26:00 +02:00
Paul D'Ambra
7f4fa88fa0
corrects a sentence (#6515) 2021-10-18 16:03:16 +01:00
Marius Andra
470090b865
Fix "current usage" padding (#6501) 2021-10-18 11:39:30 +02:00
Marius Andra
40cbfddf27
Dashboard initial load in batches of 4 (#6494)
* add doNotLoad to insights on dashboards that come without results

* load dashboard items without results in sequence

* fix test

* don't use the visibility map if it's empty (no keys)

* Update frontend/src/scenes/dashboard/dashboardLogic.tsx

Co-authored-by: Paolo D'Amico <paolodamico@users.noreply.github.com>

* work with both dashboards and saved insight card views

Co-authored-by: Paolo D'Amico <paolodamico@users.noreply.github.com>
2021-10-18 07:44:55 +00:00
Paolo D'Amico
45f954548b
Available features selector (#6506)
* hasAvailableFeature selector

* use selector everywhere
2021-10-18 07:43:03 +00:00
Paolo D'Amico
4248d52800
Paths pay gate (#6463)
* create new advanced feature

* remove all advanced features

* pay card basic

* dismiss pay gate

* pay card story component

* address feedback

* restricted paths step too
2021-10-18 09:17:54 +02:00
Paolo D'Amico
39ff3abab2
Persisted flags for 1.29.0 (#6401) 2021-10-18 02:32:20 +03:00
Paolo D'Amico
faa6377a57
Login minor UI fixes (#6472)
* fix spacing issue in signup page

* fix spacing with SSO links

* uncomment temp code
2021-10-15 22:11:16 +00:00
Michael Matloka
4477c81f1f
Optimize dashboardsModel a tiny bit (#6455)
* Optimize `dashboardsModel` a tiny bit

* Fix typing

* Make sorting more reliable

* Use more correct `dashboardModel` selectors, with better names

* Fix value name

* Fix and simplify `nextDashboard`

* Rename selectors
2021-10-16 00:07:45 +02:00
Alex Gyujin Kim
70653001f8
New component for new sessions player (#6486)
* new ff for new sessions player

* put into session recordings folder

* add kea typing
2021-10-15 12:39:24 -07:00
Paolo D'Amico
4b7ea0f5cc
Fix password reset (#6466)
* fix render issue on email

* fix redirection after password change

* fix test
2021-10-15 15:58:54 +02:00
Marius Andra
85aa9f3b74
Fix Cypress component tests (#6461)
* fix component tests

* disable sessions test

* add console errors into cypress output
2021-10-15 12:47:06 +02:00
Marius Andra
296647fa10
Override filters if bad api result (#6470)
* dispatch loadResultsFailure if failed to load

* add tests for API failures

* don't mount dashboards model if it's not mounted
2021-10-15 12:45:52 +02:00
Marius Andra
3a9db09a5f
Fix dashboard and saved insight reload (#6456)
* reload insights on dashboards, clean up utils

* refresh items

* fix test

* test reloading with a fixed list

* show "0 out of N" where N is 1 or all

* add comment re: custom reload logic
2021-10-15 08:53:09 +00:00
Marius Andra
2b571d0c8e
Fix event table re-render loop if person == null (#6460)
* fix person == null re-render loop

* fix test
2021-10-15 10:21:12 +02:00
Paolo D'Amico
20b0f9704a
Forgot password UI (#6177) 2021-10-15 10:40:31 +03:00
Paolo D'Amico
68f79ba04a
Release 5720-plugins-ui-jobs (#6438) 2021-10-15 10:17:55 +03:00
Paolo D'Amico
b0309c2390
Release 4871-plugin-metrics FF (#6437) 2021-10-15 10:17:49 +03:00
Marius Andra
3d3a6594c6
Hotfix for from_dashboard filter bug (#6450)
* hotfix for from_dashboard filter bug

* catch if totally empty

* fix feedback

* improve error
2021-10-15 09:16:48 +02:00
Eric Duong
2fbe638f40
Dashboard item: Only pass object id when deleting dashboard item (#6447)
* only pass object id

* add loadresults

* add tests that validate loadResults exists on insight logics for dashboard item refresh

* add name to payload

* remove refresh fix
2021-10-15 09:10:30 +02:00
Paul D'Ambra
35efae5615
treat minutely and hourly graphs differently when rendering annotations (#6448)
Co-authored-by: Marius Andra <marius.andra@gmail.com>
2021-10-15 08:56:57 +02:00
Paolo D'Amico
7e56333c56
Password reset - API (#6335)
Co-authored-by: Michael Matloka <dev@twixes.com>
2021-10-15 09:33:03 +03:00
Michael Matloka
f5b2f36f29
Fix duplicated action name error message (#6454)
* Fix import of `urls` in `ActionEdit`

* Fix duplicated action name error message
2021-10-15 08:18:15 +02:00
Rick Marron
a5405b7a65
check for new values before setting filters (#6457) 2021-10-14 23:09:52 -07:00
Alex Gyujin Kim
074d633c53
Make Sessions Recording faster!! (#6270)
* paginate session recording events api

* code quality

* don't rerender replayer every time events get loaded

* refactor session recordings, make it backwards compatible, add bunch of tests

* move limit and offset to after decompress

* change limit

* add caching of recording

* add duration

* fix a few tests

* fix api tests

* add partial chunk test

* fix default limit test

* code quality

* typing

* fix backend tests

* mypy fixes and signature

* remove circular dependency

* mypy and sessionsplaylogic tests

* fix migration

* make single migration

* revert mypy typing

* remove require react resolve

* fix loading state to persist across multi chunks and add test'

* cleanup

* duration to ms

* fix duration tests

* remove require react resolve

* fix test

* bump rrweb player

* change cache behavior plus more

* fix frontend tests and make duration calculation more robust

* fix timestamp in ms bug in tests

* fix duration 0 test

* fix compatibility with rrweb-player

* update lockfile

* yarn unlink

* resolve kea-test-utils changes

* another one

* remove caching for now (leave as todo) and change limit to 100
2021-10-15 02:41:47 +00:00
Sam Winslow
40e76ac91c
breakdown by feature/key (#6453) 2021-10-15 00:51:40 +02:00
Michael Matloka
e04234447d
Move the rest of the events scene to TypeScript (#6452)
* Move the rest of the events scene to TypeScript

* Polish typing up
2021-10-14 23:07:10 +02:00
Paul D'Ambra
44fbbfa0b8
Configurable table columns (#6308)
* remove unused prop from the eventTableLogic

* WIP commit to allow task switching

* tidies up feature flag and updates table config button to latest design

* make tablewidth calculation explicit but leave it in the wrong place

* don't allow undefined as a possible logic to test for

* give a better name to the thing that shows and hides the modal

* remove unused input to table config

* better mobile view for events table column choosing

* fix a leftover setstate to setmodalvisible

* moved table config logic out of events table logic

* push more from events table into tableconfig

* push more from events table into table config

* fix things these changes broke

* keep pushing things down

* keep pushing things down

* rename refactoring

* stores and reads table column config to and from the URL

defaults to user columns when they are stored but gives no mechanism to store new columns

* allow saving column config to the user

* Add advice on why you would save visible columns

* be less vague with the name of the tableconfig component

* Revert "be less vague with the name of the tableconfig component"

This reverts commit fb3fac2ce271fc737688ca19eae5c27d6b902719.

* update the visible columns when saving to the user

* from interface to props

* only need to get a reference to connected logics after mount, not to call initkea on them

* remove kea listener anti=pattern

* make showing and hiding modal more kea idiomatic, and remove use of ability to store column selection on the server *without removing that functionality*

* safer update of selected columns from URL

* don't render a column when the tableconfig isn't enabled

* improves styling of the table config list

* change ok text of table config model

* even closer to the design

* adds a tooltip to the locked columns in the table config modal

* scope blue text to the column configurator modal

* deprcate the events_column_config column

* less likely for long table rows using propertykey to display oddly

* move column configurator state into the tableconfig logic

* fix test that was written as a describe and didn't fail the suite

* move two setup calls into a useEffect block to avoid thinking about order of setup

* split the tableconfig to simplify its jobs by context and remove setState from the column configurator

* tableconfig no longer needs props

* fix import

Co-authored-by: Marius Andra <marius.andra@gmail.com>
2021-10-14 21:04:01 +00:00
Paolo D'Amico
86b93049eb
Override persisted flags completely (#6442)
* Fully override persisted flags

* fix

Co-authored-by: Marius Andra <marius.andra@gmail.com>
2021-10-14 20:52:34 +00:00
Marius Andra
72da684f8a
extract kea-test-utils (#6425) 2021-10-14 17:17:42 +00:00
Karl-Aksel Puulmann
fa9d8cacdc
Sort dashboards alphabetically in dropdown (#6441)
Closes https://github.com/PostHog/posthog/issues/6434

Turns out we sort, but also include information on pinned/not pinned
which is not visible in the modal
2021-10-14 20:14:39 +03:00
Eric Duong
e7b7c18ded
make sure to remove shown_as when switching to trends from stickiness (#6443) 2021-10-14 16:26:23 +00:00
Paolo D'Amico
9041e919b2
Remove Home page experiment (#6410)
* remove FF

* remove home page
2021-10-14 08:25:50 -07:00
Michael Matloka
77621366de
Fix remaining TypeScript errors (#6436)
* Fix remaining TS errors and remove `.ts-strict-blacklist`

* Move `IGNORED_SPECS` to top
2021-10-14 15:08:42 +00:00
Marius Andra
d1caefb606
Refetch insight if id changes (#6368)
* refetch insight if id changes

* current project also ingested event

* upgrade kea and loaders

* do not load if sceneLogic is not mounted

* add test for url sync

* don't load results from the API if none in the insight

* avoid extra queries

* avoid loading the results twice

* update kea-loaders to get payload in async actions
2021-10-14 14:58:17 +00:00
Marius Andra
fc66fc953e
remove all dashboard animations in view mode (#6426) 2021-10-14 15:51:27 +01:00
Marius Andra
7d47c5ef36
Feature flag toolbar link (#6369)
* have apiURL without the `/`

* link to flag in posthog

* add bold external link icon

* add external link icon to the end of the row

* import from urls.ts
2021-10-14 13:01:36 +02:00
Paul D'Ambra
63d8af06b6
allow annotations when comparing with previous (#6424) 2021-10-14 12:56:27 +02:00
Paul D'Ambra
ffa8aa98db
Better display of Feature flags table with long key and description (#6408)
* wrap feature flag key and description in a typography text block so that it copes with very long values better

* wrap feature flag key and description in a typography text block so that it copes with very long values better

* add manual word-breaks in long feature flag keys

* just a bit less

Co-authored-by: Marius Andra <marius.andra@gmail.com>
2021-10-14 11:02:52 +02:00
Marius Andra
6b5eaedd64
fix hash in test (#6423) 2021-10-14 08:44:37 +00:00
Paul D'Ambra
3a899e5743
Show user hash in events table for identified users with only distinct ids (#6403)
* wip

* moves processing of personheaders out of the react component and into a logic

* generates personheader key and persondisplay when props change

* change personheader so the generated HTML better matches previous state for anonymous people

* remove console logging that shouldn't have been included

* add props to the name of the props

* add props to the name of the props

* don't guard against having no props

* hash the person header key

* inline two methods
2021-10-14 10:26:59 +02:00
Paolo D'Amico
378ff2efc3
Release ingestion help button (#6411)
* remove ingestion help button

* and feature flag
2021-10-13 14:56:15 -07:00
Rick Marron
853f71f731
remove session recording retention from self-hosted clickhouse (#6417) 2021-10-13 13:38:10 -07:00
Li Yi Yu
dc39a90f2f
remove ingestion taxonomy feature flag (#6412) 2021-10-13 16:20:54 -04:00
Eric Duong
e75a433b90
instrumentation: track which filters change (#6342)
* instrument changes

* don't send more info if filters don't change

* use selectors with previousState to get the last filters

* return previous state and track deeper changes with entities

* typos

* remove unneeded

* move function

* tests

* add logic test

Co-authored-by: Marius Andra <marius.andra@gmail.com>
2021-10-13 09:57:17 -04:00
Michael Matloka
ec0f7ef880
Add slug field to Organization (#6395)
* Add `slug` fields to `Organization` and `Team`

* Expose slugs to user

* Add slug autogeneration for new orgs/projects

* Improve slug UX

* Remove slug from settings

* Update org/team instance creation plus add tests

* Only require project slug to be unique for org, not globally

* Fix `get_prep_value`

* Test organization slugification

* Deslugify `Team`

* Clean up changes

* Update test_user.py

* Apply suggestions from code review

Co-authored-by: Paolo D'Amico <paolodamico@users.noreply.github.com>

* Random 4 letter suffixes for the win

* Fix import

* Ignore `test_migrations_are_null`

* Fix `RunSQL` query being empty

* Fix `generate_random_short_suffix` testing

Co-authored-by: Paolo D'Amico <paolodamico@users.noreply.github.com>
2021-10-13 14:09:40 +02:00
Neil Kakkar
2aa9b92f37
Add Sigma Analysis to funnel table (#6385)
* Add sigma analysis features

* update null results to ensure we are always in window

* forgot to push new test file
2021-10-13 13:02:52 +01:00
Harry Waye
b5b1ccb1de
chore(taxonomic-filter): add storybook story (#6398) 2021-10-13 11:22:14 +01:00
Harry Waye
88262c0e05
chore(correlation): funnel story with correlation events and properties (#6389)
* chore(correlation): funnel story with correlation events and properties

This commit:

 1. adds msw so we can easily mock the API requests
 2. starts msw on storybook page load
 3. adds the `mockServiceWorker.js` to storybook public folder so it can
    be loaded by the frontend
 4. adds a Funnel story that defines the funnel and correlation
    responses

Note that we also define types for requests and responses. These could
be shared with the actual application code, so we can explicitly couple
the application changes to updating storybooks, i.e. to help avoid
stories going stale.

The requests and responses are quite basic, but they are sufficient to
be able to easily see and make changes. It has a requirement that it
should be easy for anyone else who comes to the code to easily parse and
be able to make updates. We don't want these to be rotten stories but
*the place* that people go to first when making their changes.

Having simple handwritten request/responses also introduces the
stability needed to, for example, use regression tests. Changes are
deliberate.

* refactor(storybook): move funnel stories to their own file

This also does quite a bit of cleaning up of the storybook and funnel
story code. Trying to come down on an acceptable way to manage the
sample data.

* dev(storybook): specify public dir when building storybook

I'm hoping this means that chromatic will function properly 🙏

* chore: add back the withApi decorator

* setup msw first

* dev(storybook): Make posthogjs work in chromatic

* dont use as cast for response types

* make hot module reload work
2021-10-13 04:45:51 +00:00
Li Yi Yu
80d90a7385
Fix white screening from paths filter exclusion dropdown (#6390)
* fix white screening from filter exclusion paths

* account for multiple values in the array oops
2021-10-12 13:41:22 -04:00
Marius Andra
f7ae840178
rename "Explore" to "New Insight" (#6387) 2021-10-12 16:30:11 +02:00
Harry Waye
3e9322843f
feat(correlation): add warning when funnel skewed (#6365)
* feat(correlation): add warning when funnel skewed

This actual just uses the funnel numbers rather than the correlation
endpoint as this gives us a little more freedom to, for instance, add
details of why we think there might be inaccurate results, without
having to update the definition in the backend as well.

And alternative option might be to introduce an error code along with a
human readable message that includes the details of skew reasoning,
returned from the API, but I think this gives us what we want.

* Create FunnelCorrelation.tsx, add useMemo

* don't add a logic for funnel correlation

I tried to add one, but got caught in typing issues. I'm not sure adding
isSkewed warrants one tbh

* Move isSkewed to funnelLogic
2021-10-12 13:05:17 +01:00
Marius Andra
b19a6be9a8
Split 'urls' out of 'sceneLogic.ts' (#6381) 2021-10-12 12:11:39 +02:00
Marius Andra
da8e70a15d
loadResults doesn't only load funnel results, bail if so (#6367) 2021-10-12 09:35:14 +03:00
Rick Marron
5b582b314f
Recording filters are stored in URL (#6370)
* fix loading state

* store session recording filters in URL
2021-10-12 08:08:25 +02:00
Michael Matloka
d867472409
Remove PROJECT_BASED_PERMISSIONING feature flag (#6366) 2021-10-12 07:44:01 +03:00
Li Yi Yu
c0d7f1e17d
Paths Viz: horizontal scroll, path card item display on link hover, adding typing (#6323)
* allow for horizontal scrolling on paths viz

* wip

* add axis lines

* move more paths util functions over

* do not shorten urls without parameters

* show hidden path cards on link hover

* convert file to typescript

* small fixes and prettier

* es lint fixes

* more typing fixes

* typing

* final fix
2021-10-11 20:30:25 -04:00
Rick Marron
63d127df13
Filter session recordings (#6162)
* fix bug where session recording is split by new distinct_id

* fix query bug to allow distinct_id clause

* Basic query filtering by events on clickhouse

* add duration filtering

* Add multiple action/event filters

* Move to using person_id + optimize query

* add postgres support and querying on person_id

* move back to distinct_ids

* remove lots of duplicated logic

* Add pagination to backend

* Pagination

* Add duration and date filter

* Use person header is list view

* type fixes

* bug fix

* bugs and tests

* test fixes

* style filters

* logic tests

* Add another test for team leakage

* fix flaky test

* UX changes

* UX tweaks

* auto focus filter box on open

* add test for recording viewed change

* move duration filter to using a tested logic

* move to clsx

* add debounce breakpoint

* Small style change

* fix debounce

* fix breakpoint

* move test to defaultAPIMocks (merging changes)

* react to url change
2021-10-11 13:15:05 -07:00
Marius Andra
eda638a3b4
Insight logic refactor version 2 - unified filters (#6327)
* kea test "toNotHaveDispatchedActions"

* fix dashboard logic test

* add props and key to insight logic (has no effect)

* inform about is_sample's uniqueness

* use common InsightLogicProps

* persist state via BindLogic and shared insightProps

* persist hashParams

* remove cached Urls

* upgrade new to saved logic

* upgrade typegen

* patch metadata logic

* always show title if saved insights active

* fix negative bug

* fix interval filter

* go to view mode after saving

* full reload when going from dashboard to insight

* use clean filter

* createInsight is no longer used

* fix tests

* fix setAllFilters

* clean retention table duplicate code, fix test

* scene has its own key

* unify insightLogicProps key logic

* consolidate logic fetching

* fix test

* fix reloads

* clears the scene funnel

* move setInsight to reducer

* stronger clicks on menu items

* rename setAllFilters to setFilters, add tests to make sure insight logics use it to sync filters

* fix retention type filter key

* easier printActions

* add failing tests

* unified and broken cleanFilters

* refactor funnel filter cleaning, fix initial event setting,

* fix type

* revert setFilters override, fix filter function

* untangle FunnelStepReference

* move setFilters away from trendsLogic

* fix various type errors

* set filteres inside insightLogic

* set funnel state via insightLogic

* more random changes

* trends working with results in insightLogic

* remove setCachedResults

* move loadResults into insightLogic

* fix trendlogic test

* fetch insight if no fetched data

* fix metrics chart

* fix insight update logic

* consolidate tests

* only load results if needed

* various fixes

* remove wait

* remove activeView

* merge results after updating filters

* don't switch to view mode after saving insight

* don't override results

* misc undefined fixes

* move props down

* cleaner code

* consolidate API mocks

* fix funnel test

* persist some filters when changing tabs

* connect last badly connected funnelLogic

* fetch results if none returned with insight

* show only the right results

* fix paths selector

* match filters and results

* cleanFilters resets fields if switching tabs

* change type insight display if changing tabs

* don't show data if loaded a different type of insight, reload if switching to funnels

* clean filters for history view

* fix trends visibility map

* reset funnel type to VIZ

* fix funnel min height issue on scene
2021-10-11 16:26:15 +02:00
Harry Waye
6bc3a80dca
fix(correlation): property success/failure should update property correlation type (#6336) 2021-10-11 09:52:04 +00:00
Marius Andra
098aa91fa4
Revert #4206 - Test Environment toggle (#6250)
Co-authored-by: Paolo D'Amico <paolodamico@users.noreply.github.com>
2021-10-11 10:28:07 +03:00
Paolo D'Amico
fc9fad76e0
Recordings tweaks (#6322)
Co-authored-by: Rick Marron <rcmarron@gmail.com>
2021-10-11 09:17:44 +03:00
Karl-Aksel Puulmann
4acae13312
No more unneeded scroll bars (#6326) 2021-10-09 10:30:44 +02:00
Eric Duong
b9927713ee
fix refreshing, fix insightLogic props passing, fix funnel bar leakover (#6340) 2021-10-08 14:14:29 -04:00
Harry Waye
eb4082241f
feat(correlation): add property correlation to funnels UI (#6328) 2021-10-08 16:31:02 +03:00
Marius Andra
00633412cc
Insight logic refactor version 1 - keyed insightLogic (#6310)
* kea test "toNotHaveDispatchedActions"

* fix dashboard logic test

* add props and key to insight logic (has no effect)

* inform about is_sample's uniqueness

* use common InsightLogicProps

* persist state via BindLogic and shared insightProps

* persist hashParams

* remove cached Urls

* upgrade new to saved logic

* upgrade typegen

* patch metadata logic

* always show title if saved insights active

* fix negative bug

* fix interval filter

* go to view mode after saving

* full reload when going from dashboard to insight

* use clean filter

* createInsight is no longer used

* fix tests

* fix setAllFilters

* clean retention table duplicate code, fix test

* scene has its own key

* unify insightLogicProps key logic

* consolidate logic fetching

* fix test

* fix reloads

* clears the scene funnel

* move setInsight to reducer

* stronger clicks on menu items

* remove wait

* clarify testcases
2021-10-08 12:13:23 +00:00
Li Yi Yu
cd5e164d91
Paths highlighting for path start and end (#6297)
* node highlighting for path start and end

* rename for clarity

* check for funnel paths between steps

* clean up renderPaths function

* move tooltip placement

* forgot to commit util file
2021-10-07 20:22:54 -04:00
Eric Duong
cdfab3d821
paths: Default params funnel and prompt (#6317)
* add pageview and cusotm events as default types

* add prompt
2021-10-07 18:11:18 -04:00
Neil Kakkar
e062d5113f
add CH guard to Correlation API Calls (#6315) 2021-10-07 19:00:48 +01:00
Alex Gyujin Kim
970e2892b0
Remove saved funnels (#6313)
* follow up on todo

* ff
2021-10-07 09:55:54 -07:00
Marius Andra
f2c9c522bf
Remove scrollbar (#6304)
* remove scrollbar

* revert list height to 32px
2021-10-07 08:21:10 +00:00
Marcus Hyett (PostHog)
3520b553a4
Colon in Dashboard Name Search (#6291)
* Added colon in Go To dashboard search

* Moved colon to correct place
2021-10-07 09:44:14 +02:00
Michael Matloka
96760e0096
Reduce direct usage of user.team (#6206)
* Reduce direct usage of `user.team`

* Add missing `.id`

* Remove unused `type: ignore`s

* Fix typing issue

* Remove selector circular dependency between `userLogic` and `teamLogic`

* Try to simplify things to fix circular dependency

* Remove extraneous typing
2021-10-07 09:33:37 +02:00
Paul D'Ambra
73de6cd9fd
Adds a hot key keypress detection method that isn't flummoxed by the shadow DOM (#6249)
* adds a detection method that isn't flummoxed by the shadow dom

* guard against not having a result for path from older browsers

* guard against the event target returned by composePath not being an html element

* composePath is the standard, check it first
2021-10-07 09:12:49 +02:00
Paolo D'Amico
9d4287c1c4
Clarify copy on data point click (#6255) 2021-10-07 08:08:27 +03:00
Alex Gyujin Kim
04045ff466
Add default count_operator thats already selected on changing match type (#6295) 2021-10-06 13:55:19 -07:00
Neil Kakkar
d4a1151c49
Path Wildcards in Taxonomic Filter (#6205)
* Path Wildcards in Taxonomic Filter

* better handling

* ADD LOGIC TEST
2021-10-06 16:06:52 -04:00
Li Yi Yu
cb3b394633
Paths related UI fixes (#6257)
* paths related UI fixes

* add tooltip for long urls

* more fixes

* show cards on hover for smaller paths

* styling and font fixes

* increase font weight

* clean up code

* highlight start and end paths on hover

* undo path start end highlight

* add logic for highlighting all sources

* add centering and move constant

* restore number to normal

Co-authored-by: eric <eeoneric@gmail.com>
2021-10-06 15:37:04 -04:00
Neil Kakkar
750116101a
fix (#6290) 2021-10-06 11:57:53 -04:00
Paul D'Ambra
ad17f9c7be
add a clearer loading state on the events table and start in loading state (#6256)
closes #6192
2021-10-06 15:34:01 +01:00
Neil Kakkar
7bfeb9d1b9
Add basic model for Correlation analysis on Funnels behind FF (#6258)
* Add basic model for Correlation analysis on Funnels behind FF

* make frontend ready for testing

* address comments

* prettier
2021-10-06 13:14:32 +01:00
Eric Duong
b5ed0b7221
paths: funnel-path date alignment and funnel path persons (#6236)
* make sure funnel and path dates are always aligned and add api handling for funnel filter persons

* use post instead of GET for paths

* parse label

* change type

* use post in test

* fix types

* test both get and post
2021-10-05 14:10:27 -04:00
Marcus Hyett (PostHog)
ad4a1aca0a
Linking to GH issue in Cloud Announcement (#6251)
* Parse issue link from cloud announcement
* Add link to button in announcement banner
2021-10-05 15:34:07 +01:00
Paolo D'Amico
2eafad2ba7
Recordings watched & analyzed instrumentation (#6220) 2021-10-05 15:26:58 +03:00
Alex Gyujin Kim
c2a1f30a56
Make saved insights meta fields editable in-line (#6159)
* refactor insight metadata into separate reusable components

* create insightMetdataLogic

* added editable states to fields

* description add suffix to input

* fix functional bugs with input values

* remove consoles

* testing for insightMetadataLogic

* revert Insight

* revert Insight

* make editable in view mode

* test for update path
2021-10-05 12:56:34 +02:00
Paul D'Ambra
2af4622c09
Injects a logger during posthog init which sends an exception to Sentry when there is an XHR error (#6182)
* adds Sentry to the window object to facilitate logging for PostHog/posthog-js#290

* inject xhr error behaviour rather than injecting Sentry - depends on PostHog/posthog-js#296

* Add expected type to onXHRError function

* more safely add Sentry to posthog config

* update setting on xhr error config to correct exported config type

* enrich sentry error after testing
2021-10-04 14:52:41 -07:00
Paolo D'Amico
3419204d16
Fix dashboards loading error (#6229)
* Fix dashboards loading error

* fix typing

* adds tests to prove new change fixes issue

Co-authored-by: Paul D'Ambra <paul.dambra@gmail.com>
2021-10-04 14:47:14 -07:00
Paul D'Ambra
aa0ab19c5b
choose either count or aggregated value when sorting the insights table so that it doesn't matter if clickhouse or postgres returns the value (#6232) 2021-10-04 13:55:52 -07:00
Alex Gyujin Kim
7c68e1d154
fix input collapse and non default value (#6238) 2021-10-04 20:16:30 +00:00
Li Yi Yu
1043fb3d4c
Paths to funnels (#6215)
* paths to funnels

* account for pageview events and urls

* prettier

* sankey left is too cluttered/confusing
2021-10-04 15:15:39 -04:00
Eric Duong
4c13ef9a53
add extra handling if prop changes (#6207) 2021-10-04 13:38:08 -04:00
Eric Duong
e3806f55b8
change styling (#6209) 2021-10-04 09:34:14 -04:00
Li Yi Yu
66c3a23eae
fix http strip (#6204) 2021-10-01 11:11:03 -04:00
Neil Kakkar
c59a8c3a3c
Basic PersonModal for dropoff and completed paths (#6179)
* basic modal for dropoff and completed paths

* use right link for completed calculation

* fix calculations

* update Modal text

* cleanup

* rerun prettier
2021-10-01 15:39:45 +01:00
Michael Matloka
4ae063d0e6
Add project-nested version of all project-dependent endpoints (#6203)
* Add project-nested version of all project-dependent endpoints

* Fix hook `perform_create`

* Adjust `plugin-configs` to adhere to style of other endpoints
2021-10-01 13:38:33 +02:00
Li Yi Yu
3c033686db
Update paths dropdown options (#6200)
* update paths dropdown options and avoid merge issues

* minor adjustments

Co-authored-by: Neil Kakkar <neilkakkar@gmail.com>
2021-10-01 10:40:42 +00:00
Paolo D'Amico
19106cef2c
Signup UI Oct 2021 (#6136) 2021-10-01 07:26:19 +01:00
Sam Winslow
30a314b646
Fix tooltip on Formulas (#6199) 2021-10-01 04:52:23 +00:00
Alex Gyujin Kim
076bd43a88
More tests + Rename Modal state refactor (#6158)
* add a bunch of tests for logics and utils

* change comment

* addressed refactor comments

* hide renameFilter in logic, add util test
2021-09-30 17:17:41 -07:00
Eric Duong
5c453e206e
paths: Funnel to path dropoff connection (#6198)
* ui

* dropoff ui
2021-09-30 14:29:00 -04:00
Eric Duong
83eca7f227
paths & funnels: Funnel to path connection (#6160)
* restore progress

* working connection no UI visual

* working for events

* edit endpoint to start point

* working with close button

* funnel to path work (no dropoff yet)

* run prettier

* make suggested adjustmenst
2021-09-30 11:20:38 -04:00
Eric Duong
2bafa204f8
display value (#6161) 2021-09-30 10:14:47 -04:00
Michael Matloka
3a67367ac7
Project-based permissioning TopNavigation (#6027)
* 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

* Restore `TopNavigation` changes

This reverts commit 05fd9e4ed6.

* Try to add a story for `TopNavigation`

* minor clarifications

* Revert `TopNavigation` changes

* Restore `TopNavigation` changes

* Make new access control entirely project-based

* Update migrations

* Add `project_based_permissioning` to `TeamBasicSerializer`

* Update test_team.py

* Fix `isRestricted` in `ProjectRow`

* Disable project creation for non-admins

* Make project icon in top nav itself dynamic as well

* Fix story

* Delete 0169_project_based_permissioning.py

* Apply suggestions from code review

Co-authored-by: Paolo D'Amico <paolodamico@users.noreply.github.com>

* Update frontend/src/layout/navigation/TopNavigation.tsx

Co-authored-by: Paolo D'Amico <paolodamico@users.noreply.github.com>

* Address feedback

* Project-based permissioning full data access restrictions (#6068)

* Fix Access Control restriction tooltip

* Add `TeamMemberAccessPermission` and use it in viewsets

* Add `ErrorProjectUnavailable` scene

* Ignore mypy

* Update MainNavigation.tsx

* Update explicit_team_member.py

* Fix frontend detection of unavailable project

* Fix some tests and edge cases

* Fix basic permissions

* Add more tests

* Simplify `ExplicitTeamMemberViewSet` permissions

* Improve restrictions and add moar tests

* Update frontend

* Fix a couple of things

* Fix import

* Fix some edge cases

* Fix typing errors

* Use hedgehog instead of moth

Co-authored-by: Paolo D'Amico <paolodamico@users.noreply.github.com>

* Address feedback

* Add proper permissioning to dashboard views

* Update ee/api/test/test_dashboard.py

Co-authored-by: Paolo D'Amico <paolodamico@users.noreply.github.com>

Co-authored-by: Paolo D'Amico <paolodamico@users.noreply.github.com>

* Run prettier

* Remove debug code

Co-authored-by: Paolo D'Amico <paolodamico@users.noreply.github.com>
2021-09-29 22:43:40 +00:00
Neil Kakkar
9cbece70fd
Some Paths fixes (#6175) 2021-09-29 12:44:30 -04:00
Neil Kakkar
26f7848b15
Add advanced options behind FF for Paths (#6173) 2021-09-29 16:57:19 +01:00
Guido Iaquinti
f4e47abb09
Bump prettier and eslint-config-prettier versions (#6167)
* Bump 'prettier' and 'eslint-config-prettier' version

* Run 'yarn prettier' with the new bumped version
2021-09-29 11:49:29 +01:00
Yakko Majuri
0171732226
Add feature flag based cloud announcements (#6155) 2021-09-29 10:04:38 +00:00
Alex Gyujin Kim
77d3d66754
Various funnel breakdown fixes (#6133)
* some copy

* minor styling improvements

* remove console

* fix shady typing
2021-09-28 13:12:30 -07:00
Rick Marron
a0775d7fae
Replace sessions with session recordings (#6050)
* Move Sessions tab -> Session Recording (behind feature flag)

Note: the /scenes/sessionRecordings folder is a copy of /scenes/sessions. Planning to remove sessions from the new SessionRecordings folder over the next coupld of commits

* Add very basic session recording page

* Add session recordings to persons page and session recs can play

* add endpoints for clickhouse

* fix ordering in existing tests

* add basic test to pg and clickhouse

* small bug fix

* type fix

* add test for data leaking between teams

* fix navigation bugs

* Fix name of logic

* Add basic logic tests

* fix tests

* fix laoding state bug

* revert changes to existing session queries

* move to proper queries for session recordings

* type fixes

* rename feature flag

* type fix

* Fix capitalization

* remove showSessions and clean up ifs

* Style changes and refactor SessionPlayerDrawer

* bug fix

* move to using query params

* remove type from persons logic

* Move sessionRecordingTableLogic key to distinctId

* rename setSessionRecordingId to openSessionPlayer

* improve tests

* Cleanup from review

* move team and limit to parameters
2021-09-28 11:18:38 -07:00
Li Yi Yu
6284b645b0
New paths tab querybuilder UI (#5825)
* new path tab querybuilder

* prettier

* clean up

* wip

* format querybuidler

* prepare path type filter component

* dropdown

* formatted popup

* change button for endpoints

* styling the type buttons

* logic for all left side querybuilder components

* exclusion UI and logic

* improve exclusion handling, ensure API calls are made

* API fixes for event types

* fix popup on close issue with exclusions

* hide overflow on buttons

* all ui working

* more formatting adjustments

* type fixes

* leave response ambiguous

* feature flagging and adjust styles

* Add Step limit option

* add tooltip to wildcards

* rewrite tooltip for exclusions

* make Events toggle responsive

* fix types

* responsive at xl instead of lg for no overlaps

* Proof of concept of connecting Funnel to Paths

* protecc wip

* Connect Funnels to Paths

* remove funnel button for now

* remove unused

Co-authored-by: eric <eeoneric@gmail.com>
Co-authored-by: Neil Kakkar <neilkakkar@gmail.com>
2021-09-28 12:53:03 -04:00
Paul D'Ambra
a089562d53
fixes display of events in the storybook (#6154)
PR #6079 broke the display of events in the storybook for the events scene
2021-09-28 17:36:37 +01:00
Alex Gyujin Kim
3f786b8c77
move bin_count into filters source of truth (#6126) 2021-09-28 08:00:02 -07:00
Li Yi Yu
858750deab
New paths UI sankey card (#6066)
* add box labels to paths

* path item cards wip

* add dropdown options

* add percentages

* fix dropdown appearance

* update percentages and remove text hover

* fix color and border

* path hover highlighting

* remove dropdown hover

* feature flag the paths ui graph

* change how ff works and add zindex on hover

Co-authored-by: eric <eeoneric@gmail.com>
2021-09-28 10:50:09 -04:00
Paul D'Ambra
eb6a0732cb
patch the in memory history passed into storybook
so that it doesn't matter if it is window.history or react-router history (closes #6138)
2021-09-28 14:15:54 +00:00
Paul D'Ambra
bc4f77220b
fixes test that checks if empty filters are not used on the events table view (#6137) 2021-09-28 09:29:06 +02:00
Paul D'Ambra
c6ece9a5d1
Converts the EventTableLogic to TS and adds tests (#6079)
* begins converting eventsTableLogic from js to ts and adding logic tests

still *very much* a work in progress

* more tests and types

* more tests and types (add structure to help track that only reducers are covered by tests so far)

* more tests and types

* add injectable hisotry to the logic test runner and test urlToAction

* kea router is cleverer and more accessible than I realised

* add tests and implementation to read and store event filter from/to the URL

* slightly clearer error output when toDispatchActions times out waiting

* even more slightly clearer error output when toDispatchActions times out waiting

* even more slightly clearer error output when toDispatchActions times out waiting

* no TS errors in the eventsTableLogic and its tests

* very few ts errors

* eventsTableLogic converted to ts

* change eventtype interface to ensure eventToName in utils works

* defaulting to an array containing an empty object for properties seems to break a cypress test for person

* no point having a test for a case that is so practically impossible

* declaring properties on EventType as Record<string, unknown> cascaded dealing with the unknown into files that are out of scope of this PR

* switch cypress test to check for equally valid empty properties value of [{}]

* removes unused action property from EventType

* removes unnecessary cast

* make the properties type even more explicit

* make the properties type even more explicit

* Revert "make the properties type even more explicit"

This reverts commit 7c4f5aed9a.

* Revert "make the properties type even more explicit"

This reverts commit 26580e62d7.

* resolve the bug that meant an empty array in the URL for properties stopped the page loading

* rename a short variable

* allow types to propogate in eventstable logic

* allow types to propogate in eventstable logic

* allow highlighted events to be cleared by the action of the page, no need to clear them on poll success

* update cypress test for new expected default properties value

* moves dayjs extension setup into the initkea block

* use an existing function

Co-authored-by: Paul D'Ambra <paul@posthog.com>
Co-authored-by: Marius Andra <marius.andra@gmail.com>
2021-09-28 06:37:30 +00:00
Alex Gyujin Kim
9315a0d76a
make date filter read only on view mode (#6129) 2021-09-27 21:11:49 -07:00
Tim Glaser
4e47a6ddeb
fix if window doesn't exist (#6132)
* fix if window doesn't exist

* Test posthog on window
2021-09-27 23:26:27 +02:00
Alex Gyujin Kim
40d60bcc12
Renaming Filters (#6063)
* add custom_name to model

* added testing and functionality

* add custom_name to entity model

* get new entity info working on legends, tables, and other contexts

* fix test and add custom name to funnel

* fix more tests

* finish up funnel edge cases

* remaining broken tests

* update action in logic test

* remove consoles

* autofocus

* fix a few bugs
2021-09-27 10:54:53 -07:00
Paolo D'Amico
6b8d0de031
Login UI revamp (#6076) 2021-09-27 20:04:51 +03:00
Michael Matloka
7fa218bcf8
Add cohort description backend (#6089)
* Add cohort description backend

* Increase `Cohort.description` limit

* Require `DASHBOARD_COLLABORATION` for cohort description box to be shown
2021-09-27 11:57:13 +00:00
Marius Andra
83452a57bf
Fix dashboards again (#6080)
* split trends types into their own file

* add test to make sure trendsLogic gets the right cached items

* not needed unless we're on a dashboard

* this would be false most of the time

* update filters directly when you set cached results

* move costly operation one level up, as get_result() is called many times

* reload dashboard item model if cache was busted

* verify more parts of trendsLogic

* refresh last_refresh from API

* remove debugger

* fix TS errors

* refactor visibilityMap

* move toggleLifecycle to reducer and fix mutation bug

* add a warning for how ActionsLineGraph uses this prop

* add fromDashboardId because dashboardId is used to control the key

* create combined funnel api response type

* compact printActions

* set filters on cache change

* test result and cached item loading works as intended

* remove print

* rename DashboardItemLogicProps -> SharedInsightLogicProps

* cleaner indexedResults

Co-authored-by: Alex Kim <alexgkim205@gmail.com>
2021-09-24 18:30:04 +00:00
Rick Marron
b2f58dc59e
Handle case where feature flag variants is undefined (#6104) 2021-09-24 19:19:45 +02:00
Alex Gyujin Kim
5a6cd56c7d
Saved insights 🐛 fixes (#6056)
* Cleanup Insights.tsx (#6037)

* refactors a bunch of stuff out of Insights.tsx into a separate component

* use view map

* make funnels full width (#6039)

* Add CTA empty state to saved insights page (#6042)

* add cta for empty saved insights table

* refactor

* Add descriptive headers to Saved Insights View/Edit/Create modes (#6045)

* add header to insight graphs and styling

* remove console

* Use radio instead of buttons (#6048)

* Split person asynchronously (#5992)

* docs(events): add documentation on index on posthog_event.distinct_id (#5973)

* use displaymaps in saved insights (#6047)

* add loading state and fix person modal not showing bug

Co-authored-by: Tim Glaser <tim@posthog.com>
Co-authored-by: Harry Waye <harry@scalexp.com>
2021-09-23 23:20:12 +02:00
Michael Matloka
c3d3e3d3aa
Uppercase AM and PM (#6088) 2021-09-23 15:15:23 +00:00
Michael Matloka
bb27c9c499
Add sort by value at date to details table (#6087) 2021-09-23 15:03:14 +00:00
Marius Andra
0583310a29
Export 10k lines in CSV, allow limit= query param (#5959)
* Export 10k lines in CSV, allow limit= query param

* this should be min

* fix test var

* add limit support to postgres, make tests to check all cases

* update tooltip to say 10k events

* fix 10k event text again
2021-09-23 08:52:53 +00:00
Marius Andra
03d989bcee
New logic test utils + dashboard item reload test (#6072)
* 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.

* create jest truth function

* basic dashboard logic test

* basic reload test

* add "toDispatchActionsInAnyOrder"

* improve dashboard logic test with toDispatchActionsInAnyOrder

* fix types
2021-09-23 09:41:14 +02:00
Alex Gyujin Kim
e6cce8131a
Header label styling for all trend graphs + tab switching bug (#6074) 2021-09-23 08:11:51 +03:00
Michael Matloka
1e50704d76 Fix support for style prop in ProfilePicture 2021-09-23 01:44:17 +02:00
Michael Matloka
eb6db7c075
Project-based permissioning members addition + removal (#6028)
* 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>
2021-09-22 17:32:35 +00:00
Michael Matloka
bc3e223265
Project-based permissioning framework (#5976)
* 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

* 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

* adjust copy & UI a bit

* Address feedback on field comment

* "Privacy settings" to "Access Control"

* Ignore mypy

* Rename `Team` field `project_based_permissioning` to `access_control`

* Update migrations

Co-authored-by: Paolo D'Amico <paolodamico@users.noreply.github.com>
2021-09-22 18:29:59 +02:00
Paul D'Ambra
a2308ebc2a
Allows users to choose whether the events page automatically loads new events (#6033)
* 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>
2021-09-22 10:39:18 +00:00
Paolo D'Amico
6511e4e465
Type and font updates (#6020) 2021-09-22 08:47:52 +03:00
Alex Gyujin Kim
d51f7e9599
fix hidden map, naming, and nits (#6061) 2021-09-22 07:16:25 +02:00
Marius Andra
208517983f
Reload 4 dashboard items at a time (#5875)
* 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
2021-09-22 05:08:00 +00:00
Alex Gyujin Kim
ad293d16e7
show tooltips (#6059) 2021-09-21 19:26:32 +02:00
Yakko Majuri
4a3b089c6d
dont identify users as null (#6057) 2021-09-21 19:19:24 +02:00
Alex Gyujin Kim
662c2be31a
Remove steps parameter in time conversion result (#6046)
* remove steps parameter in time conversion result

* fix tests

Co-authored-by: Marius Andra <marius.andra@gmail.com>
2021-09-21 15:23:32 +02:00
Marius Andra
9577e94ac0
Fix eventUsageLogic.ts error if properties is an object (#5940)
* fix error if properties is an object

* simplify
2021-09-21 12:33:00 +00:00
Alex Gyujin Kim
7a0c3dd147
Vertical funnel breakdowns (#5733)
* 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>
2021-09-21 14:08:29 +02:00
Marius Andra
e13d8e9b6b
Action step empty field ==> null (#5942)
* save null for empty action steps

* save null for empty action steps in toolbar

* simplify

* fix type

* reset existing empty action step fields
2021-09-21 14:04:17 +02:00
Marius Andra
ef70592603
Usable logic tests (works now!) (#5990)
* 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
2021-09-21 13:39:05 +02:00
Tim Glaser
3f6d9799f8
Split person asynchronously (#5992) 2021-09-20 22:39:47 +02:00
Neil Kakkar
d6e410b3a9
Remove Autocapture functionality from Paths (#5895)
Co-authored-by: eric <eeoneric@gmail.com>
2021-09-20 15:10:50 +00:00
Yakko Majuri
72880538ef
fix bug with undefined date on plugin jobs UI (#6029) 2021-09-20 11:45:42 +00:00
Yakko Majuri
501a75c168
Allow date as a job payload option (#5996)
* allow datepicker as a job payload option

* accept dates for export from the beginning
2021-09-20 09:32:08 +00:00
Michael Matloka
a7a490dbdb
Refactor organization members component (#6015)
* Import change from per-project access branch

* Refactor organization members component

* Add a comment describing `getReasonForAccessLevelChangeProhibition`
2021-09-17 21:10:38 +00:00
Kunal
e09e2e9532
add alpha tag to mv test, make CTAs more obvious (#6004)
Co-authored-by: kunal <kunal@Kunals-iMac.hsd1.ca.comcast.net>
2021-09-17 12:09:38 -07:00
Marius Andra
54b33624a4
remove unused var (#6018) 2021-09-17 18:58:24 +00:00
Li Yi Yu
3f9a6bf357
Saved insights creation flow (#5702)
* 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
2021-09-17 14:36:18 +02:00
Alex Gyujin Kim
e85fde3921
Split out funnel apis and fix histogram paint order bug (#6002)
* 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>
2021-09-17 09:36:15 +00:00
Marius Andra
9aa06a8b95
reset new events when changing events page filter (#5957) 2021-09-17 11:33:52 +02:00
Alex Gyujin Kim
9062001960
Unordered funnel quirks (#6000)
* switch out icons and add checks

* spelling is hard
2021-09-16 14:46:50 -07:00
Marius Andra
c42af0fee7
Fix colors if insights table is sorted (#5991) 2021-09-16 15:26:42 +02:00
Michael Matloka
9098856b69
Make organization members lookup UUID-based + remove pagination (#5971)
* Make organization members lookup UUID-based + remove pagination

* Remove deprecated `OrganizationMemberSerializer` fields

* Remove deprecated fields more

* Remove `membership_id`

* Bring pagination back
2021-09-16 15:15:49 +02:00
Sam Winslow
929fe43a87
adjust CSS selector (#5970) 2021-09-16 13:35:02 +02:00
Yakko Majuri
2f7aa20f2b
minor wording changes to plugin jobs interface (#5985) 2021-09-16 09:31:04 +00:00
Marius Andra
a529b97223
fix userFlags type if response is error (#5984) 2021-09-16 10:36:11 +02:00
Rick Marron
6c3c6e3e77
Add warning for locally set feature flags (#5982)
* add warning for local feature flags

* remove need for refresh

* type fixes
2021-09-16 10:22:55 +02:00
Tim Glaser
0779881027
Split persons (#5898)
* Split people with multiple distinct ids

* when merging get correct distinct_ids immediately

* fix type errors

* fix e2e tests

* Add feature flag
2021-09-16 00:41:17 +02:00
Rick Marron
3832ec788b
Feature flags in the toolbar (#5866)
* very rough feature flags in the toolbar

* link to feature flag's posthog app url

* Update posthog-js to 1.13.0

* update sentry to fix TS error

* simplify type

* separately return original and overridden feature flags

* do not load properties that are not there, add one query for person get

* simpler variant setting

* add feature_flag_override column

* feature flag override in apis

* simplify v1 feature flag code

* /decide uses overridden flags from user

* toolbar fetch

* get more data from api for keys

* variants in toolbar

* z-index for select component

* fix flag state

* fix test errors

* nicer name for endpoint

* abstract feature flag overrides

* help mypy

* use feature flags in toolbar

* update feature flag toolbar button

* demo warning color demo

* update design

* override feature flags in the API

* improve types (thanks mypy!)

* remove unrelated code

* better comment

* fix test query count

* remove v2 in get_active_feature_flags_v2

* store `$feature/{key}` in properties

* Move feature flag overrides to their own model

* little bit of cleanup

* some type check + test cleanup

* respond to comments, add tests, add team permission checks

* add basic analytics

* move new endpoints

* Move to new endpoints + add "remove override" link

* add team to override model and simplify endpoints

* cleanup

* fix up instrumentation

* restrict a user to only their own overrides

* override query now works for all distinct ids

* typing fix

* fix tests

* update for new URL

* reload feature flags after change

* clean up UI

* sort flags by created date

* fix tests

* clean up

* update style and move logic to selectors

* clean up icons

* small ui changes

* Clean up

* remove defualt from override_value field

* first pass on new ui

* Move to new UI

* delete remnant migration from api work

* revert black formatting with bad config

* move button behind feature flag

* little bit of cleanup

* revert demo feature

* Make AnimatedCollapsible self-contained

* Remove unused styles

* Fix scroll bars

Co-authored-by: Marius Andra <marius.andra@gmail.com>
Co-authored-by: posthog-bot <posthog-bot@users.noreply.github.com>
2021-09-15 14:15:48 -07:00
Michael Matloka
b81c8fba46
Position toasts so that they don't obstruct top nav (#5950) 2021-09-15 21:11:25 +02:00
Sam Winslow
78027ca061
Remove is_sample "Configure" button from dashboard item (#5953)
* remove `is_sample` configure button from dashboard item

* remove css

Co-authored-by: Marius Andra <marius.andra@gmail.com>
2021-09-15 14:56:22 +00:00