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

[Security Solution] Manage timeline templates user flow #67837

Merged
Show file tree
Hide file tree
Changes from 134 commits
Commits
Show all changes
140 commits
Select commit Hold shift + click to select a range
6031d22
add template btn
angorayc May 13, 2020
c38e8ac
rename file
angorayc May 13, 2020
d9dc0b7
Merge remote-tracking branch 'upstream/master' into template-btn
angorayc May 14, 2020
b5df002
unit test
angorayc May 14, 2020
22c875c
Merge remote-tracking branch 'upstream/master' into template-btn
angorayc May 15, 2020
37ee874
Merge remote-tracking branch 'upstream/master' into template-btn
angorayc May 15, 2020
9d8bae5
replace connector with useDispatch
angorayc May 15, 2020
6c806a0
Merge remote-tracking branch 'upstream/master' into template-btn
angorayc May 15, 2020
d8ce05b
comments
angorayc May 15, 2020
f41170f
add disableTemplate
angorayc May 18, 2020
42aabde
rename flag
angorayc May 18, 2020
7244827
Merge remote-tracking branch 'upstream/master' into template-btn
angorayc May 18, 2020
6d36589
fix types
angorayc May 18, 2020
38686d7
remove snapshot
angorayc May 18, 2020
20075bc
Merge remote-tracking branch 'upstream/master' into template-btn
angorayc May 28, 2020
a28f04f
fix types
angorayc May 29, 2020
957b4fb
WIP
patrykkopycinski May 31, 2020
2a70bb6
Merge branch 'master' into template-btn
elasticmachine Jun 1, 2020
7e49075
add fix action
angorayc Jun 1, 2020
dc4c13e
move disableTemplate flag into constants
angorayc Jun 1, 2020
93e2138
fix types
angorayc Jun 1, 2020
d4f2190
WIP
patrykkopycinski Jun 1, 2020
5d29f12
Fix timelineType
patrykkopycinski Jun 1, 2020
b1c436c
button style
angorayc Jun 2, 2020
849c110
Merge branch 'master' of github.com:elastic/kibana into feat/create-t…
patrykkopycinski Jun 2, 2020
5f023a8
unit test
angorayc Jun 2, 2020
caa31e0
unit test
angorayc Jun 2, 2020
73789cf
Merge remote-tracking branch 'upstream/master' into template-btn
angorayc Jun 2, 2020
16f26fb
WIP
patrykkopycinski Jun 2, 2020
b86578a
fix types
angorayc Jun 2, 2020
27cc4d2
Update x-pack/plugins/siem/public/timelines/components/timeline/prope…
angorayc Jun 2, 2020
682197c
WIP
patrykkopycinski Jun 3, 2020
218c25b
Merge branch 'master' of github.com:elastic/kibana into feat/create-t…
patrykkopycinski Jun 3, 2020
1dcb918
fix unit test
angorayc Jun 3, 2020
13f8b36
Merge branch 'master' of github.com:elastic/kibana into feat/create-t…
patrykkopycinski Jun 3, 2020
f38a817
add unit test
angorayc Jun 3, 2020
d339c20
Fix tests
patrykkopycinski Jun 3, 2020
1fa65ff
add unit test
angorayc Jun 3, 2020
b8a1e64
fix tests
patrykkopycinski Jun 3, 2020
29079a8
Merge branch 'master' of github.com:elastic/kibana into feat/create-t…
patrykkopycinski Jun 3, 2020
256d907
fix types
angorayc Jun 3, 2020
a7eba1f
Merge remote-tracking branch 'upstream/master' into template-btn
angorayc Jun 3, 2020
c0cb537
WIP
patrykkopycinski Jun 4, 2020
62205c7
Merge branch 'master' of github.com:elastic/kibana into feat/create-t…
patrykkopycinski Jun 4, 2020
cfa87ab
Merge branch 'master' of github.com:elastic/kibana into feat/create-t…
patrykkopycinski Jun 4, 2020
9ef7ff3
fix tests
angorayc Jun 4, 2020
5fddf41
Merge remote-tracking branch 'upstream/master' into template-btn
angorayc Jun 4, 2020
3832847
fix unit
angorayc Jun 4, 2020
4a9d535
Merge branch 'master' of github.com:elastic/kibana into feat/create-t…
patrykkopycinski Jun 4, 2020
37475e0
cleanup
patrykkopycinski Jun 4, 2020
924ed69
fix i18n key
angorayc Jun 4, 2020
d989582
remove snapshot
angorayc Jun 4, 2020
cba4c58
Merge branch 'template-btn' of github.com:angorayc/kibana into feat/c…
patrykkopycinski Jun 4, 2020
3b0f5b9
WIP
patrykkopycinski Jun 4, 2020
1871a75
Merge branch 'master' into template-btn
elasticmachine Jun 4, 2020
56a47af
Merge branch 'master' into template-btn
elasticmachine Jun 5, 2020
c8313a4
fix crud
angorayc Jun 5, 2020
5e7c7b4
fix crud
angorayc Jun 5, 2020
3ea0722
Merge branch 'template-btn' of github.com:angorayc/kibana into templa…
angorayc Jun 5, 2020
5705d2e
fix unit
angorayc Jun 5, 2020
570f917
Merge branch 'master' into template-btn
elasticmachine Jun 5, 2020
ad24a6a
fix tag
angorayc Jun 5, 2020
5244333
Merge branch 'template-btn' of github.com:angorayc/kibana into templa…
angorayc Jun 5, 2020
d4416b1
Merge branch 'template-btn' of github.com:angorayc/kibana into feat/c…
patrykkopycinski Jun 6, 2020
15da74c
Merge branch 'template-btn' of github.com:angorayc/kibana into feat/c…
patrykkopycinski Jun 6, 2020
f2bc276
Merge branch 'master' of github.com:elastic/kibana into feat/create-t…
patrykkopycinski Jun 6, 2020
2a31aba
Merge branch 'master' of github.com:elastic/kibana into feat/create-t…
patrykkopycinski Jun 7, 2020
dcc99b2
cleanup
patrykkopycinski Jun 7, 2020
89ad223
Merge branch 'master' into template-btn
elasticmachine Jun 8, 2020
7749f4c
fix unit
angorayc Jun 8, 2020
9161f97
disable template timeline
angorayc Jun 8, 2020
6fb1e3b
Merge branch 'template-btn' of github.com:angorayc/kibana into feat/c…
patrykkopycinski Jun 8, 2020
ead4342
cleanup
patrykkopycinski Jun 8, 2020
9735938
Merge branch 'master' of github.com:elastic/kibana into feat/create-t…
patrykkopycinski Jun 8, 2020
53479e8
Merge branch 'master' into template-btn
elasticmachine Jun 9, 2020
87df75f
Merge branch 'template-btn' of github.com:angorayc/kibana into feat/c…
patrykkopycinski Jun 9, 2020
5a2ed1e
Merge branch 'master' of github.com:elastic/kibana into feat/create-t…
patrykkopycinski Jun 9, 2020
dec0228
Merge branch 'master' of github.com:elastic/kibana into feat/create-t…
patrykkopycinski Jun 9, 2020
9a67ed8
fix tests
patrykkopycinski Jun 9, 2020
bdc4e87
Cleanup
patrykkopycinski Jun 9, 2020
3422887
fix types
patrykkopycinski Jun 9, 2020
1d33000
Merge branch 'master' of github.com:elastic/kibana into feat/create-t…
patrykkopycinski Jun 10, 2020
5a9f947
Merge branch 'master' of github.com:elastic/kibana into feat/create-t…
patrykkopycinski Jun 10, 2020
924c6e9
Merge branch 'master' of github.com:elastic/kibana into feat/create-t…
patrykkopycinski Jun 10, 2020
3223baf
Merge branch 'master' of github.com:elastic/kibana into feat/create-t…
patrykkopycinski Jun 10, 2020
90ac0ba
Merge branch 'master' of github.com:elastic/kibana into feat/create-t…
patrykkopycinski Jun 15, 2020
3346295
Merge branch 'master' of github.com:elastic/kibana into feat/create-t…
patrykkopycinski Jun 15, 2020
057008a
Merge branch 'master' of github.com:elastic/kibana into feat/create-t…
patrykkopycinski Jun 15, 2020
837f5bb
Merge branch 'master' of github.com:elastic/kibana into feat/create-t…
patrykkopycinski Jun 15, 2020
f047649
Merge branch 'master' of github.com:elastic/kibana into feat/create-t…
patrykkopycinski Jun 15, 2020
42fb938
UX comments
patrykkopycinski Jun 16, 2020
b71e86c
Merge branch 'master' of github.com:elastic/kibana into feat/create-t…
patrykkopycinski Jun 16, 2020
591a417
Merge branch 'master' of github.com:elastic/kibana into feat/create-t…
patrykkopycinski Jun 23, 2020
84373be
Merge branch 'master' of github.com:elastic/kibana into feat/create-t…
patrykkopycinski Jun 24, 2020
864c264
Fix naming
patrykkopycinski Jun 24, 2020
381f7f2
bug fixes
patrykkopycinski Jun 24, 2020
ee369d2
WIP
patrykkopycinski Jun 24, 2020
38d24fd
Merge branch 'master' of github.com:elastic/kibana into feat/create-t…
patrykkopycinski Jun 25, 2020
fd0b384
WIP
patrykkopycinski Jun 25, 2020
8d574b6
Merge branch 'master' of github.com:elastic/kibana into feat/create-t…
patrykkopycinski Jun 25, 2020
06af1fc
Merge branch 'master' of github.com:elastic/kibana into feat/create-t…
patrykkopycinski Jun 25, 2020
ed69bbc
Merge branch 'master' of github.com:elastic/kibana into feat/create-t…
patrykkopycinski Jun 25, 2020
ecd6e7f
WIP
patrykkopycinski Jun 25, 2020
c83c18b
Merge branch 'master' of github.com:elastic/kibana into feat/create-t…
patrykkopycinski Jun 25, 2020
cdbc133
Merge branch 'master' of github.com:elastic/kibana into feat/create-t…
patrykkopycinski Jun 26, 2020
6321c7d
Merge branch 'master' of github.com:elastic/kibana into feat/create-t…
patrykkopycinski Jun 26, 2020
239f0fe
Merge branch 'master' of github.com:elastic/kibana into feat/create-t…
patrykkopycinski Jun 28, 2020
32dcacb
cleanup
patrykkopycinski Jun 28, 2020
f78396c
types
patrykkopycinski Jun 28, 2020
f67d5a9
cleanup
patrykkopycinski Jun 28, 2020
afb53fc
cleanup
patrykkopycinski Jun 29, 2020
c73e1a4
Merge branch 'master' of github.com:elastic/kibana into feat/create-t…
patrykkopycinski Jun 29, 2020
491ccb3
FIx i18n
patrykkopycinski Jun 29, 2020
b3f6956
cleanup
patrykkopycinski Jun 30, 2020
aa14f08
Merge branch 'master' of github.com:elastic/kibana into feat/create-t…
patrykkopycinski Jun 30, 2020
0a7c3c2
Merge branch 'master' of github.com:elastic/kibana into feat/create-t…
patrykkopycinski Jun 30, 2020
f7bd7ed
Merge branch 'master' of github.com:elastic/kibana into feat/create-t…
patrykkopycinski Jun 30, 2020
54ce92b
cleanup
patrykkopycinski Jun 30, 2020
823f540
revert file
patrykkopycinski Jun 30, 2020
12e2020
Merge branch 'master' into feat/create-timeline-template-flow
elasticmachine Jul 3, 2020
fc41226
Merge branch 'master' of github.com:elastic/kibana into feat/create-t…
patrykkopycinski Jul 7, 2020
be2c82c
cleanup timelineType
patrykkopycinski Jul 7, 2020
6247451
PR comments
patrykkopycinski Jul 7, 2020
0d5534d
Merge branch 'master' of github.com:elastic/kibana into feat/create-t…
patrykkopycinski Jul 7, 2020
24fa740
Fix browserFields
patrykkopycinski Jul 7, 2020
5bf9445
Merge branch 'master' of github.com:elastic/kibana into feat/create-t…
patrykkopycinski Jul 7, 2020
39371a9
Merge branch 'master' of github.com:elastic/kibana into feat/create-t…
patrykkopycinski Jul 7, 2020
2a8d8fc
default to elastic
patrykkopycinski Jul 7, 2020
1d5c5ff
Merge branch 'master' into feat/create-timeline-template-flow
elasticmachine Jul 7, 2020
c7d8088
Merge branch 'feat/create-timeline-template-flow' of github.com:patry…
patrykkopycinski Jul 8, 2020
7e456a9
Merge branch 'master' of github.com:elastic/kibana into feat/create-t…
patrykkopycinski Jul 8, 2020
94b7441
Fix sendAlertToTimelineAction
patrykkopycinski Jul 8, 2020
d7928ce
Merge branch 'master' of github.com:elastic/kibana into feat/create-t…
patrykkopycinski Jul 8, 2020
1a9b2dd
fix cypress and revert changes to providerId
patrykkopycinski Jul 8, 2020
bfc29eb
fix type
patrykkopycinski Jul 8, 2020
3d9affd
fix types
patrykkopycinski Jul 8, 2020
6a9e07c
Merge branch 'master' of github.com:elastic/kibana into feat/create-t…
patrykkopycinski Jul 9, 2020
46a4153
return proper timeline templates
patrykkopycinski Jul 9, 2020
9096e96
Merge branch 'master' into feat/create-timeline-template-flow
elasticmachine Jul 9, 2020
9b9a6d3
Merge branch 'master' into feat/create-timeline-template-flow
elasticmachine Jul 9, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 0 additions & 7 deletions x-pack/plugins/security_solution/common/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -165,13 +165,6 @@ export const showAllOthersBucket: string[] = [
'user.name',
];

