0
0
mirror of https://github.com/PostHog/posthog.git synced 2024-11-28 09:16:49 +01:00
Commit Graph

669 Commits

Author SHA1 Message Date
Karl-Aksel Puulmann
e3bf0cb31d
Session recording on clickhouse, separate tables and retention cronjob (#2051)
* Add scheduled task to wipe session recordings

* Create a new table for session recording

* Save snapshot events to different table

* Use SessionRecordingEvent over Events everywhere

We can remove a ton of cruft this way as well

* Add missing signature

* Extract util from models/event

* Attempt to update ingest side of clickhouse session recording events

Note that it's using main kafka topic - not sure if a good idea.

* Get separate table in ch working for session recording events

* WIP: query sessions

* Make both session recording queries work

* Make linter happy

* Rebase migration

* Make tests work

* Apply a TTL to session recordings and other configuration:

- toYYYYMMDD partitioning should be smoother with TTL setup
- TTL achieves not needing to archive the data ourselves
- index_granularity will enable smaller reads per session_id
- ORDER BY clause is to make single session as well as time range query
  reasonable

* Convert retention cronjob to new model

* Add tests to process_event changes

* Add test for ee_capture change

* Fixup migration

* Make clickhouse tests drop/create session recording tables

* Make TTL not be there in tests

Otherwise writes get eaten by it during tests when mocking time

* Fix retention task

Co-authored-by: Tim Glaser <tim@glsr.nl>
2020-10-28 21:22:16 +01:00
Karl-Aksel Puulmann
c89717568b
Improved settings for session recording (#2066)
* Improve session recording setup

- Add beta flag
- Add CTA to open issue
- Always show for self-hosted users

* Make the icon a bit larger

Co-authored-by: Tim Glaser <tim@glsr.nl>
2020-10-28 18:25:28 +01:00
Paolo D'Amico
e6217f6484
Dashboard empty states (#2068) 2020-10-28 16:28:22 +00:00
Michael Matloka
ce1f1b5a3d
Put organization switcher under user (#2005) 2020-10-28 15:21:10 +01:00
Michael Matloka
57639b7222
Fix History button layout in Insights (#2065) 2020-10-28 12:42:12 +01:00
Paolo D'Amico
06d7671e3c
Dashboard templates & first default dashboard (#1942)
Co-authored-by: Ahti Kitsik <ak@ahtik.com>
2020-10-28 11:41:24 +00:00
Tim Glaser
e958bf90a3
Use uuids in funnels for consistency (#2036)
* Use uuids in funnels for consistency

* Fix type errors

* Fix tests
2020-10-27 13:01:09 +01:00
Marius Andra
3fe093f80b
Fix typescript errors #1 (#2027)
* add TSC check, fix tsconfig.json error

* fix toolbar ts errors

* fix the first 100 errors

* fix key bug

* fix some more types

* fix even more types

* webhook setting logic

* fix more logic types

* fix more logic types

* use billingSubscription from action payload
2020-10-27 09:57:06 +01:00
Marius Andra
034ba7eee0
Fix click outside spam & public paths (#2022)
* improve "public" import paths

* fix `useOutsideClickHandler` firing an event on any click anywhere in the page

Co-authored-by: Michael Matloka <dev@twixes.com>
2020-10-26 12:49:50 +01:00
Marius Andra
fccacd69a3
Add eslint rule for empty JSX elements (#2023)
* add rule for self closing components

* fix self closing tag errors
2020-10-26 11:45:57 +01:00
Michael Matloka
05ba148c17
Add ability to reset project API token (#2015)
* Add ability to reset project API token

* Add Popconfirm

* Disable option to set own api_token

* Fix element key

* Simplify text

* Slightly improve margin-left

* Improve /api/team detail view retrieval

* Add Never support to humanFriendlyDetailedTime

* Fix typing
2020-10-26 11:30:24 +01:00
Karl-Aksel Puulmann
188add8794
Session recording hotfixes (#2021)
* Handle no sessions in session_recording.add_session_recording_ids

* Fix sessions screen on clickhouse

It does not yet support clickhouse-based setups, will fix in a follow-up
PR.

Sentry:
- https://sentry.io/organizations/posthog/issues/1981146485/?project=1899813&referrer=slack
- https://sentry.io/organizations/posthog/issues/1980156250/?project=1899813&referrer=slack
2020-10-26 09:53:48 +02:00
Karl-Aksel Puulmann
05a96db4d4
Add types to window.posthog (#2012)
* Add typing to userLogic

This will help avoid issues like 1955

* Declare globals.d.ts, use window.posthog correctly in featureFlagLogic
2020-10-23 17:09:36 +03:00
Karl-Aksel Puulmann
d92e533dd5
Session recording: persistent URLs, session_id, UI changes (#1953)
* Hide $session_id properties

* Exclude $snapshot events from event views

* Add end_time to sessions queries

This might be used by SessionRecording queries

* Add WIP way to return session recording

Note that this mutates existing responses - might not be the best way to
do this.

* Query for feature flags in a consistent way in frontend

* Improve documentation on featureFlagLogic

* Update frontend types

* Set up endpoint for querying event data for rrweb

* Sort snapshot data in BE before sending to FE

* Show sessions player in a drawer, load data from API

This makes for a smoother experience (IMO, will iterate). At the very
least, drawers enable us to have differing urls via kea

* Show loader while replay is loading

* Make player full-width

* Remove debug code

* Implement persistent URLs for sessions

This should make it possible to share recordings with team.

The URLs are currently quite long - perhaps we can get rid of
distinct_id long-term within it?

* Use only $session_id for filtering sessions

There's a small risk of collisions, but this cleans code up a lot

* WIP

* Add `array.flatMap` to tsconfig

* Add selectors for prev/next session recording

* Clean up whitespace

* Make next and previous buttons work

* Patch prev/next behavior when not visible in page

* Session recording query testing

* Fix typing errors

* Make Sessions queries work properly

It was previously overwriting things even in queries not returning a
list of sessions

* Blacklist browsers w/o flatMap (PR review)

* Close sessions player on back

* fix back button and small bugs

Co-authored-by: Marius Andra <marius.andra@gmail.com>
2020-10-23 16:53:59 +03:00
Marius Andra
e4895ba80a
Cohorts Test (#2003)
* test creating and listing cohorts

* try to fix flakyness by clicking the dropdown item even if it's not visible
2020-10-23 15:52:59 +02:00
Michael Matloka
33fd0d3d56
Fix links (#2004)
* Fix links

* Fix import path

* Fix messages
2020-10-23 15:50:41 +02:00
Karl-Aksel Puulmann
bfde01b6c9
Use posthog.js correctly in userLogic (#1975)
* Use posthog.js correctly in userLogic

This caused some confusion (issue #1955) - we should be using our own
tools correctly. 😅

* Always update email (PR feedback)
2020-10-23 16:00:11 +03:00
Eric Duong
a15b387d1a
patch broken link from changed path (#2002) 2020-10-23 11:34:06 +02:00
Marius Andra
187b1ea7df
fix cohort link (#2000) 2020-10-23 11:12:26 +02:00
Tim Glaser
583d796db5
Break down feature_flag_response and add to propertykeyinfo (#1991) 2020-10-23 09:32:55 +03:00
Michael Matloka
533c7df105
Organization<>Team<>User structure (closes #1540) (#1562)
* Backend changes to implement #1461

* Added the missing migration files

* Fixes Typecheck errors

* Refactor request.user.team_set.get() to use request.user.team

* Updated user patch method to change current_team on team id instead of name

* Merged migration file

* Changes team property to return first item in queryset

* Fixes failing tests

* Changed User api to return the ids of the teams they are currently part of

* Frontend for changing teams

* Update and simplify migrations

* Improve team and user buttons

* Make team changing backend more logical

* Improve current_team mechanics

* Update test_team.py

* Fix Team.objects.create_with_data

* Update migration

* Update tests

* Make setup_review more convenient

* Add Organization and OrganizationMembership

* Replace is_admin with level

* Extend API

* Update team.py

* Improve modeling

* Improve handling of new mechanics

* Add proper migration

* Remove _ensure_organization_and_team

* Update 0084_org_team_user.py

* Improve user, org and team creation

* Make MembershipLevel more flexible for the future

* Add member deletion

* Fix naive datetime warnings

* Update setup_review.py

* Update API route

* Make PersonalAPIKey changes

* Update models and migrations, fix typing

* Fix typing

* Use MAC-less UUID v1 instead of v4 for better performance

* Add abstract UUIDModel

* Update utils.py

* Update utils.py

* Fix multi/unicast bit

* Update APIs, frontend and tests

* Update pull_request_template.md

* Fix comment

* Fix migration error

* Compress migrations

* Updates with minimal renaming

* More updates

* Make further updates

* Update test_team_user.py

* Fix issues

* Add migration

* Satisfy mypy

* Remove Signup redirect on logged in

* Use uuid1_macless in Person

* Fix typing

* Update tests

* Update /api/team/signup to /api/organization/signup

* Fix mypy issues and update tests

The remaining failures are actually missing functionality (TDD applied), so filling these in.

* Update 0086_org_live

* Make small improvements

* Implement permissions

* Remove now unneccesary membership check

* Update setup_dev.py

* Make small frontend improvements

* Add drf-nested-routers as requirement

* Remove unused import

* Implemented nested routes

* Remove cruft

* Add relevant org/proj/user name to headings

* Fix imports

* Update migration

* Replace unreliable drf-nested-routers with drf-extensions

* Improve unset team handling

* Make org and team creation proper

* Update migration

* Fix migration

* Update TopContent

* Update command palette for new sidebar structure

* Remove deprecated demo data deletion

* Assume that each org has a project and fix typing

* Require paid plan for multiple orgs and projects

* Make HogFlix demo a separate team

* Update migration

* Slightly improve style

* Adjust page layout bottom padding

* Make user dropdown nicer

* Fix base app tests

* Satisfy mypy

* Fix test_leave_organization

* Improve wording

* Possibly fix import

* Remove misplaced None check

* Enhance org and teams APIs and add tests

* Fix /api/projects for particular Team

* Improve invites and demo data

* Address feedback

* Put everything related to billing on Organization

* Fix minor issues

* Simplify invitation creation

* Update team model

* Make orgs and projects premium only on self-hosted

* Improve testing

* Update migration

* Remove extra License import

* Fix minor issues

* Fix Django tests

* Fix Cypress

* Fix yarn build

* Fix TeamSignupViewset

* Fix posthog-production incompatibility

* Remove extraneous insight endpoint registration

* Adjust tests for posthog-production

* Simplify invitations and fix email validation

* Address all feedback

* Satisfy mypy

* Update migration

* Fix constraint removal in migration

* Update tests

* Fix test creation edge case

* Run posthog-production CI tests against this branch and teams-live

* Ensure that js_posthog_api_key is always passed

* Fix preflight check pre-login

* Update cypress tests

* Update instanceStatus.js

* Bring ee tets up to par

* Bring actions-ux-201012 back

* Cypress retry in cypress.json

* Revert "Run posthog-production CI tests against this branch and teams-live"

This reverts commit d79cb844d8.

Co-authored-by: anna <ms.annaphilips@gmail.com>
Co-authored-by: Anna Philips <aphilips@matmacorp.com>
2020-10-22 10:58:32 +02:00
Tim Glaser
8cb7b1e0f4
Fix feature flag toast on success (#1970) 2020-10-22 10:15:00 +02:00
Tim Glaser
711326e81a
Add usage button to feature flags (#1947)
* Make log output locally less noisy

* Add usage button to feature flags

* convert backTo logic to kea

Co-authored-by: Paolo D'Amico <paolodamico@users.noreply.github.com>
2020-10-21 18:54:33 +02:00
Marius Andra
c517c5a511
add redis & postgres version, redis client count ; improve table design (#1939) 2020-10-20 10:51:36 +02:00
Michael Matloka
f3ce6fc2ed
Friendlier feedback command and flow navigation (#1905)
* Rework share feedback command

* Add backwards navigation of command flows with Esc
2020-10-19 15:05:09 +02:00
Yakko Majuri
d4bf674a8f
changed tone of nested sidebar (#1930) 2020-10-19 14:40:36 +02:00
Tim Glaser
58ca5539ea
Feature flags larger pages and rename sidebar item (#1927)
* Feature flags larger pages and rename sidebar item

* Flag icon instead
2020-10-19 12:45:01 +01:00
Yakko Majuri
5785fe726e
Fix events overlay (#1922)
* fix events overlay

* removed image and overlay

* remove comment
2020-10-19 10:52:49 +01:00
Yakko Majuri
36a5d97389
Fix responsive sidebar overlay (#1924) 2020-10-19 10:39:15 +01:00
Karl-Aksel Puulmann
2b81946f3b
Avoid throwing uncaught error when creating cohorts (#1880)
Sentry error: https://sentry.io/organizations/posthog/issues/1665112291/?project=1899813&query=is%3Aunresolved+frontend&sort=user&statsPeriod=14d

This was introduced in commit 8e6b4f56b5
when moving from classes to functional components.

A lot of the Cohorts/People UX is weird, creating a separate issue on
this.
2020-10-19 11:57:57 +03:00
Karl-Aksel Puulmann
f8788287db
Don't fail when network fails during verification panel step (#1906)
Closes #1904
2020-10-19 10:55:38 +02:00
Marius Andra
4e27575fb7
Hogflix demo dashboard rename & delete (#1919)
* delete hogflix dashboard, name it something other than "default"

* reload dashboards list to get it out of the sidebar

* fix name for consistency

Co-authored-by: Yakko Majuri <yakko.majuri@gmail.com>
2020-10-18 10:13:25 +01:00
Michael Matloka
79e4714f11
Palette smartphone adjustments (#1865)
* Adjust palette styling for even the smallest devices

* Scroll palette results into view

* Polish command logic and typing

* Fix scroll into view

* Capture isMobile() in palette usage events

* Adjust responsive palette styling

* Hide palette on `executor === true` execution
2020-10-15 14:20:29 +02:00
Marius Andra
4e62aed502
show CMD+K as "⌘K" instead of "⌘ + K" (#1893) 2020-10-15 14:02:31 +02:00
Tim Glaser
8d84eda545
Add property filters to sessions (#1835)
* Add property filters to sessions

* Fix backwards+forwards and use debounce

* Renamed filters to properties
2020-10-15 13:43:36 +02:00
Tim Glaser
0708e3a1b1
Fix sentry error in select box (#1891) 2020-10-15 13:39:00 +02:00
Ahti Kitsik
3e1f06fe58
System Status page and API (#1812). (#1875)
* System Status page and API (#1812).

* More resilient to Redis outage. Ensure the table gets loaded.

* Bugfix and reworded.

* Using kea-typegen now and removed a " ".
2020-10-15 12:34:32 +02:00
Marius Andra
32592b36bb
Remove Toolbar Beta Toggle (#1853) 2020-10-15 11:42:42 +02:00
Eric Duong
b82527e86c
fix loading spinner (#1876) 2020-10-15 10:14:50 +02:00
Marius Andra
19fede85c5
Fix double tab opening when clicking with META (#1890)
* fix double tab opening

* unify Link and LinkButton
2020-10-15 10:06:14 +02:00
Karl-Aksel Puulmann
2fef0bf358
Reset user session after logging in as another user (#1850)
* Reset user session after logging in as another session

Resolves #1844

* Call posthog.reset() on logout
2020-10-15 09:56:58 +02:00
Eric Duong
2d60a5b670
Retention date filtering (#1788)
* working date filter

* frontend for period

* remove period

* add params

* add period

* period working

* add test for period

* merge master

* fix test

* add dropdowns for period date filtering

* pass params and handle properly

* fix labels and readjust tests

* test split for retentino period

* make insight retention test just test for response

* add condition

* feature flag the frontend and bring back ff for the ch endpoint

* fix cohort filtering

* fix cohort querying

* remove init

* remove feature flag

* add back featureflag

* block person modal on retention page if clickhouse enabled

* use distinct_id instead of joining for person_id
2020-10-14 10:28:27 -04:00
Karl-Aksel Puulmann
43816096d0
Fix SyntaxError on chrome (#1882)
Sentry: https://sentry.io/organizations/posthog/issues/1866056145/events/07430159d50a4c91a72c280a7921bf0d/?project=1899813&query=is%3Aunresolved&sort=user&statsPeriod=14d

I assume this was happening during parsing rather than during execution
- these are relatively new browsers
2020-10-14 15:10:43 +01:00
Eric Duong
ea040c9e40
add overflow to card body (#1878) 2020-10-14 15:09:06 +02:00
Karl-Aksel Puulmann
c24c58828f
Upgrade cypress, fix and stabilize tests (#1872)
* Upgrade cypress

- https://docs.cypress.io/guides/references/migration-guide.html#Migrating-to-Cypress-5-0
- https://docs.cypress.io/guides/references/changelog.html#5-0-0

* Run tests multiple times if flaky

* Fix broken command palette cypress test

* Remove default retries options
2020-10-14 15:36:25 +03:00
Tim Glaser
da88897a21
Remove redis warning (#1856) 2020-10-14 13:35:44 +02:00
Eric Duong
7c02780458
don't call format unless there's an action (#1874) 2020-10-14 13:27:19 +02:00
Michael Matloka
19adefcd6e
Fix small util bugs (#1871)
* Fix small util bugs

* Delete console.log
2020-10-14 12:00:52 +02:00
Karl-Aksel Puulmann
0370a42d98
Command palette: avoid clashing with browser shortcuts (#1867)
fixes #1866
2020-10-14 11:47:42 +03:00
Michael Matloka
c3d3f83c49
Destroy lodash (#1864)
* Convert utils to TS and add missing lodash-like functions

* Purge lodash, using utils and ES features instead

* Remove lodash as a dependency

* Fix Annotation.created_at default value (was null)

* Convert all of utils to TypeScript

* Update ESLint rule @typescript-eslint/explicit-module-boundary-types

* Put all @types/* into devDependencies

* Lower @typescript-eslint/explicit-function-return-type severity

* Fix Annotation.created_at in a better way

* Don't copy item on push in groupBy

* Use `Set.has()` instead of `in Set`

* Update .eslintrc.js

* Update .eslintrc.js
2020-10-14 10:42:06 +02:00