forked from elastic/kibana
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Security Solution] Refactor Timeline flyout to take a full page (ela…
- Loading branch information
1 parent
e1a07c4
commit 5ee6233
Showing
49 changed files
with
618 additions
and
832 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 0 additions & 7 deletions
7
...solution/public/common/components/event_details/__snapshots__/event_details.test.tsx.snap
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
82 changes: 82 additions & 0 deletions
82
...plugins/security_solution/public/common/components/events_viewer/event_details_flyout.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
import { EuiFlyout, EuiFlyoutBody, EuiFlyoutHeader } from '@elastic/eui'; | ||
import React, { useCallback } from 'react'; | ||
import styled from 'styled-components'; | ||
import deepEqual from 'fast-deep-equal'; | ||
import { useDispatch } from 'react-redux'; | ||
|
||
import { ColumnHeaderOptions } from '../../../timelines/store/timeline/model'; | ||
import { timelineActions } from '../../../timelines/store/timeline'; | ||
import { BrowserFields, DocValueFields } from '../../containers/source'; | ||
import { | ||
ExpandableEvent, | ||
ExpandableEventTitle, | ||
} from '../../../timelines/components/timeline/expandable_event'; | ||
import { useDeepEqualSelector } from '../../hooks/use_selector'; | ||
|
||
const StyledEuiFlyout = styled(EuiFlyout)` | ||
z-index: 9999; | ||
`; | ||
|
||
interface EventDetailsFlyoutProps { | ||
browserFields: BrowserFields; | ||
docValueFields: DocValueFields[]; | ||
timelineId: string; | ||
toggleColumn: (column: ColumnHeaderOptions) => void; | ||
} | ||
|
||
const EventDetailsFlyoutComponent: React.FC<EventDetailsFlyoutProps> = ({ | ||
browserFields, | ||
docValueFields, | ||
timelineId, | ||
toggleColumn, | ||
}) => { | ||
const dispatch = useDispatch(); | ||
const expandedEvent = useDeepEqualSelector( | ||
(state) => state.timeline.timelineById[timelineId]?.expandedEvent ?? {} | ||
); | ||
|
||
const handleClearSelection = useCallback(() => { | ||
dispatch( | ||
timelineActions.toggleExpandedEvent({ | ||
timelineId, | ||
event: {}, | ||
}) | ||
); | ||
}, [dispatch, timelineId]); | ||
|
||
if (!expandedEvent.eventId) { | ||
return null; | ||
} | ||
|
||
return ( | ||
<StyledEuiFlyout size="s" onClose={handleClearSelection}> | ||
<EuiFlyoutHeader hasBorder> | ||
<ExpandableEventTitle /> | ||
</EuiFlyoutHeader> | ||
<EuiFlyoutBody> | ||
<ExpandableEvent | ||
browserFields={browserFields} | ||
docValueFields={docValueFields} | ||
event={expandedEvent} | ||
timelineId={timelineId} | ||
toggleColumn={toggleColumn} | ||
/> | ||
</EuiFlyoutBody> | ||
</StyledEuiFlyout> | ||
); | ||
}; | ||
|
||
export const EventDetailsFlyout = React.memo( | ||
EventDetailsFlyoutComponent, | ||
(prevProps, nextProps) => | ||
deepEqual(prevProps.browserFields, nextProps.browserFields) && | ||
deepEqual(prevProps.docValueFields, nextProps.docValueFields) && | ||
prevProps.timelineId === nextProps.timelineId && | ||
prevProps.toggleColumn === nextProps.toggleColumn | ||
); |
Oops, something went wrong.