diff --git a/x-pack/plugins/security_solution/public/common/components/event_details/__snapshots__/event_details.test.tsx.snap b/x-pack/plugins/security_solution/public/common/components/event_details/__snapshots__/event_details.test.tsx.snap
index ebaf60e7078f0..2ae621e71a725 100644
--- a/x-pack/plugins/security_solution/public/common/components/event_details/__snapshots__/event_details.test.tsx.snap
+++ b/x-pack/plugins/security_solution/public/common/components/event_details/__snapshots__/event_details.test.tsx.snap
@@ -4,33 +4,6 @@ exports[`EventDetails rendering should match snapshot 1`] = `
-
-
-
-
- }
- closePopover={[Function]}
- display="inlineBlock"
- hasArrow={true}
- isOpen={false}
- ownFocus={false}
- panelPaddingSize="m"
- repositionOnScroll={true}
- />
-
+
+ Collapse event
+
`;
diff --git a/x-pack/plugins/security_solution/public/common/components/event_details/event_details.test.tsx b/x-pack/plugins/security_solution/public/common/components/event_details/event_details.test.tsx
index a5b44fd540c4b..01b0810830dd8 100644
--- a/x-pack/plugins/security_solution/public/common/components/event_details/event_details.test.tsx
+++ b/x-pack/plugins/security_solution/public/common/components/event_details/event_details.test.tsx
@@ -11,7 +11,7 @@ import '../../mock/match_media';
import { mockDetailItemData, mockDetailItemDataId } from '../../mock/mock_detail_item';
import { TestProviders } from '../../mock/test_providers';
-import { EventDetails } from './event_details';
+import { EventDetails, View } from './event_details';
import { mockBrowserFields } from '../../containers/source/mock';
import { defaultHeaders } from '../../mock/header';
import { useMountAppended } from '../../utils/use_mount_appended';
@@ -20,47 +20,35 @@ jest.mock('../link_to');
describe('EventDetails', () => {
const mount = useMountAppended();
+ const onEventToggled = jest.fn();
+ const defaultProps = {
+ browserFields: mockBrowserFields,
+ columnHeaders: defaultHeaders,
+ data: mockDetailItemData,
+ id: mockDetailItemDataId,
+ view: 'table-view' as View,
+ onEventToggled,
+ onUpdateColumns: jest.fn(),
+ onViewSelected: jest.fn(),
+ timelineId: 'test',
+ toggleColumn: jest.fn(),
+ };
+ const wrapper = mount(
+
+
+
+ );
describe('rendering', () => {
test('should match snapshot', () => {
- const wrapper = shallow(
-
- );
- expect(wrapper).toMatchSnapshot();
+ const shallowWrap = shallow();
+ expect(shallowWrap).toMatchSnapshot();
});
});
describe('tabs', () => {
['Table', 'JSON View'].forEach((tab) => {
test(`it renders the ${tab} tab`, () => {
- const wrapper = mount(
-
-
-
- );
-
expect(
wrapper
.find('[data-test-subj="eventDetails"]')
@@ -71,48 +59,12 @@ describe('EventDetails', () => {
});
test('the Table tab is selected by default', () => {
- const wrapper = mount(
-
-
-
- );
-
expect(
wrapper.find('[data-test-subj="eventDetails"]').find('.euiTab-isSelected').first().text()
).toEqual('Table');
});
test('it invokes `onEventToggled` when the collapse button is clicked', () => {
- const onEventToggled = jest.fn();
-
- const wrapper = mount(
-
-
-
- );
-
wrapper.find('[data-test-subj="collapse"]').first().simulate('click');
wrapper.update();
diff --git a/x-pack/plugins/security_solution/public/common/components/event_details/event_details.tsx b/x-pack/plugins/security_solution/public/common/components/event_details/event_details.tsx
index 53ec14380d5bc..1cc50b7d951a2 100644
--- a/x-pack/plugins/security_solution/public/common/components/event_details/event_details.tsx
+++ b/x-pack/plugins/security_solution/public/common/components/event_details/event_details.tsx
@@ -4,14 +4,7 @@
* you may not use this file except in compliance with the Elastic License.
*/
-import { noop } from 'lodash/fp';
-import {
- EuiButtonIcon,
- EuiPopover,
- EuiTabbedContent,
- EuiTabbedContentTab,
- EuiToolTip,
-} from '@elastic/eui';
+import { EuiLink, EuiTabbedContent, EuiTabbedContentTab } from '@elastic/eui';
import React, { useMemo } from 'react';
import styled from 'styled-components';
@@ -26,22 +19,11 @@ import { COLLAPSE, COLLAPSE_EVENT } from '../../../timelines/components/timeline
export type View = 'table-view' | 'json-view';
-const PopoverContainer = styled.div`
- left: -40px;
- position: relative;
- top: 10px;
-
- .euiPopover {
- position: fixed;
- z-index: 10;
- }
+const CollapseLink = styled(EuiLink)`
+ margin: 20px 0;
`;
-const CollapseButton = styled(EuiButtonIcon)`
- border: 1px solid;
-`;
-
-CollapseButton.displayName = 'CollapseButton';
+CollapseLink.displayName = 'CollapseLink';
interface Props {
browserFields: BrowserFields;
@@ -75,59 +57,42 @@ export const EventDetails = React.memo(
timelineId,
toggleColumn,
}) => {
- const button = useMemo(
- () => (
-
-
-
- ),
- [onEventToggled]
+ const tabs: EuiTabbedContentTab[] = useMemo(
+ () => [
+ {
+ id: 'table-view',
+ name: i18n.TABLE,
+ content: (
+
+ ),
+ },
+ {
+ id: 'json-view',
+ name: i18n.JSON_VIEW,
+ content: ,
+ },
+ ],
+ [browserFields, columnHeaders, data, id, onUpdateColumns, timelineId, toggleColumn]
);
- const tabs: EuiTabbedContentTab[] = [
- {
- id: 'table-view',
- name: i18n.TABLE,
- content: (
-
- ),
- },
- {
- id: 'json-view',
- name: i18n.JSON_VIEW,
- content: ,
- },
- ];
-
return (
-
-
-
onViewSelected(e.id as View)}
/>
+
+ {COLLAPSE_EVENT}
+
);
}