[Security Solution] Enable new flyout navigation flag (#211330)

## Summary

Changed `newExpandableFlyoutNavigationEnabled` to
`newExpandableFlyoutNavigationDisabled`. The flyout history and preview
navigation are now enabled by default.

Default (`newExpandableFlyoutNavigationDisabled` off)
- History icon show up in flyout
- Links in preview will open a new flyout



https://github.com/user-attachments/assets/10f558fa-3c4c-4718-9f7e-cce6a19ead8b



`newExpandableFlyoutNavigationDisabled` on
- No history shown
- Title links in preview disabled



https://github.com/user-attachments/assets/fcd6ab33-5c88-4c5b-b0c5-02cbcf14c40d




### Checklist

- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios
- [x] The PR description includes the appropriate Release Notes section,
and the correct `release_note:*` label is applied per the
[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
This commit is contained in:
christineweng 2025-02-19 13:36:12 -06:00 committed by GitHub
parent bc3fae5356
commit e3f166b70c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
27 changed files with 255 additions and 246 deletions

View file

@ -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

View file

@ -82,187 +82,195 @@ 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(),
});
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', () => {
(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();
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(
queryByTestId(EXPANDABLE_PANEL_HEADER_TITLE_LINK_TEST_ID(ANALYZER_PREVIEW_TEST_ID))
).not.toBeInTheDocument();
const { investigateInTimelineAlertClick } = useInvestigateInTimeline({});
expect(investigateInTimelineAlertClick).not.toHaveBeenCalled();
});
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(),
});
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();
});
});
describe('when visualizationInFlyoutEnabled is enabled', () => {
it('should open left flyout visualization tab when clicking on title', () => {
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 { getByTestId } = renderAnalyzerPreview();
getByTestId(EXPANDABLE_PANEL_HEADER_TITLE_LINK_TEST_ID(ANALYZER_PREVIEW_TEST_ID)).click();
expect(mockNavigateToAnalyzer).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(),
});
const { queryByTestId } = renderAnalyzerPreview({ ...mockContextValue, isPreview: 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 true', () => {
beforeEach(() => {
jest.clearAllMocks();
(useIsExperimentalFeatureEnabled as jest.Mock).mockReturnValue(true);
});
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(),
});
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', () => {
(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();
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(
queryByTestId(EXPANDABLE_PANEL_HEADER_TITLE_LINK_TEST_ID(ANALYZER_PREVIEW_TEST_ID))
).not.toBeInTheDocument();
const { investigateInTimelineAlertClick } = useInvestigateInTimeline({});
expect(investigateInTimelineAlertClick).not.toHaveBeenCalled();
});
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(),
});
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();
});
});
describe('when visualizationInFlyoutEnabled is enabled', () => {
it('should open left flyout visualization tab when clicking on title', () => {
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 { getByTestId } = renderAnalyzerPreview();
getByTestId(EXPANDABLE_PANEL_HEADER_TITLE_LINK_TEST_ID(ANALYZER_PREVIEW_TEST_ID)).click();
expect(mockNavigateToAnalyzer).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(),
});
const { queryByTestId } = renderAnalyzerPreview({ ...mockContextValue, isPreview: 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 newExpandableFlyoutNavigationDisabled is false', () => {
beforeEach(() => {
(useIsExperimentalFeatureEnabled as jest.Mock).mockReturnValue(false);
});
describe('when visualizationInFlyoutEnabled is enabled', () => {
beforeEach(() => {
mockUseUiSetting.mockReturnValue([true]);

View file

@ -37,8 +37,8 @@ export const AnalyzerPreviewContainer: React.FC = () => {
const [visualizationInFlyoutEnabled] = useUiSetting$<boolean>(
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);

View file

@ -47,7 +47,7 @@ const renderResponseSection = () =>
describe('<ResponseSection />', () => {
beforeEach(() => {
mockUseIsExperimentalFeatureEnabled.mockReturnValue(false);
mockUseIsExperimentalFeatureEnabled.mockReturnValue(true);
});
it('should render response component', () => {
@ -155,9 +155,9 @@ describe('<ResponseSection />', () => {
expect(container).toBeEmptyDOMElement();
});
describe('newExpandableFlyoutNavigationEnabled', () => {
describe('newExpandableFlyoutNavigationDisabled is false', () => {
beforeEach(() => {
mockUseIsExperimentalFeatureEnabled.mockReturnValue(true);
mockUseIsExperimentalFeatureEnabled.mockReturnValue(false);
});
it('should render if isPreviewMode is true', () => {

View file

@ -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(() => {

View file

@ -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', () => {

View file

@ -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();

View file

@ -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,

View file

@ -116,8 +116,8 @@ export const AlertCountInsight: React.FC<AlertCountInsightProps> = ({
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();

View file

@ -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 } },
});

View file

@ -83,8 +83,8 @@ export const MisconfigurationsInsight: React.FC<MisconfigurationsInsightProps> =
pageSize: 1,
});
const isNewNavigationEnabled = useIsExperimentalFeatureEnabled(
'newExpandableFlyoutNavigationEnabled'
const isNewNavigationEnabled = !useIsExperimentalFeatureEnabled(
'newExpandableFlyoutNavigationDisabled'
);
const passedFindings = data?.count.passed || 0;

View file

@ -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 } },
});

View file

@ -80,8 +80,8 @@ export const VulnerabilitiesInsight: React.FC<VulnerabilitiesInsightProps> = ({
pageSize: 1,
});
const isNewNavigationEnabled = useIsExperimentalFeatureEnabled(
'newExpandableFlyoutNavigationEnabled'
const isNewNavigationEnabled = !useIsExperimentalFeatureEnabled(
'newExpandableFlyoutNavigationDisabled'
);
const { CRITICAL = 0, HIGH = 0, MEDIUM = 0, LOW = 0, NONE = 0 } = data?.count || {};

View file

@ -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', () => {

View file

@ -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(

View file

@ -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', () => {

View file

@ -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);

View file

@ -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(() =>

View file

@ -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(

View file

@ -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,
@ -118,10 +118,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,

View file

@ -43,8 +43,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, {

View file

@ -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,

View file

@ -43,8 +43,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);

View file

@ -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,

View file

@ -48,8 +48,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);

View file

@ -49,7 +49,7 @@ describe('<FlyoutNavigation />', () => {
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('<FlyoutNavigation />', () => {
{ 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);
});

View file

@ -63,8 +63,8 @@ export const FlyoutNavigation: FC<FlyoutNavigationProps> = 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