Skip to content

Commit

Permalink
actions
Browse files Browse the repository at this point in the history
  • Loading branch information
thmsobrmlr committed Aug 6, 2024
1 parent faa0ca7 commit bbe003d
Showing 1 changed file with 22 additions and 30 deletions.
52 changes: 22 additions & 30 deletions frontend/src/scenes/data-management/actions/ActionsTable.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { IconCheckCircle } from '@posthog/icons'
import { LemonInput, LemonSegmentedButton } from '@posthog/lemon-ui'
import { useActions, useValues } from 'kea'
import { combineUrl } from 'kea-router'
import api from 'lib/api'
import { ObjectTags } from 'lib/components/ObjectTags/ObjectTags'
import { ProductIntroduction } from 'lib/components/ProductIntroduction/ProductIntroduction'
Expand All @@ -19,15 +18,8 @@ import { actionsLogic } from 'scenes/actions/actionsLogic'
import { userLogic } from 'scenes/userLogic'

import { actionsModel } from '~/models/actionsModel'
import {
ActionType,
AvailableFeature,
ChartDisplayType,
FilterLogicalOperator,
InsightType,
ProductKey,
ReplayTabs,
} from '~/types'
import { InsightVizNode, NodeKind } from '~/queries/schema'
import { ActionType, AvailableFeature, ChartDisplayType, FilterLogicalOperator, ProductKey, ReplayTabs } from '~/types'

import { NewActionButton } from '../../actions/NewActionButton'
import { teamLogic } from '../../teamLogic'
Expand All @@ -44,6 +36,25 @@ export function ActionsTable(): JSX.Element {
const { hasAvailableFeature } = useValues(userLogic)
const { updateHasSeenProductIntroFor } = useActions(userLogic)

const tryInInsightsUrl = (action: ActionType): string => {
const query: InsightVizNode = {
kind: NodeKind.InsightVizNode,
source: {
kind: NodeKind.TrendsQuery,
series: [
{
id: action.id,
name: action.name || undefined,
kind: NodeKind.ActionsNode,
},
],
interval: 'day',
trendsFilter: { display: ChartDisplayType.ActionsLineGraph },
},
}
return urls.insightNew(undefined, undefined, query)
}

const columns: LemonTableColumns<ActionType> = [
{
title: 'Name',
Expand Down Expand Up @@ -183,26 +194,7 @@ export function ActionsTable(): JSX.Element {
>
View recordings
</LemonButton>
<LemonButton
to={
combineUrl(
urls.insightNew({
insight: InsightType.TRENDS,
interval: 'day',
display: ChartDisplayType.ActionsLineGraph,
actions: [
{
id: action.id,
name: action.name,
type: 'actions',
order: 0,
},
],
})
).url
}
fullWidth
>
<LemonButton to={tryInInsightsUrl(action)} fullWidth>
Try out in Insights
</LemonButton>
<LemonDivider />
Expand Down

0 comments on commit bbe003d

Please sign in to comment.