mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 09:48:58 -04:00
[8.16] [Security Solution] Document details flyout - fix session view alerts error (#196422) (#196758)
# Backport This will backport the following commits from `main` to `8.16`: - [[Security Solution] Document details flyout - fix session view alerts error (#196422)](https://github.com/elastic/kibana/pull/196422) <!--- Backport version: 9.4.3 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) <!--BACKPORT [{"author":{"name":"christineweng","email":"18648970+christineweng@users.noreply.github.com"},"sourceCommit":{"committedDate":"2024-10-17T18:26:57Z","message":"[Security Solution] Document details flyout - fix session view alerts error (#196422)\n\n## Summary\r\n\r\nRelated https://github.com/elastic/kibana/issues/191582\r\n\r\nWe passed indices to session viewer based on sourcerer scope. When user\r\nis in a non-alert page, the alerts index is not available and hence\r\nsession viewer throws an error when a user tries to open alert details.\r\nThis PR updates indices to always be the alerts indices.\r\n\r\n\r\nhttps://github.com/user-attachments/assets/264865f9-0bff-44f1-9dda-4bcd91eeab4a","sha":"89d833bf58ba614a0e9eb6a38a02c4eb5a641aeb","branchLabelMapping":{"^v9.0.0$":"main","^v8.17.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["backport","release_note:fix","v9.0.0","Team:Threat Hunting","Team:Threat Hunting:Investigations","v8.16.0"],"title":"[Security Solution] Document details flyout - fix session view alerts error","number":196422,"url":"https://github.com/elastic/kibana/pull/196422","mergeCommit":{"message":"[Security Solution] Document details flyout - fix session view alerts error (#196422)\n\n## Summary\r\n\r\nRelated https://github.com/elastic/kibana/issues/191582\r\n\r\nWe passed indices to session viewer based on sourcerer scope. When user\r\nis in a non-alert page, the alerts index is not available and hence\r\nsession viewer throws an error when a user tries to open alert details.\r\nThis PR updates indices to always be the alerts indices.\r\n\r\n\r\nhttps://github.com/user-attachments/assets/264865f9-0bff-44f1-9dda-4bcd91eeab4a","sha":"89d833bf58ba614a0e9eb6a38a02c4eb5a641aeb"}},"sourceBranch":"main","suggestedTargetBranches":["8.16"],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/196422","number":196422,"mergeCommit":{"message":"[Security Solution] Document details flyout - fix session view alerts error (#196422)\n\n## Summary\r\n\r\nRelated https://github.com/elastic/kibana/issues/191582\r\n\r\nWe passed indices to session viewer based on sourcerer scope. When user\r\nis in a non-alert page, the alerts index is not available and hence\r\nsession viewer throws an error when a user tries to open alert details.\r\nThis PR updates indices to always be the alerts indices.\r\n\r\n\r\nhttps://github.com/user-attachments/assets/264865f9-0bff-44f1-9dda-4bcd91eeab4a","sha":"89d833bf58ba614a0e9eb6a38a02c4eb5a641aeb"}},{"branch":"8.16","label":"v8.16.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}] BACKPORT--> Co-authored-by: christineweng <18648970+christineweng@users.noreply.github.com>
This commit is contained in:
parent
0fa5483505
commit
22a0654f41
1 changed files with 4 additions and 16 deletions
|
@ -10,7 +10,6 @@ import { EuiButtonEmpty, EuiButtonIcon, EuiFlexGroup, EuiFlexItem, EuiToolTip }
|
|||
import styled from 'styled-components';
|
||||
import { useDispatch } from 'react-redux';
|
||||
import { dataTableSelectors, tableDefaults } from '@kbn/securitysolution-data-table';
|
||||
import type { TableId } from '@kbn/securitysolution-data-table';
|
||||
import { useExpandableFlyoutApi } from '@kbn/expandable-flyout';
|
||||
import { DocumentDetailsRightPanelKey } from '../../../../../flyout/document_details/shared/constants/panel_keys';
|
||||
import { useSourcererDataView } from '../../../../../sourcerer/containers';
|
||||
|
@ -32,7 +31,6 @@ import {
|
|||
useTimelineFullScreen,
|
||||
useGlobalFullScreen,
|
||||
} from '../../../../../common/containers/use_full_screen';
|
||||
import { detectionsTimelineIds } from '../../../../containers/helpers';
|
||||
import { useUserPrivileges } from '../../../../../common/components/user_privileges';
|
||||
import { timelineActions, timelineSelectors } from '../../../../store';
|
||||
import { timelineDefaults } from '../../../../store/defaults';
|
||||
|
@ -273,18 +271,8 @@ export const useSessionView = ({ scopeId, height }: { scopeId: string; height?:
|
|||
[globalFullScreen, scopeId, timelineFullScreen]
|
||||
);
|
||||
|
||||
const sourcererScope = useMemo(() => {
|
||||
if (isActiveTimeline(scopeId)) {
|
||||
return SourcererScopeName.timeline;
|
||||
} else if (detectionsTimelineIds.includes(scopeId as TableId)) {
|
||||
return SourcererScopeName.detections;
|
||||
} else {
|
||||
return SourcererScopeName.default;
|
||||
}
|
||||
}, [scopeId]);
|
||||
|
||||
const { selectedPatterns } = useSourcererDataView(sourcererScope);
|
||||
const eventDetailsIndex = useMemo(() => selectedPatterns.join(','), [selectedPatterns]);
|
||||
const { selectedPatterns } = useSourcererDataView(SourcererScopeName.detections);
|
||||
const alertsIndex = useMemo(() => selectedPatterns.join(','), [selectedPatterns]);
|
||||
|
||||
const { openFlyout } = useExpandableFlyoutApi();
|
||||
const openAlertDetailsFlyout = useCallback(
|
||||
|
@ -294,7 +282,7 @@ export const useSessionView = ({ scopeId, height }: { scopeId: string; height?:
|
|||
id: DocumentDetailsRightPanelKey,
|
||||
params: {
|
||||
id: eventId,
|
||||
indexName: eventDetailsIndex,
|
||||
indexName: alertsIndex,
|
||||
scopeId,
|
||||
},
|
||||
},
|
||||
|
@ -304,7 +292,7 @@ export const useSessionView = ({ scopeId, height }: { scopeId: string; height?:
|
|||
panel: 'right',
|
||||
});
|
||||
},
|
||||
[openFlyout, eventDetailsIndex, scopeId, telemetry]
|
||||
[openFlyout, alertsIndex, scopeId, telemetry]
|
||||
);
|
||||
|
||||
const sessionViewComponent = useMemo(() => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue