Skip to content
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

[Security Solution] Document details flyout - fix session view alerts error #196422

Merged
merged 3 commits into from
Oct 17, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -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';
Expand Down Expand Up @@ -273,18 +271,8 @@ export const useSessionView = ({ scopeId, height }: { scopeId: string; height?:
[globalFullScreen, scopeId, timelineFullScreen]
);

const sourcererScope = useMemo(() => {
PhilippeOberti marked this conversation as resolved.
Show resolved Hide resolved
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(
Expand All @@ -294,7 +282,7 @@ export const useSessionView = ({ scopeId, height }: { scopeId: string; height?:
id: DocumentDetailsRightPanelKey,
params: {
id: eventId,
indexName: eventDetailsIndex,
indexName: alertsIndex,
scopeId,
},
},
Expand All @@ -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(() => {
Expand Down