Skip to content

Commit

Permalink
Remove isEventViewer prop no longer used
Browse files Browse the repository at this point in the history
  • Loading branch information
kqualters-elastic committed Sep 1, 2021
1 parent 61b08e0 commit 7a96424
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ const EventsViewerComponent: React.FC<Props> = ({
refetch={refetch}
/>

{graphEventId && <GraphOverlay isEventViewer={true} timelineId={id} />}
{graphEventId && <GraphOverlay timelineId={id} />}
<FullWidthFlexGroup $visible={!graphEventId} gutterSize="none">
<ScrollableFlexItem grow={1}>
<StatefulBody
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,9 +147,7 @@ const StatefulEventsViewerComponent: React.FC<Props> = ({
const trailingControlColumns: ControlColumnProps[] = EMPTY_CONTROL_COLUMNS;
const graphOverlay = useMemo(
() =>
graphEventId != null && graphEventId.length > 0 ? (
<GraphOverlay isEventViewer={true} timelineId={id} />
) : null,
graphEventId != null && graphEventId.length > 0 ? <GraphOverlay timelineId={id} /> : null,
[graphEventId, id]
);
const setQuery = useCallback(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,10 @@ describe('GraphOverlay', () => {
});

describe('when used in an events viewer (i.e. in the Detections view, or the Host > Events view)', () => {
const isEventViewer = true;

test('it has 100% width when isEventViewer is true and NOT in full screen mode', async () => {
test('it has 100% width when NOT in full screen mode', async () => {
const wrapper = mount(
<TestProviders>
<GraphOverlay timelineId={TimelineId.test} isEventViewer={isEventViewer} />
<GraphOverlay timelineId={TimelineId.test} />
</TestProviders>
);

Expand All @@ -59,9 +57,9 @@ describe('GraphOverlay', () => {
});
});

test('it has a fixed position when isEventViewer is true in full screen mode', async () => {
test('it has a fixed position when in full screen mode', async () => {
(useGlobalFullScreen as jest.Mock).mockReturnValue({
globalFullScreen: true, // <-- true when an events viewer is in full screen mode
globalFullScreen: true,
setGlobalFullScreen: jest.fn(),
});
(useTimelineFullScreen as jest.Mock).mockReturnValue({
Expand All @@ -71,7 +69,7 @@ describe('GraphOverlay', () => {

const wrapper = mount(
<TestProviders>
<GraphOverlay timelineId={TimelineId.test} isEventViewer={isEventViewer} />
<GraphOverlay timelineId={TimelineId.test} />
</TestProviders>
);

Expand All @@ -83,13 +81,12 @@ describe('GraphOverlay', () => {
});

describe('when used in the active timeline', () => {
const isEventViewer = false;
const timelineId = TimelineId.active;

test('it has 100% width when isEventViewer is false and NOT in full screen mode', async () => {
test('it has 100% width when NOT in full screen mode', async () => {
const wrapper = mount(
<TestProviders>
<GraphOverlay timelineId={timelineId} isEventViewer={isEventViewer} />
<GraphOverlay timelineId={timelineId} />
</TestProviders>
);

Expand All @@ -99,7 +96,7 @@ describe('GraphOverlay', () => {
});
});

test('it has 100% width when isEventViewer is false and the active timeline is in full screen mode', async () => {
test('it has 100% width when the active timeline is in full screen mode', async () => {
(useGlobalFullScreen as jest.Mock).mockReturnValue({
globalFullScreen: false,
setGlobalFullScreen: jest.fn(),
Expand All @@ -111,7 +108,7 @@ describe('GraphOverlay', () => {

const wrapper = mount(
<TestProviders>
<GraphOverlay timelineId={timelineId} isEventViewer={isEventViewer} />
<GraphOverlay timelineId={timelineId} />
</TestProviders>
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,10 @@ import {
import * as i18n from './translations';

const OverlayContainer = styled.div`
${({ $restrictWidth }: { $restrictWidth: boolean }) =>
`
display: flex;
flex-direction: column;
flex: 1;
width: ${$restrictWidth ? 'calc(100% - 36px)' : '100%'};
`}
display: flex;
flex-direction: column;
flex: 1;
width: 100%;
`;

const FullScreenOverlayContainer = styled.div`
Expand All @@ -68,7 +65,6 @@ const FullScreenButtonIcon = styled(EuiButtonIcon)`
`;

interface OwnProps {
isEventViewer: boolean;
timelineId: TimelineId;
}

Expand Down Expand Up @@ -120,7 +116,7 @@ NavigationComponent.displayName = 'NavigationComponent';

const Navigation = React.memo(NavigationComponent);

const GraphOverlayComponent: React.FC<OwnProps> = ({ isEventViewer, timelineId }) => {
const GraphOverlayComponent: React.FC<OwnProps> = ({ timelineId }) => {
const dispatch = useDispatch();
const { globalFullScreen, setGlobalFullScreen } = useGlobalFullScreen();
const { timelineFullScreen, setTimelineFullScreen } = useTimelineFullScreen();
Expand Down Expand Up @@ -223,7 +219,7 @@ const GraphOverlayComponent: React.FC<OwnProps> = ({ isEventViewer, timelineId }
);
} else {
return (
<OverlayContainer data-test-subj="overlayContainer" $restrictWidth={isEventViewer}>
<OverlayContainer data-test-subj="overlayContainer">
<EuiHorizontalRule margin="none" />
<EuiFlexGroup gutterSize="none" justifyContent="spaceBetween">
<EuiFlexItem grow={false}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const GraphTabContentComponent: React.FC<GraphTabContentProps> = ({ timelineId }
return null;
}

return <GraphOverlay isEventViewer={false} timelineId={timelineId} />;
return <GraphOverlay timelineId={timelineId} />;
};

GraphTabContentComponent.displayName = 'GraphTabContentComponent';
Expand Down

0 comments on commit 7a96424

Please sign in to comment.