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: Test hog functions #23017

Merged
merged 326 commits into from
Jun 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
326 commits
Select commit Hold shift + click to select a range
7edae0f
Fixes?
benjackwhite Jun 12, 2024
6d826da
Update UI snapshots for `chromium` (1)
github-actions[bot] Jun 12, 2024
627052b
Update UI snapshots for `chromium` (2)
github-actions[bot] Jun 12, 2024
e18f2a7
Update UI snapshots for `chromium` (1)
github-actions[bot] Jun 12, 2024
ab7f3c1
Update UI snapshots for `chromium` (2)
github-actions[bot] Jun 12, 2024
0d7d24f
Fixes
benjackwhite Jun 12, 2024
c6e54cb
Merge branch 'feat/proper-templates' of github.com:PostHog/posthog in…
benjackwhite Jun 12, 2024
96ed784
Update UI snapshots for `chromium` (1)
github-actions[bot] Jun 12, 2024
c6010e3
Update UI snapshots for `chromium` (2)
github-actions[bot] Jun 12, 2024
6cb173c
Update UI snapshots for `chromium` (2)
github-actions[bot] Jun 12, 2024
6ecf2ba
Update UI snapshots for `chromium` (2)
github-actions[bot] Jun 12, 2024
9486d78
Update UI snapshots for `chromium` (2)
github-actions[bot] Jun 12, 2024
5eb9524
Update UI snapshots for `chromium` (2)
github-actions[bot] Jun 12, 2024
ef962f2
Update UI snapshots for `chromium` (2)
github-actions[bot] Jun 12, 2024
5b4b76b
Fixes
benjackwhite Jun 12, 2024
d81f545
Merge branch 'feat/proper-templates' of github.com:PostHog/posthog in…
benjackwhite Jun 12, 2024
3e867d0
Update UI snapshots for `chromium` (2)
github-actions[bot] Jun 12, 2024
2ba6fde
merge
benjackwhite Jun 12, 2024
fe3aa13
Update UI snapshots for `chromium` (2)
github-actions[bot] Jun 12, 2024
96f9bdf
Update UI snapshots for `chromium` (2)
github-actions[bot] Jun 12, 2024
b911dc2
Update UI snapshots for `chromium` (2)
github-actions[bot] Jun 12, 2024
7c347b6
Merge branch 'master' into feat/feedback-loop
benjackwhite Jun 12, 2024
cda22e9
Update UI snapshots for `chromium` (2)
github-actions[bot] Jun 12, 2024
4ca2bcf
Update UI snapshots for `chromium` (2)
github-actions[bot] Jun 12, 2024
33008d4
Update UI snapshots for `chromium` (1)
github-actions[bot] Jun 12, 2024
3e36b1c
Update UI snapshots for `chromium` (2)
github-actions[bot] Jun 12, 2024
6bb1f5a
Update UI snapshots for `chromium` (1)
github-actions[bot] Jun 12, 2024
01a8da4
Update UI snapshots for `chromium` (2)
github-actions[bot] Jun 12, 2024
0dfa58e
Update UI snapshots for `chromium` (2)
github-actions[bot] Jun 12, 2024
fa524f6
Update UI snapshots for `chromium` (1)
github-actions[bot] Jun 12, 2024
8fcc734
Update UI snapshots for `chromium` (2)
github-actions[bot] Jun 12, 2024
892c203
Fixes
benjackwhite Jun 12, 2024
85c739e
Merge branch 'feat/feedback-loop' into feat/proper-templates
benjackwhite Jun 12, 2024
705f3e3
Update UI snapshots for `chromium` (1)
github-actions[bot] Jun 12, 2024
250fb38
Update UI snapshots for `chromium` (2)
github-actions[bot] Jun 12, 2024
3f8170d
Update UI snapshots for `chromium` (1)
github-actions[bot] Jun 12, 2024
963d23d
Update UI snapshots for `chromium` (2)
github-actions[bot] Jun 12, 2024
09b83c7
Update UI snapshots for `chromium` (2)
github-actions[bot] Jun 12, 2024
20b8227
Update UI snapshots for `chromium` (2)
github-actions[bot] Jun 12, 2024
49839dc
Update UI snapshots for `chromium` (2)
github-actions[bot] Jun 12, 2024
0659df2
Update UI snapshots for `chromium` (2)
github-actions[bot] Jun 12, 2024
60ccc4f
Merge branch 'master' into feat/feedback-loop
benjackwhite Jun 13, 2024
bd4e601
Merge branch 'feat/feedback-loop' into feat/proper-templates
benjackwhite Jun 13, 2024
fabe6fa
Update UI snapshots for `chromium` (2)
github-actions[bot] Jun 13, 2024
f47249b
Update UI snapshots for `chromium` (2)
github-actions[bot] Jun 13, 2024
2c330c5
Update UI snapshots for `chromium` (2)
github-actions[bot] Jun 13, 2024
f30459c
Added template field
benjackwhite Jun 13, 2024
c763662
Merge branch 'feat/proper-templates' of github.com:PostHog/posthog in…
benjackwhite Jun 13, 2024
a4fbd60
Update UI snapshots for `chromium` (2)
github-actions[bot] Jun 13, 2024
fba9ae6
feat: Automatic Hog Function icons (#22923)
benjackwhite Jun 13, 2024
2e11833
Update UI snapshots for `chromium` (2)
github-actions[bot] Jun 13, 2024
eb29237
Added check for template and reset logic etc.
benjackwhite Jun 13, 2024
23ea2d4
Merge branch 'feat/proper-templates' of github.com:PostHog/posthog in…
benjackwhite Jun 13, 2024
a4fa9ac
Fixes
benjackwhite Jun 13, 2024
adfd4e4
Fixes
benjackwhite Jun 13, 2024
bb24dbb
Fix
benjackwhite Jun 13, 2024
d010175
Fixes
benjackwhite Jun 13, 2024
89be1a2
Merge branch 'feat/feedback-loop' into feat/proper-templates
benjackwhite Jun 13, 2024
46f3458
Fixes
benjackwhite Jun 13, 2024
ec9e831
Merge branch 'master' into feat/feedback-loop
benjackwhite Jun 13, 2024
1deeea6
Update UI snapshots for `chromium` (2)
github-actions[bot] Jun 13, 2024
cd9809c
Fixes?
benjackwhite Jun 13, 2024
8981f04
Merge branch 'feat/feedback-loop' into feat/proper-templates
benjackwhite Jun 13, 2024
3ec0fa7
Updated notes
benjackwhite Jun 13, 2024
10c41a3
Update UI snapshots for `chromium` (2)
github-actions[bot] Jun 13, 2024
751b1f1
Fix padding
benjackwhite Jun 13, 2024
aacc13a
Merge branch 'feat/proper-templates' of github.com:PostHog/posthog in…
benjackwhite Jun 13, 2024
f6a467a
Fix up
benjackwhite Jun 13, 2024
940b94c
Update query snapshots
github-actions[bot] Jun 13, 2024
378e861
Update UI snapshots for `chromium` (2)
github-actions[bot] Jun 13, 2024
d619005
Fix deletions
benjackwhite Jun 13, 2024
84b7681
Update UI snapshots for `chromium` (2)
github-actions[bot] Jun 13, 2024
47975de
Update UI snapshots for `chromium` (2)
github-actions[bot] Jun 13, 2024
160ecf1
Update query snapshots
github-actions[bot] Jun 13, 2024
22863be
merge
benjackwhite Jun 13, 2024
ccfc296
Merge branch 'feat/proper-templates' into fix/hog-fn-deletions
benjackwhite Jun 13, 2024
d0732dc
Update UI snapshots for `chromium` (2)
github-actions[bot] Jun 13, 2024
9c4fc5f
Update UI snapshots for `chromium` (2)
github-actions[bot] Jun 13, 2024
22f238d
Update UI snapshots for `chromium` (2)
github-actions[bot] Jun 13, 2024
ce7853c
Update UI snapshots for `chromium` (2)
github-actions[bot] Jun 13, 2024
0f273ba
Update UI snapshots for `chromium` (2)
github-actions[bot] Jun 13, 2024
78a63f1
Update UI snapshots for `chromium` (2)
github-actions[bot] Jun 13, 2024
d7db828
Started adding hubspot template
benjackwhite Jun 13, 2024
0a972f5
Merge branch 'master' into fix/hog-fn-deletions
benjackwhite Jun 13, 2024
2ff49ba
Merge branch 'master' into feat/more-templates
benjackwhite Jun 13, 2024
0176a21
Update UI snapshots for `chromium` (2)
github-actions[bot] Jun 13, 2024
c647495
Update UI snapshots for `chromium` (2)
github-actions[bot] Jun 13, 2024
1683670
Update UI snapshots for `chromium` (2)
github-actions[bot] Jun 13, 2024
185623d
Update UI snapshots for `chromium` (2)
github-actions[bot] Jun 13, 2024
144eab7
Update UI snapshots for `chromium` (2)
github-actions[bot] Jun 13, 2024
5fbb63c
Update UI snapshots for `chromium` (2)
github-actions[bot] Jun 13, 2024
a3ed769
Update UI snapshots for `chromium` (2)
github-actions[bot] Jun 13, 2024
f3cfa51
Update UI snapshots for `chromium` (2)
github-actions[bot] Jun 13, 2024
8c09ffe
fix
benjackwhite Jun 14, 2024
3c0b90a
Merge branch 'master' into fix/hog-fn-deletions
benjackwhite Jun 14, 2024
9bb8f1f
fix: JSON Config interactions (#22945)
benjackwhite Jun 14, 2024
75f211b
Merge branch 'fix/hog-fn-deletions' into feat/more-templates
benjackwhite Jun 14, 2024
2da2efc
Updates
benjackwhite Jun 14, 2024
2e756d7
Fixes
benjackwhite Jun 14, 2024
55894e5
Fixes
benjackwhite Jun 14, 2024
70f4344
Fixes
benjackwhite Jun 14, 2024
32d1bdb
Merge branch 'master' into feat/more-templates
benjackwhite Jun 14, 2024
b64c366
Fix
benjackwhite Jun 14, 2024
e47b110
Fix
benjackwhite Jun 14, 2024
731313e
Fixes
benjackwhite Jun 14, 2024
cee6345
Fix up hubspot template
benjackwhite Jun 14, 2024
6f132e7
Fix customer io
benjackwhite Jun 14, 2024
7cc935f
Fixes
benjackwhite Jun 14, 2024
6efc682
Tidy
benjackwhite Jun 14, 2024
dc90a61
Update UI snapshots for `chromium` (1)
github-actions[bot] Jun 14, 2024
014b75a
Update UI snapshots for `chromium` (2)
github-actions[bot] Jun 14, 2024
27079fe
Made abstract resizeable codeeditor
benjackwhite Jun 14, 2024
34a2a4e
Update UI snapshots for `chromium` (1)
github-actions[bot] Jun 14, 2024
26a52fa
Update UI snapshots for `chromium` (1)
github-actions[bot] Jun 14, 2024
b21ccad
Update UI snapshots for `chromium` (2)
github-actions[bot] Jun 14, 2024
b2420ff
Update UI snapshots for `chromium` (1)
github-actions[bot] Jun 14, 2024
db65eb3
Update UI snapshots for `chromium` (2)
github-actions[bot] Jun 14, 2024
421af36
Update UI snapshots for `chromium` (2)
github-actions[bot] Jun 14, 2024
e751ecf
Schema editing UX
benjackwhite Jun 14, 2024
f707d82
Added a bunch of controls
benjackwhite Jun 14, 2024
6f991fa
Merge branch 'feat/more-templates' of github.com:PostHog/posthog into…
benjackwhite Jun 14, 2024
febd30e
Fixes
benjackwhite Jun 14, 2024
0cd772b
Update UI snapshots for `chromium` (1)
github-actions[bot] Jun 14, 2024
68bc89d
Update UI snapshots for `chromium` (2)
github-actions[bot] Jun 14, 2024
2b98038
Update UI snapshots for `chromium` (1)
github-actions[bot] Jun 14, 2024
bcc0c30
Update UI snapshots for `chromium` (2)
github-actions[bot] Jun 14, 2024
b9a34db
Fixed up a bunch of stuff
benjackwhite Jun 14, 2024
90521af
More tweaks
benjackwhite Jun 14, 2024
711a1f3
Merge branch 'feat/more-templates' of github.com:PostHog/posthog into…
benjackwhite Jun 14, 2024
bd05191
Update UI snapshots for `chromium` (1)
github-actions[bot] Jun 14, 2024
b362463
Fix tests
benjackwhite Jun 14, 2024
41ada0b
Fix
benjackwhite Jun 17, 2024
3f9c26f
Fix
benjackwhite Jun 17, 2024
7fe5001
Merge branch 'master' into feat/more-templates
benjackwhite Jun 17, 2024
9e33ad2
Fixes
benjackwhite Jun 17, 2024
2576db8
Fix test
benjackwhite Jun 17, 2024
8a4f0d6
Fix customerio template
benjackwhite Jun 17, 2024
0149a0e
Update UI snapshots for `chromium` (1)
github-actions[bot] Jun 17, 2024
e37d48b
Update UI snapshots for `chromium` (2)
github-actions[bot] Jun 17, 2024
00d5a34
Update UI snapshots for `chromium` (1)
github-actions[bot] Jun 17, 2024
a77b6b3
Update UI snapshots for `chromium` (2)
github-actions[bot] Jun 17, 2024
84518c7
Fix up query
benjackwhite Jun 17, 2024
b107914
Added testing panel
benjackwhite Jun 17, 2024
6ff6ba9
Started adding test invocation
benjackwhite Jun 17, 2024
9f352cc
Fixes
benjackwhite Jun 17, 2024
8570bc0
Work done
benjackwhite Jun 17, 2024
ad03f89
Finish adding test info
benjackwhite Jun 17, 2024
9f9e2eb
merge
benjackwhite Jun 17, 2024
65305cf
Fixes
benjackwhite Jun 17, 2024
f29df05
Update UI snapshots for `chromium` (1)
github-actions[bot] Jun 17, 2024
67bb8c1
Update UI snapshots for `chromium` (1)
github-actions[bot] Jun 17, 2024
9630314
Update UI snapshots for `chromium` (2)
github-actions[bot] Jun 17, 2024
54195a4
Fix
benjackwhite Jun 17, 2024
8368f47
Update UI snapshots for `chromium` (2)
github-actions[bot] Jun 17, 2024
65d9e36
Update UI snapshots for `chromium` (2)
github-actions[bot] Jun 17, 2024
1f29741
Update UI snapshots for `chromium` (2)
github-actions[bot] Jun 17, 2024
8240751
Fixed up
benjackwhite Jun 17, 2024
15ae37f
Merge branch 'feat/preview-testing' of github.com:PostHog/posthog int…
benjackwhite Jun 17, 2024
9b09249
Update UI snapshots for `chromium` (1)
github-actions[bot] Jun 17, 2024
6252072
Update UI snapshots for `chromium` (2)
github-actions[bot] Jun 17, 2024
318db1b
Update UI snapshots for `chromium` (1)
github-actions[bot] Jun 17, 2024
37b07a6
Update UI snapshots for `chromium` (1)
github-actions[bot] Jun 17, 2024
e80b43c
Update UI snapshots for `chromium` (2)
github-actions[bot] Jun 17, 2024
408266c
Update UI snapshots for `chromium` (1)
github-actions[bot] Jun 17, 2024
9315d6b
Update UI snapshots for `chromium` (2)
github-actions[bot] Jun 17, 2024
fb532ac
Update UI snapshots for `chromium` (1)
github-actions[bot] Jun 17, 2024
ec9ef51
Update UI snapshots for `chromium` (2)
github-actions[bot] Jun 17, 2024
8f9b3d6
Update UI snapshots for `chromium` (1)
github-actions[bot] Jun 17, 2024
41b892b
Update UI snapshots for `chromium` (1)
github-actions[bot] Jun 17, 2024
5856021
Fixes
benjackwhite Jun 18, 2024
1256c0c
Fixes
benjackwhite Jun 18, 2024
f3302eb
Update UI snapshots for `chromium` (1)
github-actions[bot] Jun 18, 2024
f9e9798
Added testing toggle
benjackwhite Jun 18, 2024
f9e0463
Update UI snapshots for `chromium` (2)
github-actions[bot] Jun 18, 2024
c450172
Fix
benjackwhite Jun 18, 2024
1fe25dc
Merge branch 'feat/preview-testing' of github.com:PostHog/posthog int…
benjackwhite Jun 18, 2024
c514cc6
Fix?
benjackwhite Jun 18, 2024
fd034bb
Fix tests
benjackwhite Jun 18, 2024
48d1509
Update UI snapshots for `chromium` (1)
github-actions[bot] Jun 18, 2024
162efb8
Fix up calls
benjackwhite Jun 18, 2024
0149f82
Added better logging
benjackwhite Jun 18, 2024
952e0f5
Merge branch 'feat/preview-testing' of github.com:PostHog/posthog int…
benjackwhite Jun 18, 2024
0774ea8
Merge branch 'master' into feat/preview-testing
benjackwhite Jun 18, 2024
5c389cf
Update UI snapshots for `chromium` (2)
github-actions[bot] Jun 18, 2024
e23a9db
Update UI snapshots for `chromium` (2)
github-actions[bot] Jun 18, 2024
f27ba8f
Updated hogvm
benjackwhite Jun 18, 2024
48c6d21
Fix error checking
benjackwhite Jun 18, 2024
8397491
Fixes
benjackwhite Jun 18, 2024
2504fc6
Moved things around
benjackwhite Jun 18, 2024
ca41a32
Merge branch 'master' into feat/preview-testing
benjackwhite Jun 18, 2024
df6ebb8
Update UI snapshots for `chromium` (1)
github-actions[bot] Jun 18, 2024
e166934
Fixes
benjackwhite Jun 18, 2024
64b9cfe
Fixes
benjackwhite Jun 18, 2024
9d3348f
Merge branch 'feat/preview-testing' of github.com:PostHog/posthog int…
benjackwhite Jun 18, 2024
af25948
Update UI snapshots for `chromium` (1)
github-actions[bot] Jun 18, 2024
823765b
Update UI snapshots for `chromium` (2)
github-actions[bot] Jun 18, 2024
2b9dc25
Update UI snapshots for `chromium` (1)
github-actions[bot] Jun 18, 2024
4b6b2bc
Update UI snapshots for `chromium` (2)
github-actions[bot] Jun 18, 2024
30b86fc
Update UI snapshots for `chromium` (1)
github-actions[bot] Jun 18, 2024
cbd723a
Fixes
benjackwhite Jun 18, 2024
405aa8d
Merge branch 'feat/preview-testing' of github.com:PostHog/posthog int…
benjackwhite Jun 18, 2024
b380658
Bunch of refactoring
benjackwhite Jun 18, 2024
f84a6cb
Fix sanitization
benjackwhite Jun 18, 2024
f251a65
Add more logs
benjackwhite Jun 18, 2024
b4757a7
Fixes
benjackwhite Jun 18, 2024
f05da96
Update UI snapshots for `chromium` (1)
github-actions[bot] Jun 18, 2024
1c8ae00
Fix
benjackwhite Jun 18, 2024
1282b1f
Fix
benjackwhite Jun 18, 2024
6894818
Merge branch 'feat/preview-testing' of github.com:PostHog/posthog int…
benjackwhite Jun 18, 2024
5d24e24
Fix
benjackwhite Jun 18, 2024
800b868
Fix
benjackwhite Jun 18, 2024
2db469f
Fix
benjackwhite Jun 18, 2024
8e7224e
Fixes
benjackwhite Jun 18, 2024
fd47229
Update UI snapshots for `chromium` (1)
github-actions[bot] Jun 18, 2024
63baf87
Fixes
benjackwhite Jun 18, 2024
c27ef1c
Merge branch 'feat/preview-testing' of github.com:PostHog/posthog int…
benjackwhite Jun 18, 2024
51509a6
Fix
benjackwhite Jun 18, 2024
fd1dd0c
Fix
benjackwhite Jun 18, 2024
600903e
Fixes
benjackwhite Jun 18, 2024
3e38449
Update UI snapshots for `chromium` (1)
github-actions[bot] Jun 18, 2024
39b8ee9
Merge branch 'master' into feat/preview-testing
benjackwhite Jun 18, 2024
159cf37
Update UI snapshots for `chromium` (1)
github-actions[bot] Jun 18, 2024
d540710
Update query snapshots
github-actions[bot] Jun 18, 2024
65bd0cb
Update UI snapshots for `chromium` (2)
github-actions[bot] Jun 18, 2024
15a4c74
Update UI snapshots for `chromium` (2)
github-actions[bot] Jun 18, 2024
f8f8819
Fixes
benjackwhite Jun 18, 2024
01f965d
Merge branch 'feat/preview-testing' of github.com:PostHog/posthog int…
benjackwhite Jun 18, 2024
afc068e
Fix
benjackwhite Jun 18, 2024
8c3e737
Update UI snapshots for `chromium` (1)
github-actions[bot] Jun 18, 2024
6c9ecba
Update UI snapshots for `chromium` (2)
github-actions[bot] Jun 18, 2024
380d2f6
Update UI snapshots for `chromium` (1)
github-actions[bot] Jun 18, 2024
084875e
Update UI snapshots for `chromium` (2)
github-actions[bot] Jun 18, 2024
3132ecd
Update UI snapshots for `chromium` (2)
github-actions[bot] Jun 18, 2024
3ab8291
Update UI snapshots for `chromium` (1)
github-actions[bot] Jun 18, 2024
1a88deb
Update UI snapshots for `chromium` (2)
github-actions[bot] Jun 18, 2024
c4df05c
Fix
benjackwhite Jun 19, 2024
f9f0d08
Update UI snapshots for `chromium` (1)
github-actions[bot] Jun 19, 2024
1d0d641
Update UI snapshots for `chromium` (2)
github-actions[bot] Jun 19, 2024
9d54792
Update UI snapshots for `chromium` (1)
github-actions[bot] Jun 19, 2024
5fd81c2
Update UI snapshots for `chromium` (1)
github-actions[bot] Jun 19, 2024
92dd72c
Update UI snapshots for `chromium` (2)
github-actions[bot] Jun 19, 2024
036289f
Update UI snapshots for `chromium` (2)
github-actions[bot] Jun 19, 2024
e5726d1
Update UI snapshots for `chromium` (2)
github-actions[bot] Jun 19, 2024
ad8b73e
Update UI snapshots for `chromium` (2)
github-actions[bot] Jun 19, 2024
dff51a1
Update UI snapshots for `chromium` (1)
github-actions[bot] Jun 19, 2024
a63d61c
Update UI snapshots for `chromium` (2)
github-actions[bot] Jun 19, 2024
0d66df6
Update UI snapshots for `chromium` (1)
github-actions[bot] Jun 19, 2024
b8e2da3
Update UI snapshots for `chromium` (2)
github-actions[bot] Jun 19, 2024
b0c4b88
Update UI snapshots for `chromium` (1)
github-actions[bot] Jun 19, 2024
ed8129b
Update UI snapshots for `chromium` (2)
github-actions[bot] Jun 19, 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.
13 changes: 12 additions & 1 deletion frontend/src/lib/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import { ActivityLogItem } from 'lib/components/ActivityLog/humanizeActivity'
import { apiStatusLogic } from 'lib/logic/apiStatusLogic'
import { objectClean, toParams } from 'lib/utils'
import posthog from 'posthog-js'
import { LogEntry } from 'scenes/pipeline/pipelineNodeLogsLogic'
import { SavedSessionRecordingPlaylistsResult } from 'scenes/session-recordings/saved-playlists/savedSessionRecordingPlaylistsLogic'

import { getCurrentExporterData } from '~/exporter/exporterViewLogic'
Expand Down Expand Up @@ -50,6 +49,7 @@ import {
InsightModel,
IntegrationType,
ListOrganizationMembersParams,
LogEntry,
MediaUploadResponse,
NewEarlyAccessFeatureType,
NotebookListItemType,
Expand Down Expand Up @@ -1685,6 +1685,17 @@ const api = {
async listIcons(params: { query?: string } = {}): Promise<HogFunctionIconResponse[]> {
return await new ApiRequest().hogFunctions().withAction('icons').withQueryString(params).get()
},

async createTestInvocation(
id: HogFunctionType['id'],
data: {
configuration: Partial<HogFunctionType>
mock_async_functions: boolean
event: any
}
): Promise<any> {
return await new ApiRequest().hogFunction(id).withAction('invocations').create({ data })
},
},

annotations: {
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/lib/components/CodeEditors.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ export function CodeEditor({ options, onMount, ...editorProps }: CodeEditorProps
}

export function CodeEditorResizeable({
height: defaultHeight = 200,
height: defaultHeight,
minHeight = '5rem',
maxHeight = '90vh',
...props
Expand All @@ -84,7 +84,7 @@ export function CodeEditorResizeable({
maxHeight?: string | number
}): JSX.Element {
const [height, setHeight] = useState(defaultHeight)
const [manualHeight, setManualHeight] = useState<number>()
const [manualHeight, setManualHeight] = useState<number | undefined>(defaultHeight)

const ref = useRef<HTMLDivElement | null>(null)

Expand Down
188 changes: 188 additions & 0 deletions frontend/src/scenes/pipeline/hogfunctions/HogFunctionTest.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,188 @@
import { TZLabel } from '@posthog/apps-common'
import { IconInfo, IconX } from '@posthog/icons'
import { LemonButton, LemonLabel, LemonSwitch, LemonTable, LemonTag, Tooltip } from '@posthog/lemon-ui'
import clsx from 'clsx'
import { useActions, useValues } from 'kea'
import { Form } from 'kea-forms'
import { CodeEditorResizeable } from 'lib/components/CodeEditors'
import { LemonField } from 'lib/lemon-ui/LemonField'

import { hogFunctionTestLogic, HogFunctionTestLogicProps } from './hogFunctionTestLogic'

const HogFunctionTestEditor = ({
value,
onChange,
}: {
value: string
onChange?: (value?: string) => void
}): JSX.Element => {
return (
<CodeEditorResizeable
language="json"
value={value}
height={300}
onChange={onChange}
options={{
lineNumbers: 'off',
minimap: {
enabled: false,
},
quickSuggestions: {
other: true,
strings: true,
},
suggest: {
showWords: false,
showFields: false,
showKeywords: false,
},
scrollbar: {
vertical: 'hidden',
verticalScrollbarSize: 0,
},
}}
/>
)
}

export function HogFunctionTestPlaceholder(): JSX.Element {
return (
<div className="border bg-accent-3000 rounded p-3 space-y-2">
<h2 className="flex-1 m-0">Testing</h2>
<p>Save your configuration to enable testing</p>
</div>
)
}

export function HogFunctionTest(props: HogFunctionTestLogicProps): JSX.Element {
const { isTestInvocationSubmitting, testResult, expanded } = useValues(hogFunctionTestLogic(props))
const { submitTestInvocation, setTestResult, toggleExpanded } = useActions(hogFunctionTestLogic(props))

return (
<Form logic={hogFunctionTestLogic} props={props} formKey="testInvocation" enableFormOnSubmit>
<div className={clsx('border bg-bg-light rounded p-3 space-y-2', expanded && 'min-h-120')}>
<div className="flex items-center gap-2 justify-end">
{!expanded ? (
<LemonButton className="flex-1" onClick={() => toggleExpanded()}>
<h2 className="m-0">Testing</h2>
</LemonButton>
) : (
<h2 className="flex-1 m-0">Testing</h2>
)}

{expanded && (
<>
{testResult ? (
<LemonButton
type="primary"
onClick={() => setTestResult(null)}
loading={isTestInvocationSubmitting}
>
Clear test result
</LemonButton>
) : (
<>
<LemonField name="mock_async_functions">
{({ value, onChange }) => (
<LemonSwitch
bordered
onChange={onChange}
checked={value}
label={
<Tooltip
title={
<>
When selected, async functions such as `fetch` will not
actually be called but instead will be mocked out with
the fetch content logged instead
</>
}
>
<span className="flex gap-2">
Mock out async functions
<IconInfo className="text-lg" />
</span>
</Tooltip>
}
/>
)}
</LemonField>
<LemonButton
type="primary"
onClick={submitTestInvocation}
loading={isTestInvocationSubmitting}
>
Test function
</LemonButton>
</>
)}

<LemonButton icon={<IconX />} onClick={() => toggleExpanded()} tooltip="Hide testing" />
</>
)}
</div>

{expanded && (
<>
{testResult ? (
<div className="space-y-2">
<div className="flex justify-between items-center">
<LemonLabel>Test invocation result </LemonLabel>
<LemonTag type={testResult.status === 'success' ? 'success' : 'danger'}>
{testResult.status}
</LemonTag>
</div>

<LemonTable
dataSource={testResult.logs ?? []}
columns={[
{
title: 'Timestamp',
key: 'timestamp',
dataIndex: 'timestamp',
render: (timestamp) => <TZLabel time={timestamp as string} />,
width: 0,
},
{
width: 100,
title: 'Level',
key: 'level',
dataIndex: 'level',
},
{
title: 'Message',
key: 'message',
dataIndex: 'message',
render: (message) => <code className="whitespace-pre-wrap">{message}</code>,
},
]}
className="ph-no-capture"
rowKey="timestamp"
pagination={{ pageSize: 200, hideOnSinglePage: true }}
/>
</div>
) : (
<div className="space-y-2">
<LemonField name="globals" label="Test invocation context">
{({ value, onChange }) => (
<>
<div className="flex items-start justify-end">
<p className="flex-1">
The globals object is the context in which your function will be
tested. It should contain all the data that your function will need
to run
</p>
</div>

<HogFunctionTestEditor value={value} onChange={onChange} />
</>
)}
</LemonField>
</div>
)}
</>
)}
</div>
</Form>
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import { EntityTypes } from '~/types'

import { HogFunctionIconEditable } from './HogFunctionIcon'
import { HogFunctionInputWithSchema } from './HogFunctionInputs'
import { HogFunctionTest, HogFunctionTestPlaceholder } from './HogFunctionTest'
import { pipelineHogFunctionConfigurationLogic } from './pipelineHogFunctionConfigurationLogic'

export function PipelineHogFunctionConfiguration({
Expand Down Expand Up @@ -343,6 +344,8 @@ export function PipelineHogFunctionConfiguration({
)}
</div>
</div>

{id ? <HogFunctionTest id={id} /> : <HogFunctionTestPlaceholder />}
<div className="flex gap-2 justify-end">{saveButtons}</div>
</div>
</div>
Expand Down
95 changes: 95 additions & 0 deletions frontend/src/scenes/pipeline/hogfunctions/hogFunctionTestLogic.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
import { lemonToast } from '@posthog/lemon-ui'
import { actions, afterMount, connect, kea, key, path, props, reducers } from 'kea'
import { forms } from 'kea-forms'
import api from 'lib/api'
import { tryJsonParse } from 'lib/utils'

import { LogEntry } from '~/types'

import type { hogFunctionTestLogicType } from './hogFunctionTestLogicType'
import { pipelineHogFunctionConfigurationLogic, sanitizeConfiguration } from './pipelineHogFunctionConfigurationLogic'
import { createExampleEvent } from './utils/event-conversion'

export interface HogFunctionTestLogicProps {
id: string
}

export type HogFunctionTestInvocationForm = {
globals: string // HogFunctionInvocationGlobals
mock_async_functions: boolean
}

export type HogFunctionTestInvocationResult = {
status: 'success' | 'error'
logs: LogEntry[]
}

export const hogFunctionTestLogic = kea<hogFunctionTestLogicType>([
props({} as HogFunctionTestLogicProps),
key((props) => props.id),
path((id) => ['scenes', 'pipeline', 'hogfunctions', 'hogFunctionTestLogic', id]),
connect((props: HogFunctionTestLogicProps) => ({
values: [pipelineHogFunctionConfigurationLogic({ id: props.id }), ['configuration', 'configurationHasErrors']],
actions: [pipelineHogFunctionConfigurationLogic({ id: props.id }), ['touchConfigurationField']],
})),
actions({
setTestResult: (result: HogFunctionTestInvocationResult | null) => ({ result }),
toggleExpanded: (expanded?: boolean) => ({ expanded }),
}),
reducers({
expanded: [
false as boolean,
{
toggleExpanded: (_, { expanded }) => (expanded === undefined ? !_ : expanded),
},
],

testResult: [
null as HogFunctionTestInvocationResult | null,
{
setTestResult: (_, { result }) => result,
},
],
}),
forms(({ props, actions, values }) => ({
testInvocation: {
defaults: {
mock_async_functions: true,
} as HogFunctionTestInvocationForm,
alwaysShowErrors: true,
errors: ({ globals }) => {
return {
globals: !globals ? 'Required' : tryJsonParse(globals) ? undefined : 'Invalid JSON',
}
},
submit: async (data) => {
// Submit the test invocation
// Set the response somewhere

if (values.configurationHasErrors) {
lemonToast.error('Please fix the configuration errors before testing.')
// TODO: How to get the form to show errors without submitting?
return
}

const event = tryJsonParse(data.globals)
const configuration = sanitizeConfiguration(values.configuration)

try {
const res = await api.hogFunctions.createTestInvocation(props.id, {
event,
mock_async_functions: data.mock_async_functions,
configuration,
})

actions.setTestResult(res)
} catch (e) {
lemonToast.error(`An unexpected serror occurred while trying to testing the function. ${e}`)
}
},
},
})),
afterMount(({ actions }) => {
actions.setTestInvocationValue('globals', JSON.stringify(createExampleEvent(), null, 2))
}),
])
Loading
Loading