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

[ENDPOINT] Hide the Timeline Flyout while on the Management Pages #69998

Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,13 @@ import {
import React, { memo, MouseEventHandler, ReactNode, useMemo } from 'react';
import styled from 'styled-components';
import { EuiTabProps } from '@elastic/eui/src/components/tabs/tab';
import { gutterTimeline } from '../../lib/helpers';

const StyledEuiPage = styled(EuiPage)`
&.endpoint--isListView {
padding: 0 ${gutterTimeline} 0 ${(props) => props.theme.eui.euiSizeL};
padding: 0 ${(props) => props.theme.eui.euiSizeL};

.endpoint-header {
padding: ${(props) => props.theme.eui.euiSizeL} 0;
padding: ${(props) => props.theme.eui.euiSizeL};
margin-bottom: 0;
}
.endpoint-page-content {
Expand All @@ -44,7 +43,7 @@ const StyledEuiPage = styled(EuiPage)`
}
}
.endpoint-navTabs {
margin-left: ${(props) => props.theme.eui.euiSizeL};
margin-left: ${(props) => props.theme.eui.euiSizeM};
}
`;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import { useState, useEffect } from 'react';
import { useRouteSpy } from '../route/use_route_spy';

const hideTimelineForRoutes = [`/cases/configure`];
const hideTimelineForRoutes = [`/cases/configure`, '/management'];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it is easy!


export const useShowTimeline = () => {
const [{ pageName, pathName }] = useRouteSpy();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@ describe('when on the hosts page', () => {
render = () => mockedContext.render(<HostList />);
});

it('should NOT display timeline', async () => {
const renderResult = render();
const timelineFlyout = await renderResult.queryByTestId('flyoutOverlay');
expect(timelineFlyout).toBeNull();
});

it('should show a table', async () => {
const renderResult = render();
const table = await renderResult.findByTestId('hostListTable');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ describe('Policy Details', () => {
policyView = render(<PolicyDetails />);
});

it('should NOT display timeline', async () => {
expect(policyView.find('flyoutOverlay')).toHaveLength(0);
});

it('should show loader followed by error message', () => {
expect(policyView.find('EuiLoadingSpinner').length).toBe(1);
policyView.update();
Expand Down Expand Up @@ -84,6 +88,10 @@ describe('Policy Details', () => {
policyView = render(<PolicyDetails />);
});

it('should NOT display timeline', async () => {
expect(policyView.find('flyoutOverlay')).toHaveLength(0);
});

it('should display back to list button and policy title', () => {
policyView.update();
const pageHeaderLeft = policyView.find(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,12 @@ describe('when on the policies page', () => {
render = () => mockedContext.render(<PolicyList />);
});

it('should NOT display timeline', async () => {
const renderResult = render();
const timelineFlyout = await renderResult.queryByTestId('flyoutOverlay');
expect(timelineFlyout).toBeNull();
});

it('should show the empty state', async () => {
const renderResult = render();
const table = await renderResult.findByTestId('emptyPolicyTable');
Expand Down