Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pass in funnel_step_breakdown param for funnels breakdown persons modal #5289

Merged
merged 7 commits into from
Jul 22, 2021
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 20 additions & 2 deletions frontend/src/scenes/funnels/FunnelBarGraph.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@ export function FunnelBarGraph({ filters, dashboardItemId, color = 'white' }: Om
percentage={barSizePercentage}
name={breakdown.name}
onBarClick={() =>
openPersonsModal(step, i + 1, step.breakdown_value)
openPersonsModal(step, i + 1, breakdown.breakdown)
}
disabled={!!dashboardItemId}
layout={layout}
Expand Down Expand Up @@ -413,8 +413,16 @@ export function FunnelBarGraph({ filters, dashboardItemId, color = 'white' }: Om
})}
<div
className="funnel-bar-empty-space"
onClick={() =>
clickhouseFeaturesEnabled &&
!dashboardItemId &&
openPersonsModal(step, -(i + 1))
} // dropoff value for steps is negative
style={{
flex: `${100 - calcPercentage(breakdownSum, basisStep.count)} 100 0`,
cursor: `${
clickhouseFeaturesEnabled && !dashboardItemId ? 'pointer' : ''
}`,
}}
/>
</>
Expand Down Expand Up @@ -466,7 +474,17 @@ export function FunnelBarGraph({ filters, dashboardItemId, color = 'white' }: Om
/>
<div
className="funnel-bar-empty-space"
style={{ flex: `${100 - step.conversionRates.fromBasisStep} 100 0` }}
onClick={() =>
clickhouseFeaturesEnabled &&
!dashboardItemId &&
openPersonsModal(step, -(i + 1))
} // dropoff value for steps is negative
style={{
flex: `${100 - step.conversionRates.fromBasisStep} 100 0`,
cursor: `${
clickhouseFeaturesEnabled && !dashboardItemId ? 'pointer' : ''
}`,
}}
/>
</>
)}
Expand Down
1 change: 1 addition & 0 deletions frontend/src/scenes/funnels/funnelLogic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ export const cleanFunnelParams = (filters: Partial<FilterType>, discardFiltersNo
...(filters.funnel_step ? { funnel_to_step: filters.funnel_step } : {}),
...(filters.entrance_period_start ? { entrance_period_start: filters.entrance_period_start } : {}),
...(filters.drop_off ? { drop_off: filters.drop_off } : {}),
...(filters.funnel_step_breakdown ? { funnel_step_breakdown: filters.funnel_step_breakdown } : {}),
interval: autocorrectInterval(filters),
breakdown: breakdownEnabled ? filters.breakdown || undefined : undefined,
breakdown_type: breakdownEnabled ? filters.breakdown_type || undefined : undefined,
Expand Down
5 changes: 3 additions & 2 deletions frontend/src/scenes/trends/PersonModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,9 @@ export function PersonModal({ visible, view, filters, onSaveCohort }: Props): JS
`"${people?.label}"`
) : filters.insight === ViewType.FUNNELS ? (
<>
Persons who {people?.funnelStep ?? 0 >= 0 ? 'completed' : 'dropped off at'} step #
{Math.abs(people?.funnelStep ?? 0)} - <PropertyKeyInfo value={people?.label || ''} disablePopover />
Persons who {(people?.funnelStep ?? 0) >= 0 ? 'completed' : 'dropped off at'} step #
{Math.abs(people?.funnelStep ?? 0)} - <PropertyKeyInfo value={people?.label || ''} disablePopover />{' '}
{people?.breakdown_value && `- ${people.breakdown_value}`}
</>
) : (
<>
Expand Down
18 changes: 16 additions & 2 deletions frontend/src/scenes/trends/personsModalLogic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,11 @@ export const personsModalLogic = kea<personsModalLogicType<PersonModalParams>>({
params = { ...filters, entrance_period_start, drop_off: false }
} else {
// regular funnel steps
params = { ...filters, funnel_step: funnelStep }
params = {
...filters,
funnel_step: funnelStep,
...(breakdown_value && { funnel_step_breakdown: breakdown_value }),
}
}
const cleanedParams = cleanFunnelParams(params)
const funnelParams = toParams(cleanedParams)
Expand Down Expand Up @@ -174,7 +178,16 @@ export const personsModalLogic = kea<personsModalLogicType<PersonModalParams>>({
},
loadMorePeople: async ({}, breakpoint) => {
if (values.people) {
const { people: currPeople, count, action, label, day, breakdown_value, next } = values.people
const {
people: currPeople,
count,
action,
label,
day,
breakdown_value,
next,
funnelStep,
} = values.people
const people = await api.get(next)
breakpoint()

Expand All @@ -186,6 +199,7 @@ export const personsModalLogic = kea<personsModalLogicType<PersonModalParams>>({
day,
breakdown_value,
next: people.next,
funnelStep,
}
}
return null
Expand Down
1 change: 1 addition & 0 deletions frontend/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -641,6 +641,7 @@ export interface FilterType {
funnel_viz_type?: string // parameter sent to funnels API for time conversion code path
funnel_from_step?: number // used in time to convert: initial step index to compute time to convert
funnel_to_step?: number // used in time to convert: ending step index to compute time to convert
funnel_step_breakdown?: string | number[] | number | null // used in steps breakdown: persons modal
compare?: boolean
}

Expand Down