Skip to content

Commit

Permalink
remove frontend side shown_as usage
Browse files Browse the repository at this point in the history
  • Loading branch information
thmsobrmlr committed Oct 5, 2023
1 parent 3e3b560 commit f58ec3b
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 32 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,6 @@ describe('filtersToQueryNode', () => {
aggregation_axis_prefix: '£',
aggregation_axis_postfix: '%',
formula: 'A+B',
shown_as: ShownAsValue.VOLUME,
display: ChartDisplayType.ActionsAreaGraph,
},
breakdown: {
Expand Down Expand Up @@ -486,7 +485,6 @@ describe('filtersToQueryNode', () => {
compare: true,
show_legend: true,
hidden_legend_indexes: [0, 10],
shown_as: ShownAsValue.STICKINESS,
display: ChartDisplayType.ActionsLineGraph,
},
}
Expand All @@ -507,7 +505,6 @@ describe('filtersToQueryNode', () => {
const query: Partial<LifecycleQuery> = {
kind: NodeKind.LifecycleQuery,
lifecycleFilter: {
shown_as: ShownAsValue.LIFECYCLE,
toggledLifecycles: ['new', 'dormant'],
},
}
Expand Down Expand Up @@ -643,9 +640,7 @@ describe('filtersToQueryNode', () => {
},
],
interval: 'day',
lifecycleFilter: {
shown_as: ShownAsValue.LIFECYCLE,
},
lifecycleFilter: {},
}
expect(result).toEqual(query)
})
Expand Down
13 changes: 0 additions & 13 deletions frontend/src/queries/nodes/InsightViz/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import {
} from '~/queries/utils'
import { filtersToQueryNode } from '../InsightQuery/utils/filtersToQueryNode'
import equal from 'fast-deep-equal'
import { ShownAsValue } from 'lib/constants'

export const getAllEventNames = (query: InsightQueryNode, allActions: ActionType[]): string[] => {
const { actions, events } = seriesToActionsAndEvents((query as TrendsQuery).series || [])
Expand Down Expand Up @@ -82,18 +81,6 @@ export const getBreakdown = (query: InsightQueryNode): BreakdownFilter | undefin
}
}

export const getShownAs = (query: InsightQueryNode): ShownAsValue | undefined => {
if (isLifecycleQuery(query)) {
return query.lifecycleFilter?.shown_as
} else if (isStickinessQuery(query)) {
return query.stickinessFilter?.shown_as
} else if (isTrendsQuery(query)) {
return query.trendsFilter?.shown_as
} else {
return undefined
}
}

export const getShowLegend = (query: InsightQueryNode): boolean | undefined => {
if (isStickinessQuery(query)) {
return query.stickinessFilter?.show_legend
Expand Down
2 changes: 0 additions & 2 deletions frontend/src/scenes/insights/insightVizDataLogic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ import {
getFormula,
getInterval,
getSeries,
getShownAs,
getShowLegend,
getShowPercentStackView,
getShowValueOnSeries,
Expand Down Expand Up @@ -122,7 +121,6 @@ export const insightVizDataLogic = kea<insightVizDataLogicType>([
interval: [(s) => [s.querySource], (q) => (q ? getInterval(q) : null)],
properties: [(s) => [s.querySource], (q) => (q ? q.properties : null)],
samplingFactor: [(s) => [s.querySource], (q) => (q ? q.samplingFactor : null)],
shownAs: [(s) => [s.querySource], (q) => (q ? getShownAs(q) : null)],
showLegend: [(s) => [s.querySource], (q) => (q ? getShowLegend(q) : null)],
showValueOnSeries: [(s) => [s.querySource], (q) => (q ? getShowValueOnSeries(q) : null)],
showPercentStackView: [(s) => [s.querySource], (q) => (q ? getShowPercentStackView(q) : null)],
Expand Down
20 changes: 9 additions & 11 deletions frontend/src/scenes/trends/viz/ActionsLineGraph.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ export function ActionsLineGraph({
compare,
display,
interval,
shownAs,
showValueOnSeries,
showPercentStackView,
supportsPercentStackView,
Expand Down Expand Up @@ -84,19 +83,18 @@ export function ActionsLineGraph({
const urls = urlsForDatasets(crossDataset, index)

if (urls?.length) {
const title =
shownAs === 'Stickiness' ? (
const title = isStickiness ? (
<>
<PropertyKeyInfo value={label || ''} disablePopover /> stickiness on day {day}
</>
) : (
(label: string) => (
<>
<PropertyKeyInfo value={label || ''} disablePopover /> stickiness on day {day}
{label} on{' '}
<DateDisplay interval={interval || 'day'} date={day?.toString() || ''} />
</>
) : (
(label: string) => (
<>
{label} on{' '}
<DateDisplay interval={interval || 'day'} date={day?.toString() || ''} />
</>
)
)
)

openPersonsModal({
urls,
Expand Down

0 comments on commit f58ec3b

Please sign in to comment.