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] Add nested field inside of data provider #93721

Merged
merged 15 commits into from
Mar 9, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,12 @@ export interface BrowserField {
name: string;
searchable: boolean;
type: string;
subType?: {
[key: string]: unknown;
nested?: {
path: string;
};
};
}

export type BrowserFields = Readonly<Record<string, Partial<BrowserField>>>;
Expand Down
10 changes: 3 additions & 7 deletions x-pack/plugins/security_solution/cypress/tasks/timeline.ts
Original file line number Diff line number Diff line change
Expand Up @@ -161,13 +161,9 @@ export const closeTimeline = () => {
};

export const createNewTimeline = () => {
cy.get(TIMELINE_SETTINGS_ICON)
.filter(':visible')
.click({ force: true })
.then(() => {
cy.get(CREATE_NEW_TIMELINE).should('be.visible');
cy.get(CREATE_NEW_TIMELINE).click();
});
cy.get(TIMELINE_SETTINGS_ICON).filter(':visible').click({ force: true });
cy.get(CREATE_NEW_TIMELINE).should('be.visible');
cy.get(CREATE_NEW_TIMELINE).click();
};

export const createNewTimelineTemplate = () => {
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,18 @@ describe('QueryBar ', () => {
searchable: true,
type: 'string',
},
{
aggregatable: false,
name: 'nestedField.firstAttributes',
searchable: true,
type: 'string',
},
{
aggregatable: false,
name: 'nestedField.secondAttributes',
searchable: true,
type: 'string',
},
],
title: 'filebeat-*,auditbeat-*,packetbeat-*',
},
Expand All @@ -183,6 +195,7 @@ describe('QueryBar ', () => {
query: 'here: query',
},
refreshInterval: undefined,
savedQuery: undefined,
showAutoRefreshOnly: false,
showDatePicker: false,
showFilterBar: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,38 @@ export const mocksSource = {
searchable: true,
type: 'date',
},
{
aggregatable: false,
category: 'nestedField',
description: '',
example: '',
format: '',
indexes: ['auditbeat', 'filebeat', 'packetbeat'],
name: 'nestedField.firstAttributes',
searchable: true,
type: 'string',
subType: {
nested: {
path: 'nestedField',
},
},
},
{
aggregatable: false,
category: 'nestedField',
description: '',
example: '',
format: '',
indexes: ['auditbeat', 'filebeat', 'packetbeat'],
name: 'nestedField.secondAttributes',
searchable: true,
type: 'string',
subType: {
nested: {
path: 'nestedField',
},
},
},
],
};

Expand Down Expand Up @@ -646,6 +678,42 @@ export const mockBrowserFields: BrowserFields = {
},
},
},
nestedField: {
fields: {
'nestedField.firstAttributes': {
aggregatable: false,
category: 'nestedField',
description: '',
example: '',
format: '',
indexes: ['auditbeat', 'filebeat', 'packetbeat'],
name: 'nestedField.firstAttributes',
searchable: true,
type: 'string',
subType: {
nested: {
path: 'nestedField',
},
},
},
'nestedField.secondAttributes': {
aggregatable: false,
category: 'nestedField',
description: '',
example: '',
format: '',
indexes: ['auditbeat', 'filebeat', 'packetbeat'],
name: 'nestedField.secondAttributes',
searchable: true,
type: 'string',
subType: {
nested: {
path: 'nestedField',
},
},
},
},
},
};

export const mockDocValueFields: DocValueFields[] = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,11 @@ export const useInitSourcerer = (
selectedPatterns: [signalIndexName],
})
);
} else if (signalIndexNameSelector != null && initialTimelineSourcerer.current) {
} else if (
scopeId === SourcererScopeName.detections &&
signalIndexNameSelector != null &&
initialTimelineSourcerer.current
) {
initialDetectionSourcerer.current = false;
dispatch(
sourcererActions.setSelectedIndexPatterns({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,18 @@ export const mockIndexPattern: IIndexPattern = {
type: 'string',
aggregatable: true,
},
{
name: 'nestedField.firstAttributes',
searchable: true,
type: 'string',
aggregatable: false,
},
{
name: 'nestedField.secondAttributes',
searchable: true,
type: 'string',
aggregatable: false,
},
],
title: 'filebeat-*,auditbeat-*,packetbeat-*',
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,18 @@ describe('body', () => {
{ name: 'agent.test7', searchable: true, type: 'string', aggregatable: true },
{ name: 'agent.test8', searchable: true, type: 'string', aggregatable: true },
{ name: 'host.name', searchable: true, type: 'string', aggregatable: true },
{
aggregatable: false,
name: 'nestedField.firstAttributes',
searchable: true,
type: 'string',
},
{
aggregatable: false,
name: 'nestedField.secondAttributes',
searchable: true,
type: 'string',
},
],
title: 'filebeat-*,auditbeat-*,packetbeat-*',
},
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,17 @@ describe('helpers', () => {
],
},
{ label: 'event', options: [{ label: 'event.end' }] },
{
label: 'nestedField',
options: [
{
label: 'nestedField.firstAttributes',
},
{
label: 'nestedField.secondAttributes',
},
],
},
{ label: 'source', options: [{ label: 'source.ip' }, { label: 'source.port' }] },
]);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ describe('Header', () => {
);

expect(wrapper.find('[data-test-subj="categories-count"]').first().text()).toEqual(
'9 categories'
'10 categories'
);
});

Expand Down Expand Up @@ -254,6 +254,6 @@ describe('Header', () => {
</TestProviders>
);

expect(wrapper.find('[data-test-subj="fields-count"]').first().text()).toEqual('25 fields');
expect(wrapper.find('[data-test-subj="fields-count"]').first().text()).toEqual('27 fields');
});
});

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading