6
6
*/
7
7
8
8
import React , { useMemo , useCallback , memo } from 'react' ;
9
- import type { EuiDataGridSorting , EuiDataGridSchemaDetector } from '@elastic/eui' ;
10
- import { EuiButtonIcon , EuiToolTip , useDataGridColumnSorting , EuiCheckbox } from '@elastic/eui' ;
9
+ import { EuiButtonIcon , EuiToolTip , EuiCheckbox } from '@elastic/eui' ;
11
10
import { useDispatch } from 'react-redux' ;
12
11
13
12
import styled from 'styled-components' ;
14
- import type { HeaderActionProps , SortDirection } from '../../../../common/types' ;
15
- import { TimelineTabs , TimelineId } from '../../../../common/types' ;
13
+ import type { HeaderActionProps } from '../../../../common/types' ;
14
+ import { TimelineId } from '../../../../common/types' ;
16
15
import { isFullScreen } from '../../../timelines/components/timeline/body/column_headers' ;
17
16
import { isActiveTimeline } from '../../../helpers' ;
18
17
import { getColumnHeader } from '../../../timelines/components/timeline/body/column_headers/helpers' ;
@@ -21,28 +20,12 @@ import { useGlobalFullScreen, useTimelineFullScreen } from '../../containers/use
21
20
import { useKibana } from '../../lib/kibana' ;
22
21
import { DEFAULT_ACTION_BUTTON_WIDTH } from '.' ;
23
22
import { EventsTh , EventsThContent } from '../../../timelines/components/timeline/styles' ;
24
- import { StatefulRowRenderersBrowser } from '../../../timelines/components/row_renderers_browser' ;
25
23
import { EXIT_FULL_SCREEN } from '../exit_full_screen/translations' ;
26
24
import { EventsSelect } from '../../../timelines/components/timeline/body/column_headers/events_select' ;
27
25
import * as i18n from './translations' ;
28
- import { useIsExperimentalFeatureEnabled } from '../../hooks/use_experimental_features' ;
29
26
import { useDeepEqualSelector } from '../../hooks/use_selector' ;
30
27
import { selectTimelineById } from '../../../timelines/store/selectors' ;
31
28
32
- const SortingColumnsContainer = styled . div `
33
- button {
34
- color: ${ ( { theme } ) => theme . eui . euiColorPrimary } ;
35
- }
36
-
37
- .euiPopover .euiButtonEmpty {
38
- padding: 0;
39
-
40
- .euiButtonEmpty__text {
41
- display: none;
42
- }
43
- }
44
- ` ;
45
-
46
29
const FieldBrowserContainer = styled . div `
47
30
.euiToolTipAnchor {
48
31
.euiButtonContent {
@@ -66,23 +49,15 @@ const ActionsContainer = styled.div`
66
49
display: flex;
67
50
` ;
68
51
69
- // Defined statically to reduce rerenders
70
- const emptySchema = { } ;
71
- const emptySchemaDetectors : EuiDataGridSchemaDetector [ ] = [ ] ;
72
-
73
52
const HeaderActionsComponent : React . FC < HeaderActionProps > = memo (
74
53
( {
75
- width,
76
54
browserFields,
77
55
columnHeaders,
78
- isEventViewer = false ,
79
56
isSelectAllChecked,
80
57
onSelectAll,
81
58
showEventsSelect,
82
59
showSelectAllCheckbox,
83
60
showFullScreenToggle = true ,
84
- sort,
85
- tabType,
86
61
timelineId,
87
62
fieldBrowserOptions,
88
63
} ) => {
@@ -91,10 +66,6 @@ const HeaderActionsComponent: React.FC<HeaderActionProps> = memo(
91
66
const { timelineFullScreen, setTimelineFullScreen } = useTimelineFullScreen ( ) ;
92
67
const dispatch = useDispatch ( ) ;
93
68
94
- const unifiedComponentsInTimelineDisabled = useIsExperimentalFeatureEnabled (
95
- 'unifiedComponentsInTimelineDisabled'
96
- ) ;
97
-
98
69
const { defaultColumns } = useDeepEqualSelector ( ( state ) =>
99
70
selectTimelineById ( state , timelineId )
100
71
) ;
@@ -129,57 +100,6 @@ const HeaderActionsComponent: React.FC<HeaderActionProps> = memo(
129
100
[ onSelectAll ]
130
101
) ;
131
102
132
- const onSortColumns = useCallback (
133
- ( cols : EuiDataGridSorting [ 'columns' ] ) =>
134
- dispatch (
135
- timelineActions . updateSort ( {
136
- id : timelineId ,
137
- sort : cols . map ( ( { id, direction } ) => {
138
- const columnHeader = columnHeaders . find ( ( ch ) => ch . id === id ) ;
139
- const columnType = columnHeader ?. type ?? '' ;
140
- const esTypes = columnHeader ?. esTypes ?? [ ] ;
141
-
142
- return {
143
- columnId : id ,
144
- columnType,
145
- esTypes,
146
- sortDirection : direction as SortDirection ,
147
- } ;
148
- } ) ,
149
- } )
150
- ) ,
151
- [ columnHeaders , dispatch , timelineId ]
152
- ) ;
153
-
154
- const sortedColumns = useMemo (
155
- ( ) => ( {
156
- onSort : onSortColumns ,
157
- columns :
158
- sort ?. map < { id : string ; direction : 'asc' | 'desc' } > ( ( { columnId, sortDirection } ) => ( {
159
- id : columnId ,
160
- direction : sortDirection as 'asc' | 'desc' ,
161
- } ) ) ?? [ ] ,
162
- } ) ,
163
- [ onSortColumns , sort ]
164
- ) ;
165
- const displayValues = useMemo (
166
- ( ) =>
167
- columnHeaders ?. reduce ( ( acc , ch ) => ( { ...acc , [ ch . id ] : ch . displayAsText ?? ch . id } ) , { } ) ??
168
- { } ,
169
- [ columnHeaders ]
170
- ) ;
171
-
172
- const myColumns = useMemo (
173
- ( ) =>
174
- columnHeaders ?. map ( ( { aggregatable, displayAsText, id, type } ) => ( {
175
- id,
176
- isSortable : aggregatable ,
177
- displayAsText,
178
- schema : type ,
179
- } ) ) ?? [ ] ,
180
- [ columnHeaders ]
181
- ) ;
182
-
183
103
const onResetColumns = useCallback ( ( ) => {
184
104
dispatch ( timelineActions . updateColumns ( { id : timelineId , columns : defaultColumns } ) ) ;
185
105
} , [ defaultColumns , dispatch , timelineId ] ) ;
@@ -206,14 +126,6 @@ const HeaderActionsComponent: React.FC<HeaderActionProps> = memo(
206
126
[ columnHeaders , dispatch , timelineId , defaultColumns ]
207
127
) ;
208
128
209
- const ColumnSorting = useDataGridColumnSorting ( {
210
- columns : myColumns ,
211
- sorting : sortedColumns ,
212
- schema : emptySchema ,
213
- schemaDetectors : emptySchemaDetectors ,
214
- displayValues,
215
- } ) ;
216
-
217
129
return (
218
130
< ActionsContainer data-test-subj = "header-actions-container" >
219
131
{ showSelectAllCheckbox && (
@@ -242,11 +154,6 @@ const HeaderActionsComponent: React.FC<HeaderActionProps> = memo(
242
154
</ EventsTh >
243
155
) }
244
156
245
- { unifiedComponentsInTimelineDisabled && (
246
- < EventsTh role = "button" >
247
- < StatefulRowRenderersBrowser timelineId = { timelineId } />
248
- </ EventsTh >
249
- ) }
250
157
{ showFullScreenToggle && (
251
158
< EventsTh role = "button" >
252
159
< EventsThContent textAlign = "center" width = { DEFAULT_ACTION_BUTTON_WIDTH } >
@@ -275,15 +182,6 @@ const HeaderActionsComponent: React.FC<HeaderActionProps> = memo(
275
182
</ EventsThContent >
276
183
</ EventsTh >
277
184
) }
278
- { tabType !== TimelineTabs . eql && unifiedComponentsInTimelineDisabled && (
279
- < EventsTh role = "button" data-test-subj = "timeline-sorting-fields" >
280
- < EventsThContent textAlign = "center" width = { DEFAULT_ACTION_BUTTON_WIDTH } >
281
- < EuiToolTip content = { i18n . SORT_FIELDS } >
282
- < SortingColumnsContainer > { ColumnSorting } </ SortingColumnsContainer >
283
- </ EuiToolTip >
284
- </ EventsThContent >
285
- </ EventsTh >
286
- ) }
287
185
288
186
{ showEventsSelect && (
289
187
< EventsTh role = "button" >
0 commit comments