Skip to content

Commit 2287579

Browse files
[Security Solution] Full screen timeline, Collapse event (#71786)
## Full screen Timeline & Timeline-based views - Adds a _Full screen_ mode to Timeline, and all Timeline-based views, including: - Detections - Detections > Rule details - Hosts > Events - Hosts > External alerts - Network > External alerts - Timeline - Enter full screen from any Resolver - Adds a `Collapse event` action for quickly collapsing an expanded Timeline event - Hides the `Add to case action` in timeline-based Resolver views, so those actions are only enabled in Timeline (a `TODO` from #70111) ### Full screen detections ![full-screen-detections](https://user-images.githubusercontent.com/4459398/87493332-d348f280-c609-11ea-9399-126d2259daa2.gif) ### Enter full screen from any Resolver ![full-screen-resolver](https://user-images.githubusercontent.com/4459398/87493348-de038780-c609-11ea-86a3-52ab24055e38.gif) ### Full screen Timeline ![full-screen-timeline](https://user-images.githubusercontent.com/4459398/87493394-f4114800-c609-11ea-8d62-4add291d937a.gif) ### Collapse event ![collapse-event](https://user-images.githubusercontent.com/4459398/87493408-fa9fbf80-c609-11ea-88c8-fa87d82d1eb1.gif) ### Sort tooltip ![sort-tooltip](https://user-images.githubusercontent.com/4459398/87493417-012e3700-c60a-11ea-9905-44e3b7cfe60f.gif)
1 parent 9f8b365 commit 2287579

File tree

179 files changed

+1927
-870
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

179 files changed

+1927
-870
lines changed

x-pack/plugins/security_solution/common/constants.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ export const DEFAULT_INTERVAL_PAUSE = true;
3232
export const DEFAULT_INTERVAL_TYPE = 'manual';
3333
export const DEFAULT_INTERVAL_VALUE = 300000; // ms
3434
export const DEFAULT_TIMEPICKER_QUICK_RANGES = 'timepicker:quickRanges';
35+
export const FILTERS_GLOBAL_HEIGHT = 109; // px
36+
export const FULL_SCREEN_TOGGLED_CLASS_NAME = 'fullScreenToggled';
3537
export const NO_ALERT_INDEX = 'no-alert-index-049FC71A-4C2C-446F-9901-37XMC5024C51';
3638
export const ENDPOINT_METADATA_INDEX = 'metrics-endpoint.metadata-*';
3739

x-pack/plugins/security_solution/public/app/home/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ Main.displayName = 'Main';
3232
const usersViewing = ['elastic']; // TODO: get the users viewing this timeline from Elasticsearch (persistance)
3333

3434
/** the global Kibana navigation at the top of every page */
35-
const globalHeaderHeightPx = 48;
35+
export const globalHeaderHeightPx = 48;
3636

3737
const calculateFlyoutHeight = ({
3838
globalHeaderSize,

x-pack/plugins/security_solution/public/cases/components/all_cases/columns.test.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import React from 'react';
88
import { mount } from 'enzyme';
99

10+
import '../../../common/mock/match_media';
1011
import { ExternalServiceColumn } from './columns';
1112

1213
import { useGetCasesMockState } from '../../containers/mock';

x-pack/plugins/security_solution/public/cases/components/all_cases/index.test.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
import React from 'react';
88
import { mount } from 'enzyme';
99
import moment from 'moment-timezone';
10+
11+
import '../../../common/mock/match_media';
1012
import { AllCases } from '.';
1113
import { TestProviders } from '../../../common/mock';
1214
import { useGetCasesMockState } from '../../containers/mock';

x-pack/plugins/security_solution/public/cases/components/all_cases_modal/index.test.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
*/
66
import { mount } from 'enzyme';
77
import React from 'react';
8+
import '../../../common/mock/match_media';
89
import { AllCasesModal } from '.';
910
import { TestProviders } from '../../../common/mock';
1011

x-pack/plugins/security_solution/public/cases/components/case_view/index.test.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import React from 'react';
88
import { mount } from 'enzyme';
99

10+
import '../../../common/mock/match_media';
1011
import { Router, routeData, mockHistory, mockLocation } from '../__mock__/router';
1112
import { CaseComponent, CaseProps, CaseView } from '.';
1213
import { basicCase, basicCaseClosed, caseUserActions } from '../../containers/mock';

x-pack/plugins/security_solution/public/cases/components/configure_cases/button.test.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import React from 'react';
88
import { ReactWrapper, mount } from 'enzyme';
99
import { EuiText } from '@elastic/eui';
1010

11+
import '../../../common/mock/match_media';
1112
import { ConfigureCaseButton, ConfigureCaseButtonProps } from './button';
1213
import { TestProviders } from '../../../common/mock';
1314
import { searchURL } from './__mock__';

x-pack/plugins/security_solution/public/cases/components/use_push_to_service/index.test.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
/* eslint-disable react/display-name */
77
import React from 'react';
88
import { renderHook, act } from '@testing-library/react-hooks';
9+
10+
import '../../../common/mock/match_media';
911
import { usePushToService, ReturnUsePushToService, UsePushToService } from '.';
1012
import { TestProviders } from '../../../common/mock';
1113
import { usePostPushToService } from '../../containers/use_post_push_to_service';

x-pack/plugins/security_solution/public/common/components/alerts_viewer/alerts_table.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,13 +58,15 @@ const defaultAlertsFilters: Filter[] = [
5858
interface Props {
5959
timelineId: TimelineIdLiteral;
6060
endDate: string;
61+
eventsViewerBodyHeight?: number;
6162
startDate: string;
6263
pageFilters?: Filter[];
6364
}
6465

6566
const AlertsTableComponent: React.FC<Props> = ({
6667
timelineId,
6768
endDate,
69+
eventsViewerBodyHeight,
6870
startDate,
6971
pageFilters = [],
7072
}) => {
@@ -91,6 +93,7 @@ const AlertsTableComponent: React.FC<Props> = ({
9193
pageFilters={alertsFilter}
9294
defaultModel={alertsDefaultModel}
9395
end={endDate}
96+
height={eventsViewerBodyHeight}
9497
id={timelineId}
9598
start={startDate}
9699
/>

x-pack/plugins/security_solution/public/common/components/alerts_viewer/index.tsx

Lines changed: 36 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,18 @@
55
*/
66
import React, { useEffect, useCallback, useMemo } from 'react';
77
import numeral from '@elastic/numeral';
8+
import { useWindowSize } from 'react-use';
9+
10+
import { globalHeaderHeightPx } from '../../../app/home';
11+
import { DEFAULT_NUMBER_FORMAT, FILTERS_GLOBAL_HEIGHT } from '../../../../common/constants';
12+
import { useFullScreen } from '../../containers/use_full_screen';
13+
import { EVENTS_VIEWER_HEADER_HEIGHT } from '../events_viewer/events_viewer';
14+
import {
15+
getEventsViewerBodyHeight,
16+
MIN_EVENTS_VIEWER_BODY_HEIGHT,
17+
} from '../../../timelines/components/timeline/body/helpers';
18+
import { footerHeight } from '../../../timelines/components/timeline/footer';
819

9-
import { DEFAULT_NUMBER_FORMAT } from '../../../../common/constants';
1020
import { AlertsComponentsProps } from './types';
1121
import { AlertsTable } from './alerts_table';
1222
import * as i18n from './translations';
@@ -35,6 +45,8 @@ export const AlertsView = ({
3545
// eslint-disable-next-line react-hooks/exhaustive-deps
3646
[]
3747
);
48+
const { height: windowHeight } = useWindowSize();
49+
const { globalFullScreen } = useFullScreen();
3850
const alertsHistogramConfigs: MatrixHisrogramConfigs = useMemo(
3951
() => ({
4052
...histogramConfigs,
@@ -52,19 +64,32 @@ export const AlertsView = ({
5264

5365
return (
5466
<>
55-
<MatrixHistogramContainer
56-
endDate={endDate}
57-
filterQuery={filterQuery}
58-
id={ID}
59-
setQuery={setQuery}
60-
sourceId="default"
61-
startDate={startDate}
62-
type={type}
63-
{...alertsHistogramConfigs}
64-
/>
67+
{!globalFullScreen && (
68+
<MatrixHistogramContainer
69+
endDate={endDate}
70+
filterQuery={filterQuery}
71+
id={ID}
72+
setQuery={setQuery}
73+
sourceId="default"
74+
startDate={startDate}
75+
type={type}
76+
{...alertsHistogramConfigs}
77+
/>
78+
)}
6579
<AlertsTable
6680
timelineId={timelineId}
6781
endDate={endDate}
82+
eventsViewerBodyHeight={
83+
globalFullScreen
84+
? getEventsViewerBodyHeight({
85+
footerHeight,
86+
headerHeight: EVENTS_VIEWER_HEADER_HEIGHT,
87+
kibanaChromeHeight: globalHeaderHeightPx,
88+
otherContentHeight: FILTERS_GLOBAL_HEIGHT,
89+
windowHeight,
90+
})
91+
: MIN_EVENTS_VIEWER_BODY_HEIGHT
92+
}
6893
startDate={startDate}
6994
pageFilters={pageFilters}
7095
/>

0 commit comments

Comments
 (0)