Skip to content

Connect funnel persons to the frontend - #4953

Merged
EDsCODE merged 15 commits into
masterfrom
4819-funnel-persons
Jul 6, 2021
Merged

Connect funnel persons to the frontend#4953
EDsCODE merged 15 commits into
masterfrom
4819-funnel-persons

Conversation

@liyiy

@liyiy liyiy commented Jul 1, 2021

Copy link
Copy Markdown
Contributor

Changes

Please describe.
If this affects the frontend, include screenshots.

This PR is just to connect the funnel persons api call from #4883 to the frontend
I still have to fix the filters, which I'll do in a separate PR

note: This only works for clickhouse right now and repeated steps aren't working quite 100% yet because the new funnel query has to be implemented first

Screen.Recording.2021-07-02.at.9.40.44.AM.mov

Screen Shot 2021-07-01 at 8 40 38 PM

Checklist

  • All querysets/queries filter by Organization, by Team, and by User
  • Django backend tests
  • Jest frontend tests
  • Cypress end-to-end tests
  • Migrations are safe to run at scale (e.g. PostHog Cloud) – present proof if not obvious
  • Frontend/CSS is usable at 320px (iPhone SE) and decent at 360px (most phones)
  • Breaking changes are backwards-compatible. Ensure old/new frontend requests work with new/old backends, and vice versa.

@timgl
timgl temporarily deployed to posthog-pr-4953 July 1, 2021 00:46 Inactive
@neilkakkar

neilkakkar commented Jul 1, 2021

Copy link
Copy Markdown
Contributor

Just a heads up: there's going to be a slight API change here!: #4946

The funnel_order_type and funnel_viz_type query params determine what kind of Funnel you get. (The default is what it is right now, so not a breaking change).

Oh, and also, we switched to POST because we were getting some "url too long" errors, and since Persons expects the same parameters + 1 extra (funnel_step), I've enabled POST for them too. Maybe a good idea to default to using POST here as well?

@timgl
timgl temporarily deployed to posthog-pr-4953 July 1, 2021 17:39 Inactive
@liyiy
liyiy force-pushed the 4819-funnel-persons branch from 390923a to 969e027 Compare July 1, 2021 19:50
@timgl
timgl temporarily deployed to posthog-pr-4953 July 1, 2021 19:50 Inactive
@liyiy
liyiy force-pushed the 4819-funnel-persons branch from 969e027 to f5c2387 Compare July 1, 2021 19:50
@timgl
timgl temporarily deployed to posthog-pr-4953 July 1, 2021 19:51 Inactive
@timgl
timgl temporarily deployed to posthog-pr-4953 July 2, 2021 00:45 Inactive
@timgl
timgl temporarily deployed to posthog-pr-4953 July 2, 2021 01:35 Inactive
@timgl
timgl temporarily deployed to posthog-pr-4953 July 2, 2021 13:52 Inactive
@liyiy
liyiy requested review from alexkim205 and samwinslow July 2, 2021 13:52
@liyiy
liyiy marked this pull request as ready for review July 2, 2021 13:53
@liyiy

liyiy commented Jul 2, 2021

Copy link
Copy Markdown
Contributor Author

oops give me one sec to fix the bar click before anyone reviews this 😅

edit: we're good now 😄

@timgl
timgl temporarily deployed to posthog-pr-4953 July 2, 2021 13:58 Inactive
@timgl
timgl temporarily deployed to posthog-pr-4953 July 2, 2021 14:16 Inactive
@timgl
timgl temporarily deployed to posthog-pr-4953 July 2, 2021 14:28 Inactive
@liyiy
liyiy requested a review from EDsCODE July 2, 2021 16:48
@liyiy

liyiy commented Jul 2, 2021

Copy link
Copy Markdown
Contributor Author

