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

feat(cdp): client side destinations #26169

Closed
wants to merge 67 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
67 commits
Select commit Hold shift + click to select a range
bd9fd9e
feat(cdp): client side apps
mariusandra Nov 18, 2024
f61d1c9
template for pineapple analytics
mariusandra Nov 18, 2024
5eaf23e
pineapple analytics
mariusandra Nov 18, 2024
1d68861
site functions via hog functions
mariusandra Nov 19, 2024
acdbe20
filter in the frontend
mariusandra Nov 19, 2024
8de38a8
cleanup
mariusandra Nov 19, 2024
edb290c
Merge branch 'master' into hog-to-js++
mariusandra Nov 20, 2024
d8023c4
improve
mariusandra Nov 20, 2024
d2906cd
cleanup
mariusandra Nov 21, 2024
672d764
much better globals
mariusandra Nov 21, 2024
14cf968
more pineapples, wait until loaded before onEvent
mariusandra Nov 22, 2024
6d30ffb
missing invocations if no onLoad
mariusandra Nov 22, 2024
aefab04
site apps and destinations
mariusandra Nov 22, 2024
3e5d01d
site apps and destinations
mariusandra Nov 22, 2024
02daead
Update UI snapshots for `chromium` (2)
github-actions[bot] Nov 22, 2024
c89f3c9
Update UI snapshots for `chromium` (2)
github-actions[bot] Nov 22, 2024
da9b412
tighten
mariusandra Nov 22, 2024
abfcd47
Merge branch 'hog-to-js++' of github.com:PostHog/posthog into hog-to-…
mariusandra Nov 22, 2024
da084ed
refactor frontend: destinations -> functions list
mariusandra Nov 22, 2024
42579b8
new site apps
mariusandra Nov 22, 2024
bfe6819
Update UI snapshots for `chromium` (1)
github-actions[bot] Nov 22, 2024
ec09a85
type
mariusandra Nov 26, 2024
159b06b
Merge branch 'hog-to-js++' of github.com:PostHog/posthog into hog-to-…
mariusandra Nov 26, 2024
678974f
Update UI snapshots for `chromium` (2)
github-actions[bot] Nov 26, 2024
dda69e5
Merge branch 'master' into hog-to-js++
mariusandra Nov 26, 2024
4db60e1
fix types
mariusandra Nov 26, 2024
9ec8d72
fix
mariusandra Nov 26, 2024
5b50e39
Merge branch 'master' into hog-to-js++
mariusandra Nov 27, 2024
c4d1846
Merge branch 'master' into hog-to-js++
mariusandra Nov 28, 2024
f2e5b1a
fix a bunch of tests
mariusandra Nov 28, 2024
80180a7
even more fixes
mariusandra Nov 28, 2024
b14f917
copy over notification bar
mariusandra Nov 28, 2024
7f1ba79
refactor old site apps
mariusandra Nov 28, 2024
7315c0e
Merge branch 'master' into hog-to-js++
mariusandra Nov 28, 2024
a4e8062
Update UI snapshots for `chromium` (1)
github-actions[bot] Nov 28, 2024
2c320c4
Update query snapshots
github-actions[bot] Nov 28, 2024
ce864ce
improvements
mariusandra Nov 28, 2024
dcae995
Merge branch 'hog-to-js++' of github.com:PostHog/posthog into hog-to-…
mariusandra Nov 28, 2024
0953aa7
ux fixes
mariusandra Nov 29, 2024
b5fc65e
mypy
mariusandra Nov 29, 2024
5395919
Merge branch 'master' into hog-to-js++
mariusandra Nov 29, 2024
8df10d5
test for site functions in decide
mariusandra Nov 29, 2024
89aa7e9
add index
mariusandra Nov 29, 2024
ebcc4c9
Update UI snapshots for `chromium` (1)
github-actions[bot] Nov 29, 2024
616c57f
even more small things
mariusandra Nov 29, 2024
3c4ecd9
Merge branch 'hog-to-js++' of github.com:PostHog/posthog into hog-to-…
mariusandra Nov 29, 2024
92487c7
Update UI snapshots for `chromium` (1)
github-actions[bot] Nov 29, 2024
0c75df8
Merge branch 'master' into hog-to-js++
mariusandra Dec 2, 2024
5be2a54
test for site_app.py
mariusandra Dec 2, 2024
9ad461a
revert png binaries
mariusandra Dec 2, 2024
0343283
test for filters
mariusandra Dec 2, 2024
13c985e
Update UI snapshots for `chromium` (1)
github-actions[bot] Dec 2, 2024
1f90892
Update query snapshots
github-actions[bot] Dec 2, 2024
f10f9ce
test for transpilation
mariusandra Dec 2, 2024
f4d0997
Merge branch 'hog-to-js++' of github.com:PostHog/posthog into hog-to-…
mariusandra Dec 2, 2024
0909907
typescript inputs test
mariusandra Dec 2, 2024
2b46a2d
site function tests
mariusandra Dec 2, 2024
09d1fd6
Update query snapshots
github-actions[bot] Dec 2, 2024
1c34f1a
Merge branch 'hog-to-js++' of github.com:PostHog/posthog into hog-to-…
mariusandra Dec 2, 2024
5bb89fa
Merge branch 'master' into hog-to-js++
mariusandra Dec 2, 2024
bedaaee
Update query snapshots
github-actions[bot] Dec 2, 2024
e066018
test for utils
mariusandra Dec 2, 2024
00c24a1
mypy
mariusandra Dec 2, 2024
fd1a27b
Merge branch 'hog-to-js++' of github.com:PostHog/posthog into hog-to-…
mariusandra Dec 2, 2024
0e3ac12
fix
mariusandra Dec 2, 2024
b6ac756
remove todo comment
mariusandra Dec 2, 2024
221eb65
Merge branch 'master' into hog-to-js++
mariusandra Dec 2, 2024
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added frontend/public/services/pineapple.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
22 changes: 15 additions & 7 deletions frontend/src/lib/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1765,11 +1765,17 @@ const api = {
},
},
hogFunctions: {
async list(params?: {
filters?: any
type?: HogFunctionTypeType
}): Promise<PaginatedResponse<HogFunctionType>> {
return await new ApiRequest().hogFunctions().withQueryString(params).get()
async list(
filters?: any,
type?: HogFunctionTypeType | HogFunctionTypeType[]
): Promise<PaginatedResponse<HogFunctionType>> {
return await new ApiRequest()
.hogFunctions()
.withQueryString({
filters: filters,
...(type ? (Array.isArray(type) ? { types: type.join(',') } : { type }) : {}),
})
.get()
},
async get(id: HogFunctionType['id']): Promise<HogFunctionType> {
return await new ApiRequest().hogFunction(id).get()
Expand Down Expand Up @@ -1798,10 +1804,12 @@ const api = {
): Promise<AppMetricsTotalsV2Response> {
return await new ApiRequest().hogFunction(id).withAction('metrics/totals').withQueryString(params).get()
},
async listTemplates(type?: HogFunctionTypeType): Promise<PaginatedResponse<HogFunctionTemplateType>> {
async listTemplates(
type?: HogFunctionTypeType | HogFunctionTypeType[]
): Promise<PaginatedResponse<HogFunctionTemplateType>> {
return new ApiRequest()
.hogFunctionTemplates()
.withQueryString({ type: type ?? 'destination' })
.withQueryString(Array.isArray(type) ? { types: type.join(',') } : { type: type ?? 'destination' })
.get()
},
async getTemplate(id: HogFunctionTemplateType['id']): Promise<HogFunctionTemplateType> {
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/scenes/actions/actionLogic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export const actionLogic = kea<actionLogicType>([
null as HogFunctionType[] | null,
{
loadMatchingHogFunctions: async () => {
const res = await api.hogFunctions.list({ filters: { actions: [{ id: `${props.id}` }] } })
const res = await api.hogFunctions.list({ actions: [{ id: `${props.id}` }] })

return res.results
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ import { actions, afterMount, connect, kea, listeners, path, selectors } from 'k
import { loaders } from 'kea-loaders'
import api from 'lib/api'
import { getCurrentTeamId } from 'lib/utils/getAppContext'
import { pipelineDestinationsLogic } from 'scenes/pipeline/destinations/destinationsLogic'
import { DESTINATION_TYPES } from 'scenes/pipeline/hog-functions-list/constants'
import { hogFunctionsListLogic } from 'scenes/pipeline/hog-functions-list/hogFunctionsListLogic'
import { HogFunctionIcon } from 'scenes/pipeline/hogfunctions/HogFunctionIcon'
import { pipelineAccessLogic } from 'scenes/pipeline/pipelineAccessLogic'
import { FunctionDestination, PipelineBackend } from 'scenes/pipeline/types'
Expand Down Expand Up @@ -35,10 +36,10 @@ export const exportsUnsubscribeTableLogic = kea<exportsUnsubscribeTableLogicType
['canConfigurePlugins'],
userLogic,
['user'],
pipelineDestinationsLogic,
hogFunctionsListLogic({ types: DESTINATION_TYPES }),
['paidHogFunctions'],
],
actions: [pipelineDestinationsLogic, ['toggleNodeHogFunction']],
actions: [hogFunctionsListLogic({ types: DESTINATION_TYPES }), ['toggleNodeHogFunction']],
}),

actions({
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/scenes/messaging/functionsTableLogic.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export const functionsTableLogic = kea<functionsTableLogicType>([
{
loadHogFunctions: async () => {
// TODO: pagination?
return (await api.hogFunctions.list({ type: props.type ?? 'destination' })).results
return (await api.hogFunctions.list(undefined, props.type ?? 'destination')).results
},
deleteHogFunction: async ({ hogFunction }) => {
await deleteWithUndo({
Expand Down
5 changes: 3 additions & 2 deletions frontend/src/scenes/pipeline/Overview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ import { urls } from 'scenes/urls'

import { PipelineStage, PipelineTab } from '~/types'

import { DestinationsTable } from './destinations/Destinations'
import { DESTINATION_TYPES } from './hog-functions-list/constants'
import { HogFunctionsListTable } from './hog-functions-list/HogFunctionsList'
import { TransformationsTable } from './Transformations'

export function Overview(): JSX.Element {
Expand Down Expand Up @@ -72,7 +73,7 @@ export function Overview(): JSX.Element {
Send your data to destinations in real time or with batch exports. Only active Destinations are
shown here. <Link to={urls.pipeline(PipelineTab.Destinations)}>See all.</Link>
</p>
<DestinationsTable />
<HogFunctionsListTable types={DESTINATION_TYPES} />
</div>
</div>
</>
Expand Down
8 changes: 4 additions & 4 deletions frontend/src/scenes/pipeline/Pipeline.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import { urls } from 'scenes/urls'
import { ActivityScope, PipelineTab } from '~/types'

import { AppsManagement } from './AppsManagement'
import { Destinations } from './destinations/Destinations'
import { FrontendApps } from './FrontendApps'
import { DESTINATION_TYPES, SITE_APP_TYPES } from './hog-functions-list/constants'
import { HogFunctionsList } from './hog-functions-list/HogFunctionsList'
import { ImportApps } from './ImportApps'
import { importAppsLogic } from './importAppsLogic'
import { Overview } from './Overview'
Expand All @@ -27,8 +27,8 @@ export function Pipeline(): JSX.Element {
{ key: PipelineTab.Overview, content: <Overview /> },
{ key: PipelineTab.Sources, content: <Sources /> },
{ key: PipelineTab.Transformations, content: <Transformations /> },
{ key: PipelineTab.Destinations, content: <Destinations /> },
{ key: PipelineTab.SiteApps, content: <FrontendApps /> },
{ key: PipelineTab.Destinations, content: <HogFunctionsList types={DESTINATION_TYPES} /> },
{ key: PipelineTab.SiteApps, content: <HogFunctionsList types={SITE_APP_TYPES} /> },
]

// Import apps are deprecated, we only show the tab if there are some still enabled
Expand Down
8 changes: 7 additions & 1 deletion frontend/src/scenes/pipeline/PipelineNode.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ const paramsToProps = ({
}

return {
stage: PIPELINE_TAB_TO_NODE_STAGE[stage] || null,
stage: PIPELINE_TAB_TO_NODE_STAGE[stage as PipelineTab] || null,
id: numericId && !isNaN(numericId) ? numericId : id,
}
}
Expand Down Expand Up @@ -95,6 +95,12 @@ export function PipelineNode(params: { stage?: string; id?: string } = {}): JSX.
scope={ActivityScope.HOG_FUNCTION}
/>
)

// Remove "logs" and "metrics" if we can't use them
if (stage === PipelineStage.SiteApp) {
delete tabToContent[PipelineNodeTab.Logs]
delete tabToContent[PipelineNodeTab.Metrics]
}
}

return (
Expand Down
14 changes: 4 additions & 10 deletions frontend/src/scenes/pipeline/PipelineNodeNew.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ import { urls } from 'scenes/urls'

import { AvailableFeature, PipelineStage, PluginType } from '~/types'

import { NewDestinations } from './destinations/NewDestinations'
import { frontendAppsLogic } from './frontendAppsLogic'
import { DESTINATION_TYPES, SITE_APP_TYPES } from './hog-functions-list/constants'
import { NewFunctionsList } from './hog-functions-list/NewHogFunction'
import { HogFunctionConfiguration } from './hogfunctions/HogFunctionConfiguration'
import { PipelineBatchExportConfiguration } from './PipelineBatchExportConfiguration'
import { PIPELINE_TAB_TO_NODE_STAGE } from './PipelineNode'
Expand Down Expand Up @@ -103,9 +103,9 @@ export function PipelineNodeNew(params: { stage?: string; id?: string } = {}): J
if (stage === PipelineStage.Transformation) {
return <TransformationOptionsTable />
} else if (stage === PipelineStage.Destination) {
return <NewDestinations />
return <NewFunctionsList types={DESTINATION_TYPES} />
} else if (stage === PipelineStage.SiteApp) {
return <SiteAppOptionsTable />
return <NewFunctionsList types={SITE_APP_TYPES} />
} else if (stage === PipelineStage.Source) {
return <NewSourceWizardScene />
}
Expand All @@ -118,12 +118,6 @@ function TransformationOptionsTable(): JSX.Element {
return <NodeOptionsTable stage={PipelineStage.Transformation} targets={targets} loading={loading} />
}

function SiteAppOptionsTable(): JSX.Element {
const { plugins, loading } = useValues(frontendAppsLogic)
const targets = Object.values(plugins).map(convertPluginToTableEntry)
return <NodeOptionsTable stage={PipelineStage.SiteApp} targets={targets} loading={loading} />
}

function NodeOptionsTable({
stage,
targets,
Expand Down
214 changes: 0 additions & 214 deletions frontend/src/scenes/pipeline/destinations/Destinations.tsx

This file was deleted.

Loading
Loading