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] [Detection & Response] 131827 Update Detections R…
…esponse view with pagination and opening numbers in timeline (elastic#131828) * Fix alert colour pallete & alerts chart header size * Add pagination and navigation to timeline capability * fix translation name conflict * Rename hook file to snake case to match elastic formatting * Change name scheme oof navigateToTimeline to OpenInTimeline & remove styled components Co-authored-by: Kristof-Pierre Cummings <kristofpierre.cummings@elastic.co> Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
- Loading branch information
Showing
22 changed files
with
617 additions
and
338 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
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
76 changes: 76 additions & 0 deletions
76
...solution/public/overview/components/detection_response/hooks/use_navigate_to_timeline.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,76 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
import { useDispatch } from 'react-redux'; | ||
|
||
import { getDataProvider } from '../../../../common/components/event_details/table/use_action_cell_data_provider'; | ||
import { sourcererActions } from '../../../../common/store/sourcerer'; | ||
import { SourcererScopeName } from '../../../../common/store/sourcerer/model'; | ||
import { DataProvider, TimelineId, TimelineType } from '../../../../../common/types/timeline'; | ||
import { useCreateTimeline } from '../../../../timelines/components/timeline/properties/use_create_timeline'; | ||
import { updateProviders } from '../../../../timelines/store/timeline/actions'; | ||
|
||
export const useNavigateToTimeline = () => { | ||
const dispatch = useDispatch(); | ||
|
||
const clearTimeline = useCreateTimeline({ | ||
timelineId: TimelineId.active, | ||
timelineType: TimelineType.default, | ||
}); | ||
|
||
const navigateToTimeline = (dataProvider: DataProvider) => { | ||
// Reset the current timeline | ||
clearTimeline(); | ||
// Update the timeline's providers to match the current prevalence field query | ||
dispatch( | ||
updateProviders({ | ||
id: TimelineId.active, | ||
providers: [dataProvider], | ||
}) | ||
); | ||
// Only show detection alerts | ||
// (This is required so the timeline event count matches the prevalence count) | ||
dispatch( | ||
sourcererActions.setSelectedDataView({ | ||
id: SourcererScopeName.timeline, | ||
selectedDataViewId: 'security-solution-default', | ||
selectedPatterns: ['.alerts-security.alerts-default'], | ||
}) | ||
); | ||
}; | ||
|
||
const openHostInTimeline = ({ hostName, severity }: { hostName: string; severity?: string }) => { | ||
const dataProvider = getDataProvider('host.name', '', hostName); | ||
|
||
if (severity) { | ||
dataProvider.and.push(getDataProvider('kibana.alert.severity', '', severity)); | ||
} | ||
|
||
navigateToTimeline(dataProvider); | ||
}; | ||
|
||
const openUserInTimeline = ({ userName, severity }: { userName: string; severity?: string }) => { | ||
const dataProvider = getDataProvider('user.name', '', userName); | ||
|
||
if (severity) { | ||
dataProvider.and.push(getDataProvider('kibana.alert.severity', '', severity)); | ||
} | ||
navigateToTimeline(dataProvider); | ||
}; | ||
|
||
const openRuleInTimeline = (ruleName: string) => { | ||
const dataProvider = getDataProvider('kibana.alert.rule.name', '', ruleName); | ||
|
||
navigateToTimeline(dataProvider); | ||
}; | ||
|
||
return { | ||
openHostInTimeline, | ||
openRuleInTimeline, | ||
openUserInTimeline, | ||
}; | ||
}; |
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
Oops, something went wrong.