From 3f439ad9789ba27dd4c538149fd1d391b78ddc8e Mon Sep 17 00:00:00 2001 From: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> Date: Thu, 20 Feb 2025 10:13:22 +1100 Subject: [PATCH] [9.0] [Security Solution] Enable new flyout navigation flag (#211330) (#211840) # Backport This will backport the following commits from `main` to `9.0`: - [[Security Solution] Enable new flyout navigation flag (#211330)](https://github.com/elastic/kibana/pull/211330) ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sorenlouv/backport) Co-authored-by: christineweng <18648970+christineweng@users.noreply.github.com> --- .../common/experimental_features.ts | 4 +- .../analyzer_preview_container.test.tsx | 284 +++++++++--------- .../components/analyzer_preview_container.tsx | 4 +- .../components/response_section.test.tsx | 6 +- .../right/components/response_section.tsx | 4 +- .../session_preview_container.test.tsx | 8 +- .../components/session_preview_container.tsx | 4 +- .../components/alert_count_insight.test.tsx | 6 +- .../shared/components/alert_count_insight.tsx | 4 +- .../misconfiguration_insight.test.tsx | 6 +- .../components/misconfiguration_insight.tsx | 4 +- .../vulnerabilities_insight.test.tsx | 5 +- .../components/vulnerabilities_insight.tsx | 4 +- .../hooks/use_navigate_to_analyzer.test.tsx | 6 +- .../shared/hooks/use_navigate_to_analyzer.tsx | 4 +- .../hooks/use_navigate_to_left_panel.test.tsx | 8 +- .../hooks/use_navigate_to_left_panel.tsx | 4 +- .../use_navigate_to_session_view.test.tsx | 6 +- .../hooks/use_navigate_to_session_view.tsx | 4 +- .../use_navigate_to_host_details.test.ts | 8 +- .../hooks/use_navigate_to_host_details.ts | 4 +- .../use_navigate_to_service_details.test.ts | 8 +- .../hooks/use_navigate_to_service_details.ts | 4 +- .../use_navigate_to_user_details.test.ts | 8 +- .../hooks/use_navigate_to_user_details.ts | 4 +- .../components/flyout_navigation.test.tsx | 6 +- .../shared/components/flyout_navigation.tsx | 4 +- 27 files changed, 215 insertions(+), 206 deletions(-) diff --git a/x-pack/solutions/security/plugins/security_solution/common/experimental_features.ts b/x-pack/solutions/security/plugins/security_solution/common/experimental_features.ts index afc6a77d229ff..569e2acdc1c3f 100644 --- a/x-pack/solutions/security/plugins/security_solution/common/experimental_features.ts +++ b/x-pack/solutions/security/plugins/security_solution/common/experimental_features.ts @@ -252,9 +252,9 @@ export const allowedExperimentalValues = Object.freeze({ defendInsights: true, /** - * Enables flyout history and new preview navigation + * Disables flyout history and new preview navigation */ - newExpandableFlyoutNavigationEnabled: false, + newExpandableFlyoutNavigationDisabled: false, /** * Enables CrowdStrike's RunScript RTR command diff --git a/x-pack/solutions/security/plugins/security_solution/public/flyout/document_details/right/components/analyzer_preview_container.test.tsx b/x-pack/solutions/security/plugins/security_solution/public/flyout/document_details/right/components/analyzer_preview_container.test.tsx index 8b12d95a25c6a..f3dbd855e0c7b 100644 --- a/x-pack/solutions/security/plugins/security_solution/public/flyout/document_details/right/components/analyzer_preview_container.test.tsx +++ b/x-pack/solutions/security/plugins/security_solution/public/flyout/document_details/right/components/analyzer_preview_container.test.tsx @@ -82,63 +82,13 @@ const renderAnalyzerPreview = (context = mockContextValue) => ); describe('AnalyzerPreviewContainer', () => { - beforeEach(() => { - jest.clearAllMocks(); - (useIsExperimentalFeatureEnabled as jest.Mock).mockReturnValue(false); - }); - - it('should render component and link in header', () => { - (useIsInvestigateInResolverActionEnabled as jest.Mock).mockReturnValue(true); - (useAlertPrevalenceFromProcessTree as jest.Mock).mockReturnValue({ - loading: false, - error: false, - alertIds: ['alertid'], - statsNodes: mock.mockStatsNodes, - }); - (useInvestigateInTimeline as jest.Mock).mockReturnValue({ - investigateInTimelineAlertClick: jest.fn(), - }); - - const { getByTestId } = renderAnalyzerPreview(); - - expect(getByTestId(ANALYZER_PREVIEW_TEST_ID)).toBeInTheDocument(); - expect( - getByTestId(EXPANDABLE_PANEL_HEADER_TITLE_LINK_TEST_ID(ANALYZER_PREVIEW_TEST_ID)) - ).toBeInTheDocument(); - expect( - screen.queryByTestId(EXPANDABLE_PANEL_TOGGLE_ICON_TEST_ID(ANALYZER_PREVIEW_TEST_ID)) - ).not.toBeInTheDocument(); - expect( - screen.getByTestId(EXPANDABLE_PANEL_HEADER_TITLE_ICON_TEST_ID(ANALYZER_PREVIEW_TEST_ID)) - ).toBeInTheDocument(); - expect( - screen.getByTestId(EXPANDABLE_PANEL_CONTENT_TEST_ID(ANALYZER_PREVIEW_TEST_ID)) - ).toBeInTheDocument(); - expect( - screen.queryByTestId(EXPANDABLE_PANEL_HEADER_TITLE_TEXT_TEST_ID(ANALYZER_PREVIEW_TEST_ID)) - ).not.toBeInTheDocument(); - expect( - screen.getByTestId(EXPANDABLE_PANEL_CONTENT_TEST_ID(ANALYZER_PREVIEW_TEST_ID)) - ).not.toHaveTextContent(NO_ANALYZER_MESSAGE); - }); - - it('should render error message and text in header', () => { - (useIsInvestigateInResolverActionEnabled as jest.Mock).mockReturnValue(false); - (useInvestigateInTimeline as jest.Mock).mockReturnValue({ - investigateInTimelineAlertClick: jest.fn(), + describe('when newExpandableFlyoutNavigationDisabled is true', () => { + beforeEach(() => { + jest.clearAllMocks(); + (useIsExperimentalFeatureEnabled as jest.Mock).mockReturnValue(true); }); - const { getByTestId } = renderAnalyzerPreview(); - expect( - getByTestId(EXPANDABLE_PANEL_HEADER_TITLE_TEXT_TEST_ID(ANALYZER_PREVIEW_TEST_ID)) - ).toBeInTheDocument(); - expect( - getByTestId(EXPANDABLE_PANEL_CONTENT_TEST_ID(ANALYZER_PREVIEW_TEST_ID)) - ).toHaveTextContent(NO_ANALYZER_MESSAGE); - }); - - describe('when visualizationInFlyoutEnabled is disabled', () => { - it('should navigate to analyzer in timeline when clicking on title', () => { + it('should render component and link in header', () => { (useIsInvestigateInResolverActionEnabled as jest.Mock).mockReturnValue(true); (useAlertPrevalenceFromProcessTree as jest.Mock).mockReturnValue({ loading: false, @@ -152,116 +102,174 @@ describe('AnalyzerPreviewContainer', () => { const { getByTestId } = renderAnalyzerPreview(); - const { investigateInTimelineAlertClick } = useInvestigateInTimeline({}); - - getByTestId(EXPANDABLE_PANEL_HEADER_TITLE_LINK_TEST_ID(ANALYZER_PREVIEW_TEST_ID)).click(); - expect(investigateInTimelineAlertClick).toHaveBeenCalled(); - }); - - it('should not navigate to analyzer when in preview and clicking on title', () => { - (useIsInvestigateInResolverActionEnabled as jest.Mock).mockReturnValue(true); - (useAlertPrevalenceFromProcessTree as jest.Mock).mockReturnValue({ - loading: false, - error: false, - alertIds: ['alertid'], - statsNodes: mock.mockStatsNodes, - }); - (useInvestigateInTimeline as jest.Mock).mockReturnValue({ - investigateInTimelineAlertClick: jest.fn(), - }); - - const { queryByTestId } = renderAnalyzerPreview({ ...mockContextValue, isPreview: true }); + expect(getByTestId(ANALYZER_PREVIEW_TEST_ID)).toBeInTheDocument(); + expect( + getByTestId(EXPANDABLE_PANEL_HEADER_TITLE_LINK_TEST_ID(ANALYZER_PREVIEW_TEST_ID)) + ).toBeInTheDocument(); + expect( + screen.queryByTestId(EXPANDABLE_PANEL_TOGGLE_ICON_TEST_ID(ANALYZER_PREVIEW_TEST_ID)) + ).not.toBeInTheDocument(); + expect( + screen.getByTestId(EXPANDABLE_PANEL_HEADER_TITLE_ICON_TEST_ID(ANALYZER_PREVIEW_TEST_ID)) + ).toBeInTheDocument(); + expect( + screen.getByTestId(EXPANDABLE_PANEL_CONTENT_TEST_ID(ANALYZER_PREVIEW_TEST_ID)) + ).toBeInTheDocument(); expect( - queryByTestId(EXPANDABLE_PANEL_HEADER_TITLE_LINK_TEST_ID(ANALYZER_PREVIEW_TEST_ID)) + screen.queryByTestId(EXPANDABLE_PANEL_HEADER_TITLE_TEXT_TEST_ID(ANALYZER_PREVIEW_TEST_ID)) ).not.toBeInTheDocument(); - const { investigateInTimelineAlertClick } = useInvestigateInTimeline({}); - expect(investigateInTimelineAlertClick).not.toHaveBeenCalled(); + expect( + screen.getByTestId(EXPANDABLE_PANEL_CONTENT_TEST_ID(ANALYZER_PREVIEW_TEST_ID)) + ).not.toHaveTextContent(NO_ANALYZER_MESSAGE); }); - it('should not navigate to analyzer when in preview mode', () => { - (useIsInvestigateInResolverActionEnabled as jest.Mock).mockReturnValue(true); - (useAlertPrevalenceFromProcessTree as jest.Mock).mockReturnValue({ - loading: false, - error: false, - alertIds: ['alertid'], - statsNodes: mock.mockStatsNodes, - }); + it('should render error message and text in header', () => { + (useIsInvestigateInResolverActionEnabled as jest.Mock).mockReturnValue(false); (useInvestigateInTimeline as jest.Mock).mockReturnValue({ investigateInTimelineAlertClick: jest.fn(), }); - const { queryByTestId } = renderAnalyzerPreview({ ...mockContextValue, isPreviewMode: true }); + const { getByTestId } = renderAnalyzerPreview(); expect( - queryByTestId(EXPANDABLE_PANEL_HEADER_TITLE_LINK_TEST_ID(ANALYZER_PREVIEW_TEST_ID)) - ).not.toBeInTheDocument(); - const { investigateInTimelineAlertClick } = useInvestigateInTimeline({}); - expect(investigateInTimelineAlertClick).not.toHaveBeenCalled(); + getByTestId(EXPANDABLE_PANEL_HEADER_TITLE_TEXT_TEST_ID(ANALYZER_PREVIEW_TEST_ID)) + ).toBeInTheDocument(); + expect( + getByTestId(EXPANDABLE_PANEL_CONTENT_TEST_ID(ANALYZER_PREVIEW_TEST_ID)) + ).toHaveTextContent(NO_ANALYZER_MESSAGE); }); - }); - describe('when visualizationInFlyoutEnabled is enabled', () => { - it('should open left flyout visualization tab when clicking on title', () => { - mockUseUiSetting.mockReturnValue([true]); + describe('when visualizationInFlyoutEnabled is disabled', () => { + it('should navigate to analyzer in timeline when clicking on title', () => { + (useIsInvestigateInResolverActionEnabled as jest.Mock).mockReturnValue(true); + (useAlertPrevalenceFromProcessTree as jest.Mock).mockReturnValue({ + loading: false, + error: false, + alertIds: ['alertid'], + statsNodes: mock.mockStatsNodes, + }); + (useInvestigateInTimeline as jest.Mock).mockReturnValue({ + investigateInTimelineAlertClick: jest.fn(), + }); - (useIsInvestigateInResolverActionEnabled as jest.Mock).mockReturnValue(true); - (useAlertPrevalenceFromProcessTree as jest.Mock).mockReturnValue({ - loading: false, - error: false, - alertIds: ['alertid'], - statsNodes: mock.mockStatsNodes, + const { getByTestId } = renderAnalyzerPreview(); + + const { investigateInTimelineAlertClick } = useInvestigateInTimeline({}); + + getByTestId(EXPANDABLE_PANEL_HEADER_TITLE_LINK_TEST_ID(ANALYZER_PREVIEW_TEST_ID)).click(); + expect(investigateInTimelineAlertClick).toHaveBeenCalled(); }); - (useInvestigateInTimeline as jest.Mock).mockReturnValue({ - investigateInTimelineAlertClick: jest.fn(), + + it('should not navigate to analyzer when in preview and clicking on title', () => { + (useIsInvestigateInResolverActionEnabled as jest.Mock).mockReturnValue(true); + (useAlertPrevalenceFromProcessTree as jest.Mock).mockReturnValue({ + loading: false, + error: false, + alertIds: ['alertid'], + statsNodes: mock.mockStatsNodes, + }); + (useInvestigateInTimeline as jest.Mock).mockReturnValue({ + investigateInTimelineAlertClick: jest.fn(), + }); + + const { queryByTestId } = renderAnalyzerPreview({ ...mockContextValue, isPreview: true }); + expect( + queryByTestId(EXPANDABLE_PANEL_HEADER_TITLE_LINK_TEST_ID(ANALYZER_PREVIEW_TEST_ID)) + ).not.toBeInTheDocument(); + const { investigateInTimelineAlertClick } = useInvestigateInTimeline({}); + expect(investigateInTimelineAlertClick).not.toHaveBeenCalled(); }); - const { getByTestId } = renderAnalyzerPreview(); + it('should not navigate to analyzer when in preview mode', () => { + (useIsInvestigateInResolverActionEnabled as jest.Mock).mockReturnValue(true); + (useAlertPrevalenceFromProcessTree as jest.Mock).mockReturnValue({ + loading: false, + error: false, + alertIds: ['alertid'], + statsNodes: mock.mockStatsNodes, + }); + (useInvestigateInTimeline as jest.Mock).mockReturnValue({ + investigateInTimelineAlertClick: jest.fn(), + }); - getByTestId(EXPANDABLE_PANEL_HEADER_TITLE_LINK_TEST_ID(ANALYZER_PREVIEW_TEST_ID)).click(); - expect(mockNavigateToAnalyzer).toHaveBeenCalled(); + const { queryByTestId } = renderAnalyzerPreview({ + ...mockContextValue, + isPreviewMode: true, + }); + expect( + queryByTestId(EXPANDABLE_PANEL_HEADER_TITLE_LINK_TEST_ID(ANALYZER_PREVIEW_TEST_ID)) + ).not.toBeInTheDocument(); + const { investigateInTimelineAlertClick } = useInvestigateInTimeline({}); + expect(investigateInTimelineAlertClick).not.toHaveBeenCalled(); + }); }); - it('should disable link when in rule preview', () => { - mockUseUiSetting.mockReturnValue([true]); - (useIsInvestigateInResolverActionEnabled as jest.Mock).mockReturnValue(true); - (useAlertPrevalenceFromProcessTree as jest.Mock).mockReturnValue({ - loading: false, - error: false, - alertIds: ['alertid'], - statsNodes: mock.mockStatsNodes, - }); - (useInvestigateInTimeline as jest.Mock).mockReturnValue({ - investigateInTimelineAlertClick: jest.fn(), - }); + describe('when visualizationInFlyoutEnabled is enabled', () => { + it('should open left flyout visualization tab when clicking on title', () => { + mockUseUiSetting.mockReturnValue([true]); - const { queryByTestId } = renderAnalyzerPreview({ ...mockContextValue, isPreview: true }); - expect( - queryByTestId(EXPANDABLE_PANEL_HEADER_TITLE_LINK_TEST_ID(ANALYZER_PREVIEW_TEST_ID)) - ).not.toBeInTheDocument(); - }); + (useIsInvestigateInResolverActionEnabled as jest.Mock).mockReturnValue(true); + (useAlertPrevalenceFromProcessTree as jest.Mock).mockReturnValue({ + loading: false, + error: false, + alertIds: ['alertid'], + statsNodes: mock.mockStatsNodes, + }); + (useInvestigateInTimeline as jest.Mock).mockReturnValue({ + investigateInTimelineAlertClick: jest.fn(), + }); - it('should disable link when in preview mode', () => { - mockUseUiSetting.mockReturnValue([true]); - (useIsInvestigateInResolverActionEnabled as jest.Mock).mockReturnValue(true); - (useAlertPrevalenceFromProcessTree as jest.Mock).mockReturnValue({ - loading: false, - error: false, - alertIds: ['alertid'], - statsNodes: mock.mockStatsNodes, + const { getByTestId } = renderAnalyzerPreview(); + + getByTestId(EXPANDABLE_PANEL_HEADER_TITLE_LINK_TEST_ID(ANALYZER_PREVIEW_TEST_ID)).click(); + expect(mockNavigateToAnalyzer).toHaveBeenCalled(); }); - (useInvestigateInTimeline as jest.Mock).mockReturnValue({ - investigateInTimelineAlertClick: jest.fn(), + + it('should disable link when in rule preview', () => { + mockUseUiSetting.mockReturnValue([true]); + (useIsInvestigateInResolverActionEnabled as jest.Mock).mockReturnValue(true); + (useAlertPrevalenceFromProcessTree as jest.Mock).mockReturnValue({ + loading: false, + error: false, + alertIds: ['alertid'], + statsNodes: mock.mockStatsNodes, + }); + (useInvestigateInTimeline as jest.Mock).mockReturnValue({ + investigateInTimelineAlertClick: jest.fn(), + }); + + const { queryByTestId } = renderAnalyzerPreview({ ...mockContextValue, isPreview: true }); + expect( + queryByTestId(EXPANDABLE_PANEL_HEADER_TITLE_LINK_TEST_ID(ANALYZER_PREVIEW_TEST_ID)) + ).not.toBeInTheDocument(); }); - const { queryByTestId } = renderAnalyzerPreview({ ...mockContextValue, isPreviewMode: true }); - expect( - queryByTestId(EXPANDABLE_PANEL_HEADER_TITLE_LINK_TEST_ID(ANALYZER_PREVIEW_TEST_ID)) - ).not.toBeInTheDocument(); + it('should disable link when in preview mode', () => { + mockUseUiSetting.mockReturnValue([true]); + (useIsInvestigateInResolverActionEnabled as jest.Mock).mockReturnValue(true); + (useAlertPrevalenceFromProcessTree as jest.Mock).mockReturnValue({ + loading: false, + error: false, + alertIds: ['alertid'], + statsNodes: mock.mockStatsNodes, + }); + (useInvestigateInTimeline as jest.Mock).mockReturnValue({ + investigateInTimelineAlertClick: jest.fn(), + }); + + const { queryByTestId } = renderAnalyzerPreview({ + ...mockContextValue, + isPreviewMode: true, + }); + expect( + queryByTestId(EXPANDABLE_PANEL_HEADER_TITLE_LINK_TEST_ID(ANALYZER_PREVIEW_TEST_ID)) + ).not.toBeInTheDocument(); + }); }); }); - describe('when new navigation is enabled', () => { + describe('when newExpandableFlyoutNavigationDisabled is false', () => { beforeEach(() => { - (useIsExperimentalFeatureEnabled as jest.Mock).mockReturnValue(true); + (useIsExperimentalFeatureEnabled as jest.Mock).mockReturnValue(false); }); describe('when visualizationInFlyoutEnabled is enabled', () => { beforeEach(() => { diff --git a/x-pack/solutions/security/plugins/security_solution/public/flyout/document_details/right/components/analyzer_preview_container.tsx b/x-pack/solutions/security/plugins/security_solution/public/flyout/document_details/right/components/analyzer_preview_container.tsx index 1d11e8fb19951..145693eccf551 100644 --- a/x-pack/solutions/security/plugins/security_solution/public/flyout/document_details/right/components/analyzer_preview_container.tsx +++ b/x-pack/solutions/security/plugins/security_solution/public/flyout/document_details/right/components/analyzer_preview_container.tsx @@ -37,8 +37,8 @@ export const AnalyzerPreviewContainer: React.FC = () => { const [visualizationInFlyoutEnabled] = useUiSetting$( ENABLE_VISUALIZATIONS_IN_FLYOUT_SETTING ); - const isNewNavigationEnabled = useIsExperimentalFeatureEnabled( - 'newExpandableFlyoutNavigationEnabled' + const isNewNavigationEnabled = !useIsExperimentalFeatureEnabled( + 'newExpandableFlyoutNavigationDisabled' ); // decide whether to show the analyzer preview or not const isEnabled = useIsInvestigateInResolverActionEnabled(dataAsNestedObject); diff --git a/x-pack/solutions/security/plugins/security_solution/public/flyout/document_details/right/components/response_section.test.tsx b/x-pack/solutions/security/plugins/security_solution/public/flyout/document_details/right/components/response_section.test.tsx index d3201d37fa060..2fd7782402fbf 100644 --- a/x-pack/solutions/security/plugins/security_solution/public/flyout/document_details/right/components/response_section.test.tsx +++ b/x-pack/solutions/security/plugins/security_solution/public/flyout/document_details/right/components/response_section.test.tsx @@ -47,7 +47,7 @@ const renderResponseSection = () => describe('', () => { beforeEach(() => { - mockUseIsExperimentalFeatureEnabled.mockReturnValue(false); + mockUseIsExperimentalFeatureEnabled.mockReturnValue(true); }); it('should render response component', () => { @@ -155,9 +155,9 @@ describe('', () => { expect(container).toBeEmptyDOMElement(); }); - describe('newExpandableFlyoutNavigationEnabled', () => { + describe('newExpandableFlyoutNavigationDisabled is false', () => { beforeEach(() => { - mockUseIsExperimentalFeatureEnabled.mockReturnValue(true); + mockUseIsExperimentalFeatureEnabled.mockReturnValue(false); }); it('should render if isPreviewMode is true', () => { diff --git a/x-pack/solutions/security/plugins/security_solution/public/flyout/document_details/right/components/response_section.tsx b/x-pack/solutions/security/plugins/security_solution/public/flyout/document_details/right/components/response_section.tsx index 6e4a52f61559e..8bb5550d77409 100644 --- a/x-pack/solutions/security/plugins/security_solution/public/flyout/document_details/right/components/response_section.tsx +++ b/x-pack/solutions/security/plugins/security_solution/public/flyout/document_details/right/components/response_section.tsx @@ -29,8 +29,8 @@ export const ResponseSection = memo(() => { const expanded = useExpandSection({ title: KEY, defaultValue: false }); const eventKind = getField(getFieldsData('event.kind')); - const isNewNavigationEnabled = useIsExperimentalFeatureEnabled( - 'newExpandableFlyoutNavigationEnabled' + const isNewNavigationEnabled = !useIsExperimentalFeatureEnabled( + 'newExpandableFlyoutNavigationDisabled' ); const content = useMemo(() => { diff --git a/x-pack/solutions/security/plugins/security_solution/public/flyout/document_details/right/components/session_preview_container.test.tsx b/x-pack/solutions/security/plugins/security_solution/public/flyout/document_details/right/components/session_preview_container.test.tsx index d27d75aed1e0d..653824ec1f1e4 100644 --- a/x-pack/solutions/security/plugins/security_solution/public/flyout/document_details/right/components/session_preview_container.test.tsx +++ b/x-pack/solutions/security/plugins/security_solution/public/flyout/document_details/right/components/session_preview_container.test.tsx @@ -77,7 +77,7 @@ const renderSessionPreview = (context = mockContextValue) => describe('SessionPreviewContainer', () => { beforeEach(() => { jest.clearAllMocks(); - (useIsExperimentalFeatureEnabled as jest.Mock).mockReturnValue(false); + (useIsExperimentalFeatureEnabled as jest.Mock).mockReturnValue(true); (useInvestigateInTimeline as jest.Mock).mockReturnValue({ investigateInTimelineAlertClick: jest.fn(), }); @@ -248,14 +248,14 @@ describe('SessionPreviewContainer', () => { }); }); - describe('when new navigation is enabled', () => { + describe('when newExpandableFlyoutNavigationDisabled is false', () => { describe('when visualization in flyout flag is enabled', () => { beforeEach(() => { jest.clearAllMocks(); mockUseUiSetting.mockReturnValue([true]); (useSessionViewConfig as jest.Mock).mockReturnValue(sessionViewConfig); (useLicense as jest.Mock).mockReturnValue({ isEnterprise: () => true }); - (useIsExperimentalFeatureEnabled as jest.Mock).mockReturnValue(true); + (useIsExperimentalFeatureEnabled as jest.Mock).mockReturnValue(false); }); it('should open left panel vizualization tab when visualization in flyout flag is on', () => { @@ -306,7 +306,7 @@ describe('SessionPreviewContainer', () => { mockUseUiSetting.mockReturnValue([false]); (useSessionViewConfig as jest.Mock).mockReturnValue(sessionViewConfig); (useLicense as jest.Mock).mockReturnValue({ isEnterprise: () => true }); - (useIsExperimentalFeatureEnabled as jest.Mock).mockReturnValue(true); + (useIsExperimentalFeatureEnabled as jest.Mock).mockReturnValue(false); }); it('should open session viewer in timeline', () => { diff --git a/x-pack/solutions/security/plugins/security_solution/public/flyout/document_details/right/components/session_preview_container.tsx b/x-pack/solutions/security/plugins/security_solution/public/flyout/document_details/right/components/session_preview_container.tsx index 52d6dd134646e..9af57bedc1283 100644 --- a/x-pack/solutions/security/plugins/security_solution/public/flyout/document_details/right/components/session_preview_container.tsx +++ b/x-pack/solutions/security/plugins/security_solution/public/flyout/document_details/right/components/session_preview_container.tsx @@ -52,8 +52,8 @@ export const SessionPreviewContainer: FC = () => { const isEnterprisePlus = useLicense().isEnterprise(); const isEnabled = sessionViewConfig && isEnterprisePlus; - const isNewNavigationEnabled = useIsExperimentalFeatureEnabled( - 'newExpandableFlyoutNavigationEnabled' + const isNewNavigationEnabled = !useIsExperimentalFeatureEnabled( + 'newExpandableFlyoutNavigationDisabled' ); const dispatch = useDispatch(); diff --git a/x-pack/solutions/security/plugins/security_solution/public/flyout/document_details/shared/components/alert_count_insight.test.tsx b/x-pack/solutions/security/plugins/security_solution/public/flyout/document_details/shared/components/alert_count_insight.test.tsx index 32cada93fb791..60da1a07ad5ed 100644 --- a/x-pack/solutions/security/plugins/security_solution/public/flyout/document_details/shared/components/alert_count_insight.test.tsx +++ b/x-pack/solutions/security/plugins/security_solution/public/flyout/document_details/shared/components/alert_count_insight.test.tsx @@ -87,7 +87,7 @@ describe('AlertCountInsight', () => { beforeEach(() => { (useSignalIndex as jest.Mock).mockReturnValue({ signalIndexName: '' }); (useUserPrivileges as jest.Mock).mockReturnValue({ timelinePrivileges: { read: true } }); - (useIsExperimentalFeatureEnabled as jest.Mock).mockReturnValue(false); + (useIsExperimentalFeatureEnabled as jest.Mock).mockReturnValue(true); }); it('renders', () => { @@ -107,8 +107,8 @@ describe('AlertCountInsight', () => { expect(queryByTestId(INSIGHTS_ALERTS_COUNT_TEXT_TEST_ID)).not.toBeInTheDocument(); }); - it('open entity details panel when clicking on the count if new navigation is enabled', () => { - (useIsExperimentalFeatureEnabled as jest.Mock).mockReturnValue(true); + it('open entity details panel when clicking on the count if newExpandableFlyoutNavigationDisabled is false', () => { + (useIsExperimentalFeatureEnabled as jest.Mock).mockReturnValue(false); (useAlertsByStatus as jest.Mock).mockReturnValue({ isLoading: false, items: mockAlertData, diff --git a/x-pack/solutions/security/plugins/security_solution/public/flyout/document_details/shared/components/alert_count_insight.tsx b/x-pack/solutions/security/plugins/security_solution/public/flyout/document_details/shared/components/alert_count_insight.tsx index 2fb94b02b33c9..bbf29f9dd69cb 100644 --- a/x-pack/solutions/security/plugins/security_solution/public/flyout/document_details/shared/components/alert_count_insight.tsx +++ b/x-pack/solutions/security/plugins/security_solution/public/flyout/document_details/shared/components/alert_count_insight.tsx @@ -116,8 +116,8 @@ export const AlertCountInsight: React.FC = ({ timelinePrivileges: { read: canUseTimeline }, } = useUserPrivileges(); - const isNewNavigationEnabled = useIsExperimentalFeatureEnabled( - 'newExpandableFlyoutNavigationEnabled' + const isNewNavigationEnabled = !useIsExperimentalFeatureEnabled( + 'newExpandableFlyoutNavigationDisabled' ); const entityFilter = useMemo(() => ({ field: fieldName, value: name }), [fieldName, name]); const { to, from } = useGlobalTime(); diff --git a/x-pack/solutions/security/plugins/security_solution/public/flyout/document_details/shared/components/misconfiguration_insight.test.tsx b/x-pack/solutions/security/plugins/security_solution/public/flyout/document_details/shared/components/misconfiguration_insight.test.tsx index 854a8e2aec0db..247a38fb20f1a 100644 --- a/x-pack/solutions/security/plugins/security_solution/public/flyout/document_details/shared/components/misconfiguration_insight.test.tsx +++ b/x-pack/solutions/security/plugins/security_solution/public/flyout/document_details/shared/components/misconfiguration_insight.test.tsx @@ -48,7 +48,7 @@ const renderMisconfigurationsInsight = (fieldName: 'host.name' | 'user.name', va describe('MisconfigurationsInsight', () => { beforeEach(() => { jest.mocked(useExpandableFlyoutApi).mockReturnValue(mockFlyoutApi); - (useIsExperimentalFeatureEnabled as jest.Mock).mockReturnValue(false); + (useIsExperimentalFeatureEnabled as jest.Mock).mockReturnValue(true); }); it('renders', () => { @@ -60,8 +60,8 @@ describe('MisconfigurationsInsight', () => { expect(getByTestId(`${testId}-distribution-bar`)).toBeInTheDocument(); }); - it('open entity details panel when clicking on the count if new navigation is enabled', () => { - (useIsExperimentalFeatureEnabled as jest.Mock).mockReturnValue(true); + it('open entity details panel when clicking on the count if newExpandableFlyoutNavigationDisabled is false', () => { + (useIsExperimentalFeatureEnabled as jest.Mock).mockReturnValue(false); (useMisconfigurationPreview as jest.Mock).mockReturnValue({ data: { count: { passed: 1, failed: 2 } }, }); diff --git a/x-pack/solutions/security/plugins/security_solution/public/flyout/document_details/shared/components/misconfiguration_insight.tsx b/x-pack/solutions/security/plugins/security_solution/public/flyout/document_details/shared/components/misconfiguration_insight.tsx index 9aec2f44e6fa9..3c2cfe4f47a70 100644 --- a/x-pack/solutions/security/plugins/security_solution/public/flyout/document_details/shared/components/misconfiguration_insight.tsx +++ b/x-pack/solutions/security/plugins/security_solution/public/flyout/document_details/shared/components/misconfiguration_insight.tsx @@ -83,8 +83,8 @@ export const MisconfigurationsInsight: React.FC = pageSize: 1, }); - const isNewNavigationEnabled = useIsExperimentalFeatureEnabled( - 'newExpandableFlyoutNavigationEnabled' + const isNewNavigationEnabled = !useIsExperimentalFeatureEnabled( + 'newExpandableFlyoutNavigationDisabled' ); const passedFindings = data?.count.passed || 0; diff --git a/x-pack/solutions/security/plugins/security_solution/public/flyout/document_details/shared/components/vulnerabilities_insight.test.tsx b/x-pack/solutions/security/plugins/security_solution/public/flyout/document_details/shared/components/vulnerabilities_insight.test.tsx index ddccb4a4e62a9..03eb333ac99f3 100644 --- a/x-pack/solutions/security/plugins/security_solution/public/flyout/document_details/shared/components/vulnerabilities_insight.test.tsx +++ b/x-pack/solutions/security/plugins/security_solution/public/flyout/document_details/shared/components/vulnerabilities_insight.test.tsx @@ -43,6 +43,7 @@ const renderVulnerabilitiesInsight = () => { describe('VulnerabilitiesInsight', () => { beforeEach(() => { jest.mocked(useExpandableFlyoutApi).mockReturnValue(mockFlyoutApi); + (useIsExperimentalFeatureEnabled as jest.Mock).mockReturnValue(true); }); it('renders', () => { @@ -73,8 +74,8 @@ describe('VulnerabilitiesInsight', () => { }); }); - it('open entity details panel when clicking on the count if new navigation is enabled', () => { - (useIsExperimentalFeatureEnabled as jest.Mock).mockReturnValue(true); + it('open entity details panel when clicking on the count if newExpandableFlyoutNavigationDisabled is false', () => { + (useIsExperimentalFeatureEnabled as jest.Mock).mockReturnValue(false); (useVulnerabilitiesPreview as jest.Mock).mockReturnValue({ data: { count: { CRITICAL: 1, HIGH: 2, MEDIUM: 1, LOW: 2, NONE: 2 } }, }); diff --git a/x-pack/solutions/security/plugins/security_solution/public/flyout/document_details/shared/components/vulnerabilities_insight.tsx b/x-pack/solutions/security/plugins/security_solution/public/flyout/document_details/shared/components/vulnerabilities_insight.tsx index b031dbedec615..475ac7124f75e 100644 --- a/x-pack/solutions/security/plugins/security_solution/public/flyout/document_details/shared/components/vulnerabilities_insight.tsx +++ b/x-pack/solutions/security/plugins/security_solution/public/flyout/document_details/shared/components/vulnerabilities_insight.tsx @@ -80,8 +80,8 @@ export const VulnerabilitiesInsight: React.FC = ({ pageSize: 1, }); - const isNewNavigationEnabled = useIsExperimentalFeatureEnabled( - 'newExpandableFlyoutNavigationEnabled' + const isNewNavigationEnabled = !useIsExperimentalFeatureEnabled( + 'newExpandableFlyoutNavigationDisabled' ); const { CRITICAL = 0, HIGH = 0, MEDIUM = 0, LOW = 0, NONE = 0 } = data?.count || {}; diff --git a/x-pack/solutions/security/plugins/security_solution/public/flyout/document_details/shared/hooks/use_navigate_to_analyzer.test.tsx b/x-pack/solutions/security/plugins/security_solution/public/flyout/document_details/shared/hooks/use_navigate_to_analyzer.test.tsx index da5279bc2de53..624f4d4f497f7 100644 --- a/x-pack/solutions/security/plugins/security_solution/public/flyout/document_details/shared/hooks/use_navigate_to_analyzer.test.tsx +++ b/x-pack/solutions/security/plugins/security_solution/public/flyout/document_details/shared/hooks/use_navigate_to_analyzer.test.tsx @@ -35,7 +35,7 @@ describe('useNavigateToAnalyzer', () => { beforeEach(() => { jest.clearAllMocks(); jest.mocked(useExpandableFlyoutApi).mockReturnValue(mockFlyoutApi); - (useIsExperimentalFeatureEnabled as jest.Mock).mockReturnValue(false); + (useIsExperimentalFeatureEnabled as jest.Mock).mockReturnValue(true); }); it('when isFlyoutOpen is true and not in preview mode, should return callback that opens left panels', () => { @@ -155,9 +155,9 @@ describe('useNavigateToAnalyzer', () => { }); }); - describe('when new navigation is enabled', () => { + describe('when newExpandableFlyoutNavigationDisabled is false', () => { beforeEach(() => { - (useIsExperimentalFeatureEnabled as jest.Mock).mockReturnValue(true); + (useIsExperimentalFeatureEnabled as jest.Mock).mockReturnValue(false); }); it('when isFlyoutOpen is true and not in preview mode, should return callback that opens left panels', () => { diff --git a/x-pack/solutions/security/plugins/security_solution/public/flyout/document_details/shared/hooks/use_navigate_to_analyzer.tsx b/x-pack/solutions/security/plugins/security_solution/public/flyout/document_details/shared/hooks/use_navigate_to_analyzer.tsx index 09a73df17a4b4..683d210a5cb46 100644 --- a/x-pack/solutions/security/plugins/security_solution/public/flyout/document_details/shared/hooks/use_navigate_to_analyzer.tsx +++ b/x-pack/solutions/security/plugins/security_solution/public/flyout/document_details/shared/hooks/use_navigate_to_analyzer.tsx @@ -59,8 +59,8 @@ export const useNavigateToAnalyzer = ({ const { telemetry } = useKibana().services; const { openLeftPanel, openFlyout } = useExpandableFlyoutApi(); - const isNewNavigationEnabled = useIsExperimentalFeatureEnabled( - 'newExpandableFlyoutNavigationEnabled' + const isNewNavigationEnabled = !useIsExperimentalFeatureEnabled( + 'newExpandableFlyoutNavigationDisabled' ); const right: FlyoutPanelProps = useMemo( diff --git a/x-pack/solutions/security/plugins/security_solution/public/flyout/document_details/shared/hooks/use_navigate_to_left_panel.test.tsx b/x-pack/solutions/security/plugins/security_solution/public/flyout/document_details/shared/hooks/use_navigate_to_left_panel.test.tsx index 29e34b3f83220..eac904080c340 100644 --- a/x-pack/solutions/security/plugins/security_solution/public/flyout/document_details/shared/hooks/use_navigate_to_left_panel.test.tsx +++ b/x-pack/solutions/security/plugins/security_solution/public/flyout/document_details/shared/hooks/use_navigate_to_left_panel.test.tsx @@ -31,10 +31,10 @@ const indexName = 'indexName'; const scopeId = 'scopeId'; describe('useNavigateToLeftPanel', () => { - describe('newExpandableFlyoutNavigationEnabled is not enabled', () => { + describe('newExpandableFlyoutNavigationDisabled is true', () => { beforeEach(() => { jest.clearAllMocks(); - mockUseIsExperimentalFeatureEnabled.mockReturnValue(false); + mockUseIsExperimentalFeatureEnabled.mockReturnValue(true); jest.mocked(useExpandableFlyoutApi).mockReturnValue(mockFlyoutApi); }); @@ -83,10 +83,10 @@ describe('useNavigateToLeftPanel', () => { }); }); - describe('newExpandableFlyoutNavigationEnabled', () => { + describe('newExpandableFlyoutNavigationDisabled is false', () => { beforeEach(() => { jest.clearAllMocks(); - mockUseIsExperimentalFeatureEnabled.mockReturnValue(true); + mockUseIsExperimentalFeatureEnabled.mockReturnValue(false); }); it('should enable navigation if isPreviewMode is false', () => { diff --git a/x-pack/solutions/security/plugins/security_solution/public/flyout/document_details/shared/hooks/use_navigate_to_left_panel.tsx b/x-pack/solutions/security/plugins/security_solution/public/flyout/document_details/shared/hooks/use_navigate_to_left_panel.tsx index 59c5c20d36213..c56472d0ca5d5 100644 --- a/x-pack/solutions/security/plugins/security_solution/public/flyout/document_details/shared/hooks/use_navigate_to_left_panel.tsx +++ b/x-pack/solutions/security/plugins/security_solution/public/flyout/document_details/shared/hooks/use_navigate_to_left_panel.tsx @@ -46,8 +46,8 @@ export const useNavigateToLeftPanel = ({ const { openLeftPanel, openFlyout } = useExpandableFlyoutApi(); const { eventId, indexName, scopeId, isPreviewMode } = useDocumentDetailsContext(); - const isNewNavigationEnabled = useIsExperimentalFeatureEnabled( - 'newExpandableFlyoutNavigationEnabled' + const isNewNavigationEnabled = !useIsExperimentalFeatureEnabled( + 'newExpandableFlyoutNavigationDisabled' ); const isEnabled = isNewNavigationEnabled || (!isNewNavigationEnabled && !isPreviewMode); diff --git a/x-pack/solutions/security/plugins/security_solution/public/flyout/document_details/shared/hooks/use_navigate_to_session_view.test.tsx b/x-pack/solutions/security/plugins/security_solution/public/flyout/document_details/shared/hooks/use_navigate_to_session_view.test.tsx index b655badf2beeb..59522e8c74c3b 100644 --- a/x-pack/solutions/security/plugins/security_solution/public/flyout/document_details/shared/hooks/use_navigate_to_session_view.test.tsx +++ b/x-pack/solutions/security/plugins/security_solution/public/flyout/document_details/shared/hooks/use_navigate_to_session_view.test.tsx @@ -30,7 +30,7 @@ describe('useNavigateToSessionView', () => { beforeEach(() => { jest.clearAllMocks(); jest.mocked(useExpandableFlyoutApi).mockReturnValue(mockFlyoutApi); - (useIsExperimentalFeatureEnabled as jest.Mock).mockReturnValue(false); + (useIsExperimentalFeatureEnabled as jest.Mock).mockReturnValue(true); }); it('when isFlyoutOpen is true, should return callback that opens left panel', () => { @@ -99,9 +99,9 @@ describe('useNavigateToSessionView', () => { }); }); - describe('when new navigation is enabled', () => { + describe('when newExpandableFlyoutNavigationDisabled is false', () => { beforeEach(() => { - (useIsExperimentalFeatureEnabled as jest.Mock).mockReturnValue(true); + (useIsExperimentalFeatureEnabled as jest.Mock).mockReturnValue(false); }); it('when isFlyoutOpen is true, should return callback that opens left panel', () => { const hookResult = renderHook(() => diff --git a/x-pack/solutions/security/plugins/security_solution/public/flyout/document_details/shared/hooks/use_navigate_to_session_view.tsx b/x-pack/solutions/security/plugins/security_solution/public/flyout/document_details/shared/hooks/use_navigate_to_session_view.tsx index 21171c1393c65..e015524e5deab 100644 --- a/x-pack/solutions/security/plugins/security_solution/public/flyout/document_details/shared/hooks/use_navigate_to_session_view.tsx +++ b/x-pack/solutions/security/plugins/security_solution/public/flyout/document_details/shared/hooks/use_navigate_to_session_view.tsx @@ -59,8 +59,8 @@ export const useNavigateToSessionView = ({ const { telemetry } = useKibana().services; const { openLeftPanel, openFlyout } = useExpandableFlyoutApi(); - const isNewNavigationEnabled = useIsExperimentalFeatureEnabled( - 'newExpandableFlyoutNavigationEnabled' + const isNewNavigationEnabled = !useIsExperimentalFeatureEnabled( + 'newExpandableFlyoutNavigationDisabled' ); const right: FlyoutPanelProps = useMemo( diff --git a/x-pack/solutions/security/plugins/security_solution/public/flyout/entity_details/host_right/hooks/use_navigate_to_host_details.test.ts b/x-pack/solutions/security/plugins/security_solution/public/flyout/entity_details/host_right/hooks/use_navigate_to_host_details.test.ts index 79171ef80c35e..700eb440e20a6 100644 --- a/x-pack/solutions/security/plugins/security_solution/public/flyout/entity_details/host_right/hooks/use_navigate_to_host_details.test.ts +++ b/x-pack/solutions/security/plugins/security_solution/public/flyout/entity_details/host_right/hooks/use_navigate_to_host_details.test.ts @@ -53,10 +53,10 @@ const mockOpenLeftPanel = jest.fn(); const mockOpenFlyout = jest.fn(); describe('useNavigateToHostDetails', () => { - describe('when preview navigation is enabled', () => { + describe('when newExpandableFlyoutNavigationDisabled is false', () => { beforeEach(() => { jest.clearAllMocks(); - (useIsExperimentalFeatureEnabled as jest.Mock).mockReturnValue(true); + (useIsExperimentalFeatureEnabled as jest.Mock).mockReturnValue(false); (useExpandableFlyoutApi as jest.Mock).mockReturnValue({ openLeftPanel: mockOpenLeftPanel, openFlyout: mockOpenFlyout, @@ -119,10 +119,10 @@ describe('useNavigateToHostDetails', () => { }); }); - describe('when preview navigation is not enabled', () => { + describe('when newExpandableFlyoutNavigationDisabled is true', () => { beforeEach(() => { jest.clearAllMocks(); - (useIsExperimentalFeatureEnabled as jest.Mock).mockReturnValue(false); + (useIsExperimentalFeatureEnabled as jest.Mock).mockReturnValue(true); (useExpandableFlyoutApi as jest.Mock).mockReturnValue({ openLeftPanel: mockOpenLeftPanel, openFlyout: mockOpenFlyout, diff --git a/x-pack/solutions/security/plugins/security_solution/public/flyout/entity_details/host_right/hooks/use_navigate_to_host_details.ts b/x-pack/solutions/security/plugins/security_solution/public/flyout/entity_details/host_right/hooks/use_navigate_to_host_details.ts index 2edc7a7c86c4e..85a80c94bb87b 100644 --- a/x-pack/solutions/security/plugins/security_solution/public/flyout/entity_details/host_right/hooks/use_navigate_to_host_details.ts +++ b/x-pack/solutions/security/plugins/security_solution/public/flyout/entity_details/host_right/hooks/use_navigate_to_host_details.ts @@ -45,8 +45,8 @@ export const useNavigateToHostDetails = ({ }: UseNavigateToHostDetailsParams): UseNavigateToHostDetailsResult => { const { telemetry } = useKibana().services; const { openLeftPanel, openFlyout } = useExpandableFlyoutApi(); - const isNewNavigationEnabled = useIsExperimentalFeatureEnabled( - 'newExpandableFlyoutNavigationEnabled' + const isNewNavigationEnabled = !useIsExperimentalFeatureEnabled( + 'newExpandableFlyoutNavigationDisabled' ); telemetry.reportEvent(EntityEventTypes.RiskInputsExpandedFlyoutOpened, { diff --git a/x-pack/solutions/security/plugins/security_solution/public/flyout/entity_details/service_right/hooks/use_navigate_to_service_details.test.ts b/x-pack/solutions/security/plugins/security_solution/public/flyout/entity_details/service_right/hooks/use_navigate_to_service_details.test.ts index 5299445cefc91..089bc33a3e3f4 100644 --- a/x-pack/solutions/security/plugins/security_solution/public/flyout/entity_details/service_right/hooks/use_navigate_to_service_details.test.ts +++ b/x-pack/solutions/security/plugins/security_solution/public/flyout/entity_details/service_right/hooks/use_navigate_to_service_details.test.ts @@ -53,10 +53,10 @@ const mockOpenLeftPanel = jest.fn(); const mockOpenFlyout = jest.fn(); describe('useNavigateToServiceDetails', () => { - describe('when preview navigation is enabled', () => { + describe('when newExpandableFlyoutNavigationDisabled is false', () => { beforeEach(() => { jest.clearAllMocks(); - (useIsExperimentalFeatureEnabled as jest.Mock).mockReturnValue(true); + (useIsExperimentalFeatureEnabled as jest.Mock).mockReturnValue(false); (useExpandableFlyoutApi as jest.Mock).mockReturnValue({ openLeftPanel: mockOpenLeftPanel, openFlyout: mockOpenFlyout, @@ -118,10 +118,10 @@ describe('useNavigateToServiceDetails', () => { }); }); - describe('when preview navigation is disabled', () => { + describe('when newExpandableFlyoutNavigationDisabled is true', () => { beforeEach(() => { jest.clearAllMocks(); - (useIsExperimentalFeatureEnabled as jest.Mock).mockReturnValue(false); + (useIsExperimentalFeatureEnabled as jest.Mock).mockReturnValue(true); (useExpandableFlyoutApi as jest.Mock).mockReturnValue({ openLeftPanel: mockOpenLeftPanel, openFlyout: mockOpenFlyout, diff --git a/x-pack/solutions/security/plugins/security_solution/public/flyout/entity_details/service_right/hooks/use_navigate_to_service_details.ts b/x-pack/solutions/security/plugins/security_solution/public/flyout/entity_details/service_right/hooks/use_navigate_to_service_details.ts index a8ec9fb80624a..135aa6b116309 100644 --- a/x-pack/solutions/security/plugins/security_solution/public/flyout/entity_details/service_right/hooks/use_navigate_to_service_details.ts +++ b/x-pack/solutions/security/plugins/security_solution/public/flyout/entity_details/service_right/hooks/use_navigate_to_service_details.ts @@ -45,8 +45,8 @@ export const useNavigateToServiceDetails = ({ }: UseNavigateToServiceDetailsParams): UseNavigateToServiceDetailsResult => { const { telemetry } = useKibana().services; const { openLeftPanel, openFlyout } = useExpandableFlyoutApi(); - const isNewNavigationEnabled = useIsExperimentalFeatureEnabled( - 'newExpandableFlyoutNavigationEnabled' + const isNewNavigationEnabled = !useIsExperimentalFeatureEnabled( + 'newExpandableFlyoutNavigationDisabled' ); const isLinkEnabled = !isPreviewMode || (isNewNavigationEnabled && isPreviewMode); diff --git a/x-pack/solutions/security/plugins/security_solution/public/flyout/entity_details/user_right/hooks/use_navigate_to_user_details.test.ts b/x-pack/solutions/security/plugins/security_solution/public/flyout/entity_details/user_right/hooks/use_navigate_to_user_details.test.ts index a5e3871cfa373..addf4a9255fa2 100644 --- a/x-pack/solutions/security/plugins/security_solution/public/flyout/entity_details/user_right/hooks/use_navigate_to_user_details.test.ts +++ b/x-pack/solutions/security/plugins/security_solution/public/flyout/entity_details/user_right/hooks/use_navigate_to_user_details.test.ts @@ -53,10 +53,10 @@ const mockOpenLeftPanel = jest.fn(); const mockOpenFlyout = jest.fn(); describe('useNavigateToUserDetails', () => { - describe('when preview navigation is enabled', () => { + describe('when newExpandableFlyoutNavigationDisabled is false', () => { beforeEach(() => { jest.clearAllMocks(); - (useIsExperimentalFeatureEnabled as jest.Mock).mockReturnValue(true); + (useIsExperimentalFeatureEnabled as jest.Mock).mockReturnValue(false); (useExpandableFlyoutApi as jest.Mock).mockReturnValue({ openLeftPanel: mockOpenLeftPanel, openFlyout: mockOpenFlyout, @@ -124,10 +124,10 @@ describe('useNavigateToUserDetails', () => { }); }); - describe('when preview navigation is disabled', () => { + describe('when newExpandableFlyoutNavigationDisabled is true', () => { beforeEach(() => { jest.clearAllMocks(); - (useIsExperimentalFeatureEnabled as jest.Mock).mockReturnValue(false); + (useIsExperimentalFeatureEnabled as jest.Mock).mockReturnValue(true); (useExpandableFlyoutApi as jest.Mock).mockReturnValue({ openLeftPanel: mockOpenLeftPanel, openFlyout: mockOpenFlyout, diff --git a/x-pack/solutions/security/plugins/security_solution/public/flyout/entity_details/user_right/hooks/use_navigate_to_user_details.ts b/x-pack/solutions/security/plugins/security_solution/public/flyout/entity_details/user_right/hooks/use_navigate_to_user_details.ts index 8903f56411af3..a9a2102a95485 100644 --- a/x-pack/solutions/security/plugins/security_solution/public/flyout/entity_details/user_right/hooks/use_navigate_to_user_details.ts +++ b/x-pack/solutions/security/plugins/security_solution/public/flyout/entity_details/user_right/hooks/use_navigate_to_user_details.ts @@ -50,8 +50,8 @@ export const useNavigateToUserDetails = ({ }: UseNavigateToUserDetailsParams): UseNavigateToUserDetailsResult => { const { telemetry } = useKibana().services; const { openLeftPanel, openFlyout } = useExpandableFlyoutApi(); - const isNewNavigationEnabled = useIsExperimentalFeatureEnabled( - 'newExpandableFlyoutNavigationEnabled' + const isNewNavigationEnabled = !useIsExperimentalFeatureEnabled( + 'newExpandableFlyoutNavigationDisabled' ); const isLinkEnabled = !isPreviewMode || (isNewNavigationEnabled && isPreviewMode); diff --git a/x-pack/solutions/security/plugins/security_solution/public/flyout/shared/components/flyout_navigation.test.tsx b/x-pack/solutions/security/plugins/security_solution/public/flyout/shared/components/flyout_navigation.test.tsx index 53a31c734e379..5afe2c0fb0f07 100644 --- a/x-pack/solutions/security/plugins/security_solution/public/flyout/shared/components/flyout_navigation.test.tsx +++ b/x-pack/solutions/security/plugins/security_solution/public/flyout/shared/components/flyout_navigation.test.tsx @@ -49,7 +49,7 @@ describe('', () => { jest.mocked(useExpandableFlyoutApi).mockReturnValue(flyoutContextValue); jest.mocked(useExpandableFlyoutState).mockReturnValue({} as unknown as ExpandableFlyoutState); jest.mocked(useExpandableFlyoutHistory).mockReturnValue([]); - jest.mocked(useIsExperimentalFeatureEnabled).mockReturnValue(false); + jest.mocked(useIsExperimentalFeatureEnabled).mockReturnValue(true); }); describe('when flyout is expandable', () => { @@ -137,9 +137,9 @@ describe('', () => { { lastOpen: Date.now(), panel: { id: 'id2', params: {} } }, ]; - describe('when flyout history is enabled', () => { + describe('when newExpandableFlyoutNavigationDisabled is false', () => { beforeEach(() => { - jest.mocked(useIsExperimentalFeatureEnabled).mockReturnValue(true); + jest.mocked(useIsExperimentalFeatureEnabled).mockReturnValue(false); jest.mocked(useExpandableFlyoutHistory).mockReturnValue(flyoutHistory); }); diff --git a/x-pack/solutions/security/plugins/security_solution/public/flyout/shared/components/flyout_navigation.tsx b/x-pack/solutions/security/plugins/security_solution/public/flyout/shared/components/flyout_navigation.tsx index 63fc411c347b0..c052f947e00d0 100644 --- a/x-pack/solutions/security/plugins/security_solution/public/flyout/shared/components/flyout_navigation.tsx +++ b/x-pack/solutions/security/plugins/security_solution/public/flyout/shared/components/flyout_navigation.tsx @@ -63,8 +63,8 @@ export const FlyoutNavigation: FC = memo( const { euiTheme } = useEuiTheme(); const history = useExpandableFlyoutHistory(); - const isNewNavigationEnabled = useIsExperimentalFeatureEnabled( - 'newExpandableFlyoutNavigationEnabled' + const isNewNavigationEnabled = !useIsExperimentalFeatureEnabled( + 'newExpandableFlyoutNavigationDisabled' ); const historyArray = useMemo(() => getProcessedHistory({ history, maxCount: 10 }), [history]); // Don't show history in rule preview