-
-
Notifications
You must be signed in to change notification settings - Fork 637
Expand file tree
/
Copy pathuserEventsTableColumns.jsx
More file actions
177 lines (170 loc) · 4.17 KB
/
userEventsTableColumns.jsx
File metadata and controls
177 lines (170 loc) · 4.17 KB
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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
/* eslint-disable react/prop-types */
import React from "react";
import { DefaultColumnFilter, DateHoverable } from "@certego/certego-ui";
import { LastEvaluationComponent } from "../common/engineBadges";
import { UserEventDecay } from "./UserEventDecay";
import TableCell from "../common/TableCell";
import TagsCell from "../common/TagsCell";
export const userEventsTableStartColumns = [
{
Header: () => "ID", // No header
id: "id",
accessor: "id",
maxWidth: 65,
disableSortBy: true,
Cell: ({ value: id }) => (
<div
className="d-flex flex-column justify-content-center py-2"
id={`user-report-${id}`}
>
#{id}
</div>
),
Filter: DefaultColumnFilter,
filterPlaceholder: "Search ID",
},
{
Header: "Date",
id: "date",
accessor: "data_model.date",
Cell: ({ value }) => (
<div className="py-2">
<DateHoverable ago value={value} format="hh:mm:ss a MMM do, yyyy" />
</div>
),
maxWidth: 100,
},
{
Header: "User",
id: "username",
accessor: "user",
Cell: ({ value, row }) => (
<TableCell
id={`table-cell-user__${row?.id}`}
isCopyToClipboard
isTruncate
value={value}
/>
),
disableSortBy: true,
Filter: DefaultColumnFilter,
maxWidth: 100,
},
];
export const userEventsTableEndColumns = [
{
Header: "Evaluation",
id: "evaluation",
accessor: (userEvent) => userEvent.data_model,
Cell: ({ value: dataModel, row }) =>
dataModel.evaluation ? (
<div className="d-flex justify-content-center py-2">
<LastEvaluationComponent
id={row.id}
reliability={dataModel.reliability}
evaluation={dataModel.evaluation}
/>
</div>
) : (
<div />
),
disableSortBy: true,
maxWidth: 100,
},
{
Header: "Decay",
id: "next_decay",
accessor: (userEvent) => userEvent,
Cell: ({ value: userEvent }) => (
<UserEventDecay
decay={userEvent.next_decay}
reliability={userEvent.data_model.reliability}
/>
),
maxWidth: 100,
},
{
Header: "Tags",
id: "tags",
accessor: (userEvent) => userEvent.data_model.tags,
Cell: ({ value: tags, row }) => <TagsCell values={tags} rowId={row.id} />,
disableSortBy: true,
maxWidth: 100,
},
{
Header: "Reasons",
id: "related_threats",
accessor: (userEvent) => userEvent.reason,
Cell: ({ value: comments, row }) =>
comments.length > 0 && (
<TableCell
id={`table-cell-related_threats__${row?.id}`}
isCopyToClipboard
isTruncate
value={comments?.toString()}
/>
),
disableSortBy: true,
maxWidth: 160,
},
];
export const userAnalyzableEventsTableColumns = [
...userEventsTableStartColumns,
{
Header: "Artifact",
id: "analyzable_name",
accessor: (userEvent) => userEvent?.analyzable?.name,
Cell: ({ value, row }) => (
<TableCell
id={`table-cell-analyzable__${row?.id}`}
isCopyToClipboard
isTruncate
value={value}
/>
),
disableSortBy: true,
Filter: DefaultColumnFilter,
maxWidth: 160,
},
...userEventsTableEndColumns,
];
export const userDomainWildcardEventsTableColumns = [
...userEventsTableStartColumns,
{
Header: "Query",
id: "analyzables_name",
accessor: (userEvent) => userEvent?.query,
Cell: ({ value, row }) => (
<TableCell
id={`table-cell-query__${row?.id}`}
isCopyToClipboard
isTruncate
value={value}
/>
),
disableSortBy: true,
Filter: DefaultColumnFilter,
maxWidth: 160,
},
...userEventsTableEndColumns,
];
export const userIpWildcardEventsTableColumns = [
...userEventsTableStartColumns,
{
Header: "Network",
id: "ip",
accessor: (userEvent) => userEvent,
Cell: ({ value, row }) => (
<TableCell
id={`table-cell-network__${row?.id}`}
isCopyToClipboard
isTruncate
value={`${value.start_ip} - ${value.end_ip}`}
/>
),
disableSortBy: true,
Filter: DefaultColumnFilter,
maxWidth: 140,
},
...userEventsTableEndColumns,
];