-
Notifications
You must be signed in to change notification settings - Fork 8.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[SIEM] Adds actions and selection to Signals Table #53101
Merged
Merged
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
bc62b91
Adds actions and selection to Signals Table
spong 97eabcc
Merge branch 'master' of github.com:elastic/kibana into de-signals-ac…
spong 86e6fb6
Merge branch 'master' of github.com:elastic/kibana into de-signals-ac…
spong 98e61be
Moving back to default signals index and clarified todos
spong 2f70563
Merge branch 'master' of github.com:elastic/kibana into de-signals-ac…
spong 88765e4
Fixes from comments, hoists defaultFilters and to/from from SignalsTa…
spong c587651
Merge branch 'master' of github.com:elastic/kibana into de-signals-ac…
spong b1fec53
Reverting back to default signals constant
spong 681f002
Merge branch 'master' of github.com:elastic/kibana into de-signals-ac…
spong b540d32
Merge branch 'master' of github.com:elastic/kibana into de-signals-ac…
spong 8ed22de
Fixes from merge with alerts table
spong a3f2ca1
Fixing how filters prop is passed in events_viewer
spong 29cdb09
Removing unused import
spong File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,8 +5,8 @@ | |
*/ | ||
|
||
import { EuiPanel } from '@elastic/eui'; | ||
import { getOr, isEmpty, isEqual } from 'lodash/fp'; | ||
import React from 'react'; | ||
import { getOr, isEmpty, isEqual, union } from 'lodash/fp'; | ||
import React, { useMemo } from 'react'; | ||
import styled from 'styled-components'; | ||
|
||
import { BrowserFields } from '../../containers/source'; | ||
|
@@ -46,6 +46,7 @@ interface Props { | |
browserFields: BrowserFields; | ||
columns: ColumnHeader[]; | ||
dataProviders: DataProvider[]; | ||
deletedEventIds: Readonly<string[]>; | ||
end: number; | ||
filters: esFilters.Filter[]; | ||
headerFilterGroup?: React.ReactNode; | ||
|
@@ -71,6 +72,7 @@ export const EventsViewer = React.memo<Props>( | |
browserFields, | ||
columns, | ||
dataProviders, | ||
deletedEventIds, | ||
end, | ||
filters, | ||
headerFilterGroup, | ||
|
@@ -104,6 +106,14 @@ export const EventsViewer = React.memo<Props>( | |
end, | ||
isEventViewer: true, | ||
}); | ||
const queryFields = useMemo( | ||
() => | ||
union( | ||
columnsHeader.map(c => c.id), | ||
timelineTypeContext.queryFields ?? [] | ||
), | ||
[columnsHeader, timelineTypeContext.queryFields] | ||
); | ||
|
||
return ( | ||
<EuiPanel data-test-subj="events-viewer-panel" grow={false}> | ||
|
@@ -119,7 +129,7 @@ export const EventsViewer = React.memo<Props>( | |
|
||
{combinedQueries != null ? ( | ||
<TimelineQuery | ||
fields={columnsHeader.map(c => c.id)} | ||
fields={queryFields} | ||
filterQuery={combinedQueries.filterQuery} | ||
id={id} | ||
indexPattern={indexPattern} | ||
|
@@ -139,73 +149,81 @@ export const EventsViewer = React.memo<Props>( | |
pageInfo, | ||
refetch, | ||
totalCount = 0, | ||
}) => ( | ||
<> | ||
<HeaderSection | ||
id={id} | ||
showInspect={showInspect} | ||
subtitle={ | ||
utilityBar | ||
? undefined | ||
: `${i18n.SHOWING}: ${totalCount.toLocaleString()} ${i18n.UNIT( | ||
totalCount | ||
)}` | ||
} | ||
title={timelineTypeContext?.title ?? i18n.EVENTS} | ||
> | ||
{headerFilterGroup} | ||
</HeaderSection> | ||
}) => { | ||
const totalCountMinusDeleted = | ||
totalCount > 0 ? totalCount - deletedEventIds.length : 0; | ||
|
||
// TODO: Reset eventDeletedIds/eventLoadingIds on refresh/loadmore (getUpdatedAt) | ||
return ( | ||
<> | ||
<HeaderSection | ||
id={id} | ||
showInspect={showInspect} | ||
subtitle={ | ||
utilityBar | ||
? undefined | ||
: `${ | ||
i18n.SHOWING | ||
}: ${totalCountMinusDeleted.toLocaleString()} ${i18n.UNIT( | ||
totalCountMinusDeleted | ||
)}` | ||
} | ||
title={timelineTypeContext?.title ?? i18n.EVENTS} | ||
> | ||
{headerFilterGroup} | ||
</HeaderSection> | ||
|
||
{utilityBar?.(totalCount)} | ||
{utilityBar?.(totalCountMinusDeleted)} | ||
|
||
<div | ||
data-test-subj={`events-container-loading-${loading}`} | ||
style={{ width: `${width}px` }} | ||
> | ||
<ManageTimelineContext | ||
loading={loading} | ||
width={width} | ||
type={timelineTypeContext} | ||
<div | ||
data-test-subj={`events-container-loading-${loading}`} | ||
style={{ width: `${width}px` }} | ||
> | ||
<TimelineRefetch | ||
id={id} | ||
inputId="global" | ||
inspect={inspect} | ||
<ManageTimelineContext | ||
loading={loading} | ||
refetch={refetch} | ||
/> | ||
width={width} | ||
type={timelineTypeContext} | ||
> | ||
<TimelineRefetch | ||
id={id} | ||
inputId="global" | ||
inspect={inspect} | ||
loading={loading} | ||
refetch={refetch} | ||
/> | ||
|
||
<StatefulBody | ||
browserFields={browserFields} | ||
data={events} | ||
id={id} | ||
isEventViewer={true} | ||
height={height} | ||
sort={sort} | ||
toggleColumn={toggleColumn} | ||
/> | ||
<StatefulBody | ||
browserFields={browserFields} | ||
data={events.filter(e => !deletedEventIds.includes(e._id))} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I really do think that TimelineQuery need to take care of that because that will cause re-rendering |
||
id={id} | ||
isEventViewer={true} | ||
height={height} | ||
sort={sort} | ||
toggleColumn={toggleColumn} | ||
/> | ||
|
||
<Footer | ||
compact={isCompactFooter(width)} | ||
getUpdatedAt={getUpdatedAt} | ||
hasNextPage={getOr(false, 'hasNextPage', pageInfo)!} | ||
height={footerHeight} | ||
isEventViewer={true} | ||
isLive={isLive} | ||
isLoading={loading} | ||
itemsCount={events.length} | ||
itemsPerPage={itemsPerPage} | ||
itemsPerPageOptions={itemsPerPageOptions} | ||
onChangeItemsPerPage={onChangeItemsPerPage} | ||
onLoadMore={loadMore} | ||
nextCursor={getOr(null, 'endCursor.value', pageInfo)!} | ||
serverSideEventCount={totalCount} | ||
tieBreaker={getOr(null, 'endCursor.tiebreaker', pageInfo)} | ||
/> | ||
</ManageTimelineContext> | ||
</div> | ||
</> | ||
)} | ||
<Footer | ||
compact={isCompactFooter(width)} | ||
getUpdatedAt={getUpdatedAt} | ||
hasNextPage={getOr(false, 'hasNextPage', pageInfo)!} | ||
height={footerHeight} | ||
isEventViewer={true} | ||
isLive={isLive} | ||
isLoading={loading} | ||
itemsCount={events.length} | ||
itemsPerPage={itemsPerPage} | ||
itemsPerPageOptions={itemsPerPageOptions} | ||
onChangeItemsPerPage={onChangeItemsPerPage} | ||
onLoadMore={loadMore} | ||
nextCursor={getOr(null, 'endCursor.value', pageInfo)!} | ||
serverSideEventCount={totalCountMinusDeleted} | ||
tieBreaker={getOr(null, 'endCursor.tiebreaker', pageInfo)} | ||
/> | ||
</ManageTimelineContext> | ||
</div> | ||
</> | ||
); | ||
}} | ||
</TimelineQuery> | ||
) : null} | ||
</> | ||
|
@@ -218,6 +236,7 @@ export const EventsViewer = React.memo<Props>( | |
prevProps.browserFields === nextProps.browserFields && | ||
prevProps.columns === nextProps.columns && | ||
prevProps.dataProviders === nextProps.dataProviders && | ||
prevProps.deletedEventIds === nextProps.deletedEventIds && | ||
prevProps.end === nextProps.end && | ||
isEqual(prevProps.filters, nextProps.filters) && | ||
prevProps.height === nextProps.height && | ||
|
@@ -230,6 +249,8 @@ export const EventsViewer = React.memo<Props>( | |
isEqual(prevProps.query, nextProps.query) && | ||
prevProps.showInspect === nextProps.showInspect && | ||
prevProps.start === nextProps.start && | ||
prevProps.sort === nextProps.sort | ||
prevProps.sort === nextProps.sort && | ||
isEqual(prevProps.timelineTypeContext, nextProps.timelineTypeContext) && | ||
prevProps.utilityBar === nextProps.utilityBar | ||
); | ||
EventsViewer.displayName = 'EventsViewer'; |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe TimelineQuery can take care of that if you passed the parameter and default it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perfect! I was hesitant to move that logic into
TimelineQuery
and wanted to chat with you first -- this will work out well.