/**
* CreateTemplateTimelineBtn
* https://github.com/elastic/kibana/pull/66613
* Remove the comment here to enable template timeline
*/
export const disableTemplate = false;

/*
* This should be set to true after https://github.com/elastic/kibana/pull/67496 is merged
*/
Expand Down
13 changes: 12 additions & 1 deletion x-pack/plugins/security_solution/common/types/timeline/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,16 @@ const SavedDataProviderQueryMatchRuntimeType = runtimeTypes.partial({
queryMatch: unionWithNullType(SavedDataProviderQueryMatchBasicRuntimeType),
});

export enum DataProviderType {
default = 'default',
template = 'template',
}

export const DataProviderTypeLiteralRt = runtimeTypes.union([
runtimeTypes.literal(DataProviderType.default),
runtimeTypes.literal(DataProviderType.template),
]);

const SavedDataProviderRuntimeType = runtimeTypes.partial({
id: unionWithNullType(runtimeTypes.string),
name: unionWithNullType(runtimeTypes.string),
Expand All @@ -58,6 +68,7 @@ const SavedDataProviderRuntimeType = runtimeTypes.partial({
kqlQuery: unionWithNullType(runtimeTypes.string),
queryMatch: unionWithNullType(SavedDataProviderQueryMatchBasicRuntimeType),
and: unionWithNullType(runtimeTypes.array(SavedDataProviderQueryMatchRuntimeType)),
type: unionWithNullType(DataProviderTypeLiteralRt),
});

/*
Expand Down Expand Up @@ -154,7 +165,7 @@ export type TimelineStatusLiteralWithNull = runtimeTypes.TypeOf<
>;

/**
* Template timeline type
* Timeline template type
*/

export enum TemplateTimelineType {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { reload } from '../tasks/common';
import { loginAndWaitForPage } from '../tasks/login';
import { HOSTS_URL } from '../urls/navigation';
import { openEvents } from '../tasks/hosts/main';
import { DRAGGABLE_HEADER } from '../screens/timeline';
import { EVENTS_VIEWER_PANEL, DRAGGABLE_HEADER } from '../screens/timeline';
import { TABLE_COLUMN_EVENTS_MESSAGE } from '../screens/hosts/external_events';
import { waitsForEventsToBeLoaded, openEventsViewerFieldsBrowser } from '../tasks/hosts/events';
import { removeColumn, resetFields } from '../tasks/timeline';
Expand Down
5 changes: 3 additions & 2 deletions x-pack/plugins/security_solution/cypress/screens/timeline.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export const CLOSE_TIMELINE_BTN = '[data-test-subj="close-timeline"]';
export const CREATE_NEW_TIMELINE = '[data-test-subj="timeline-new"]';

export const DRAGGABLE_HEADER =
'[data-test-subj="headers-group"] [data-test-subj="draggable-header"]';
'[data-test-subj="events-viewer-panel"] [data-test-subj="headers-group"] [data-test-subj="draggable-header"]';

export const HEADERS_GROUP = '[data-test-subj="headers-group"]';

Expand All @@ -21,7 +21,8 @@ export const ID_TOGGLE_FIELD = '[data-test-subj="toggle-field-_id"]';

export const PROVIDER_BADGE = '[data-test-subj="providerBadge"]';

export const REMOVE_COLUMN = '[data-test-subj="remove-column"]';
export const REMOVE_COLUMN =
'[data-test-subj="events-viewer-panel"] [data-test-subj="remove-column"]';

export const RESET_FIELDS =
'[data-test-subj="events-viewer-panel"] [data-test-subj="reset-fields"]';
Expand Down
7 changes: 0 additions & 7 deletions x-pack/plugins/security_solution/cypress/tasks/timeline.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@ import {

import { drag, drop } from '../tasks/common';

export const hostExistsQuery = 'host.name: *';

export const addDescriptionToTimeline = (description: string) => {
cy.get(TIMELINE_DESCRIPTION).type(`${description}{enter}`);
cy.get(DATE_PICKER_APPLY_BUTTON_TIMELINE).click().invoke('text').should('not.equal', 'Updating');
Expand Down Expand Up @@ -57,10 +55,6 @@ export const createNewTimeline = () => {
cy.get(CLOSE_TIMELINE_BTN).click({ force: true });
};

export const executeTimelineKQL = (query: string) => {
cy.get(`${SEARCH_OR_FILTER_CONTAINER} textarea`).type(`${query} {enter}`);
};

export const expandFirstTimelineEventDetails = () => {
cy.get(TOGGLE_TIMELINE_EXPAND_EVENT).first().click({ force: true });
};
Expand All @@ -79,7 +73,6 @@ export const openTimelineSettings = () => {
};

export const populateTimeline = () => {
executeTimelineKQL(hostExistsQuery);
patrykkopycinski marked this conversation as resolved.
Show resolved Hide resolved
cy.get(SERVER_SIDE_EVENT_COUNT)
.invoke('text')
.then((strCount) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -215,8 +215,8 @@ describe('alert actions', () => {
columnId: '@timestamp',
sortDirection: 'desc',
},
status: TimelineStatus.active,
title: 'Test rule - Duplicate',
status: TimelineStatus.draft,
title: '',
timelineType: TimelineType.default,
templateTimelineId: null,
templateTimelineVersion: null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,14 @@ import moment from 'moment';

import { updateAlertStatus } from '../../containers/detection_engine/alerts/api';
import { SendAlertToTimelineActionProps, UpdateAlertStatusActionProps } from './types';
import { TimelineNonEcsData, GetOneTimeline, TimelineResult, Ecs } from '../../../graphql/types';
import {
TimelineNonEcsData,
GetOneTimeline,
TimelineResult,
Ecs,
TimelineStatus,
TimelineType,
} from '../../../graphql/types';
import { oneTimelineQuery } from '../../../timelines/containers/one/index.gql_query';
import { timelineDefaults } from '../../../timelines/store/timeline/defaults';
import {
Expand Down Expand Up @@ -122,20 +129,31 @@ export const sendAlertToTimelineAction = async ({
if (!isEmpty(resultingTimeline)) {
const timelineTemplate: TimelineResult = omitTypenameInTimeline(resultingTimeline);
openAlertInBasicTimeline = false;
const { timeline } = formatTimelineResultToModel(timelineTemplate, true);
const { timeline } = formatTimelineResultToModel(
timelineTemplate,
true,
timelineTemplate.timelineType ?? TimelineType.default
);
const query = replaceTemplateFieldFromQuery(
timeline.kqlQuery?.filterQuery?.kuery?.expression ?? '',
ecsData
ecsData,
timeline.timelineType
);
const filters = replaceTemplateFieldFromMatchFilters(timeline.filters ?? [], ecsData);
const dataProviders = replaceTemplateFieldFromDataProviders(
timeline.dataProviders ?? [],
ecsData
ecsData,
timeline.timelineType
);

createTimeline({
from,
timeline: {
...timeline,
title: '',
timelineType: TimelineType.default,
templateTimelineId: null,
status: TimelineStatus.draft,
dataProviders,
eventType: 'all',
filters,
Expand Down
Loading