ospath module errors :(

@liyiy
liyiy requested a review from mariusandra July 2, 2021 17:45
@EDsCODE EDsCODE mentioned this pull request Jul 2, 2021
7 tasks

@mariusandra mariusandra left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I gave a look through the code, but couldn't really test it. Got this:

image

Is that because I'm running postgres? Checking on my M1 now, so can't really switch...

I found some things to remark on, but nothing serious... except for the feature flag typo.

Once you check these things, someone other than me should probably give this a final review.

Comment on lines +261 to +270
trendsLogic().actions.loadPeople(
{ id: step.action_id, name: step.name, properties: [], type: step.type },
`Persons who completed Step #${stepNumber} - "${step.name}"`,
'',
'',
'',
true,
'',
stepNumber
)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A nit for now and outside the scope of the PR, but this loadPeople could get a refactor into basically loadPeople(action, options). Having that many '', in a row feels like something could be improved :).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, I've kind of been able to connect the funnel/trends logics together so I think I'll try to refactor this into the personsModalLogic as originally planned, in a separate PR 😃

return (
<Modal
title={title}
title={<b>{title}</b>}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should prefer <strong> over <b>, <em> over <i>, etc.

saveOriginal?: boolean,
searchTerm?: string
searchTerm?: string,
funnel_step?: number

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a bit of a mess in this action, but normally we should stick to camelCase in JS, except when really and directly dealing with responses from API endpoint that follow different conventions.

Here the funnel_step var starts from the action, so it makes sense to use the JS convention I think.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I definitely get confused sometimes when to use camel vs snake case in the frontend because it seems like we use snake case in a lot of places on the frontend so we can pass in params like { funnel_step } instead of { funnel_step: funnelStep }

],
funnelPersonsEnabled: [
() => [featureFlagLogic.selectors.featureFlags],
(featureFlags) => featureFlags[FEATURE_FLAGS.FUNNEL_PERSON_MODAL],

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Type here, it should be FUNNEL_PERSONS_MODAL (person+"S").

I think we should remove the explicit Record<string, string> type for the FEATURE_FLAGS object, but again outside the scope here :)

@timgl
timgl temporarily deployed to posthog-pr-4953 July 2, 2021 20:37 Inactive
@timgl
timgl temporarily deployed to posthog-pr-4953 July 6, 2021 13:51 Inactive
@timgl
timgl temporarily deployed to posthog-pr-4953 July 6, 2021 13:58 Inactive
@neilkakkar

Copy link
Copy Markdown
Contributor

Tested locally for the API connections, that seems to be working fine 👍

@liyiy
liyiy requested a review from macobo July 6, 2021 15:05
@timgl
timgl temporarily deployed to posthog-pr-4953 July 6, 2021 16:00 Inactive
@liyiy

liyiy commented Jul 6, 2021

Copy link
Copy Markdown
Contributor Author

Anything else I need to update/fix to get this PR in? 😄

@liyiy
liyiy enabled auto-merge (squash) July 6, 2021 16:32
@liyiy
liyiy disabled auto-merge July 6, 2021 16:32

@samwinslow samwinslow left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code LGTM although I can't run Clickhouse portions locally. Let's just make sure any UI that depends on CH is not shown for Postgres-only installs. Should the selector for funnelPersonsEnabled also check if Clickhouse is supported?

Are there still styling issues after merging master (from a point after #4965 was merged)? I can help resolve those in another PR if so.

@EDsCODE
EDsCODE merged commit 05418cd into master Jul 6, 2021
@EDsCODE
EDsCODE deleted the 4819-funnel-persons branch July 6, 2021 16:51
@liyiy

liyiy commented Jul 6, 2021

Copy link
Copy Markdown
Contributor Author

Code LGTM although I can't run Clickhouse portions locally. Let's just make sure any UI that depends on CH is not shown for Postgres-only installs. Should the selector for funnelPersonsEnabled also check if Clickhouse is supported?

Are there still styling issues after merging master (from a point after #4965 was merged)? I can help resolve those in another PR if so.

I skipped it originally because I thought we could just release that funnel persons feature flag to people who had clickhouse enabled

timgl added a commit that referenced this pull request Jul 6, 2021
timgl added a commit that referenced this pull request Jul 6, 2021
@liyiy liyiy mentioned this pull request Jul 6, 2021
6 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants