-
Notifications
You must be signed in to change notification settings - Fork 1.1k
/
ActionsTable.js
104 lines (101 loc) 路 3.72 KB
/
ActionsTable.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
import React from 'react'
import { Link } from 'lib/components/Link'
import { Table } from 'antd'
import { LinkButton } from 'lib/components/LinkButton'
import { DeleteWithUndo } from 'lib/utils'
import { useActions, useValues } from 'kea'
import { actionsModel } from '../../models/actionsModel'
export function ActionsTable() {
const { actions, actionsLoading } = useValues(actionsModel({ params: 'include_count=1' }))
const { loadActions } = useActions(actionsModel)
let columns = [
{
title: 'Action ID',
dataIndex: 'name',
key: 'name',
render: function RenderName(_, action) {
return <Link to={'/action/' + action.id}>{action.name}</Link>
},
},
{
title: 'Volume',
render: function RenderVolume(_, action) {
return <span>{action.count}</span>
},
},
{
title: 'Type',
render: function RenderType(_, action) {
return (
<span>
{action.steps.map(step => (
<div key={step.id}>
{(() => {
switch (step.event) {
case '$autocapture':
return 'Autocapture'
case '$pageview':
return 'URL matches ' + step.url
default:
return 'Event: ' + step.event
}
})()}
</div>
))}
</span>
)
},
},
{
title: 'Actions',
render: function RenderActions(action) {
return (
<span>
<Link to={'/action/' + action.id}>
<i className="fi flaticon-edit" />
</Link>
<DeleteWithUndo
endpoint="action"
object={action}
className="text-danger"
style={{ marginLeft: 8 }}
callback={loadActions}
>
<i className="fi flaticon-basket" />
</DeleteWithUndo>
</span>
)
},
},
]
return (
<div>
<h1>Actions</h1>
<p style={{ maxWidth: 600 }}>
<i>
Actions are PostHog鈥檚 way of easily cleaning up a large amount of Event data. Actions consist of one
or more events that you have decided to put into a manually-labelled bucket. They're used in
Funnels, Live actions and Trends.
<br />
<br />
<a href="https://posthog.com/docs/features/actions" target="_blank" rel="noopener noreferrer">
See documentation
</a>
</i>
</p>
<LinkButton to={'/action'} type="primary">
+ New Action
</LinkButton>
<br />
<br />
<Table
size="small"
columns={columns}
loading={actionsLoading}
rowKey={action => action.id}
pagination={{ pageSize: 100, hideOnSinglePage: true }}
dataSource={actions}
/>
</div>
)
}