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

Disable stickiness and breakdown #774

Merged
merged 1 commit into from
May 15, 2020
Merged
Show file tree
Hide file tree
Changes from all 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
15 changes: 10 additions & 5 deletions frontend/src/scenes/trends/BreakdownFilter.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, { useState } from 'react'
import { selectStyle } from '../../lib/utils'
import { Select, Tabs, Popover, Button } from 'antd'
import { Tooltip, Select, Tabs, Popover, Button } from 'antd'
import { useValues } from 'kea'
import { userLogic } from 'scenes/userLogic'
import { cohortsModel } from '../../models/cohortsModel'
Expand Down Expand Up @@ -78,8 +78,9 @@ function Content({ breakdown, breakdown_type, onChange }) {
)
}

export function BreakdownFilter({ breakdown, breakdown_type, onChange }) {
export function BreakdownFilter({ filters, onChange }) {
const { cohorts } = useValues(cohortsModel)
const { breakdown, breakdown_type, shown_as } = filters
let [open, setOpen] = useState(false)
let label = breakdown
if (breakdown_type === 'cohort' && breakdown) {
Expand All @@ -106,9 +107,13 @@ export function BreakdownFilter({ breakdown, breakdown_type, onChange }) {
trigger="click"
placement="bottomLeft"
>
<Button shape="round" type={breakdown ? 'primary' : 'default'}>
{label || 'Add breakdown'}
</Button>
<Tooltip
title={shown_as == 'Stickiness' && 'Break down by is not yet available in combination with Stickiness'}
>
<Button shape="round" type={breakdown ? 'primary' : 'default'} disabled={shown_as == 'Stickiness'}>
{label || 'Add breakdown'}
</Button>
</Tooltip>
</Popover>
)
}
25 changes: 14 additions & 11 deletions frontend/src/scenes/trends/ShownAsFilter.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,22 @@
import React from 'react'
import { Select, Row } from 'antd'
import { Select, Row, Tooltip } from 'antd'

export function ShownAsFilter({ shown_as, onChange }) {
export function ShownAsFilter({ filters, onChange }) {
return (
<div>
<Row>
<Select
defaultValue={shown_as}
value={shown_as || 'Volume'}
onChange={value => onChange(value)}
style={{ width: 200 }}
>
<Select.Option value={'Volume'}>{'Volume'}</Select.Option>
<Select.Option value={'Stickiness'}>{'Stickiness'}</Select.Option>
</Select>
<Tooltip title={filters.breakdown && 'Shown as is not yet available in combination with breakdown'}>
<Select
defaultValue={filters.shown_as}
value={filters.shown_as || 'Volume'}
onChange={value => onChange(value)}
style={{ width: 200 }}
disabled={filters.breakdown}
>
<Select.Option value={'Volume'}>{'Volume'}</Select.Option>
<Select.Option value={'Stickiness'}>{'Stickiness'}</Select.Option>
</Select>
</Tooltip>
</Row>
</div>
)
Expand Down
8 changes: 2 additions & 6 deletions frontend/src/scenes/trends/Trends.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,7 @@ export function Trends() {
</h4>
<Row>
<BreakdownFilter
breakdown={filters.breakdown}
breakdown_type={filters.breakdown_type}
filters={filters}
onChange={(breakdown, breakdown_type) =>
setFilters({ breakdown, breakdown_type })
}
Expand All @@ -90,10 +89,7 @@ export function Trends() {
<small className="info">info</small>
</Tooltip>
</h4>
<ShownAsFilter
shown_as={filters.shown_as}
onChange={shown_as => setFilters({ shown_as })}
/>
<ShownAsFilter filters={filters} onChange={shown_as => setFilters({ shown_as })} />
</TabPane>
<TabPane tab="Sessions" key={ViewType.SESSIONS}>
<SessionFilter value={filters.session} onChange={v => setFilters({ session: v })} />
Expand Down