Skip to content

Commit

Permalink
Merge branch '7.6' into backport/7.6/pr-56044
Browse files Browse the repository at this point in the history
  • Loading branch information
elasticmachine authored Jan 28, 2020
2 parents d0f0002 + 01a77f4 commit c0be8a3
Show file tree
Hide file tree
Showing 180 changed files with 2,549 additions and 2,008 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -581,10 +581,13 @@ export class IndexPattern implements IIndexPattern {

toasts.addError(err, {
title: i18n.translate('data.indexPatterns.fetchFieldErrorTitle', {
defaultMessage: 'Error fetching fields',
defaultMessage: 'Error fetching fields for index pattern {title} (ID: {id})',
values: {
id: this.id,
title: this.title,
},
}),
});
throw err;
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ class SavedObjectFinderUi extends React.Component<
if (query === this.state.query) {
this.setState({
isFetchingItems: false,
page: 0,
items: resp.savedObjects.map(savedObject => {
const {
attributes: { title },
Expand Down
25 changes: 15 additions & 10 deletions vars/githubPr.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -106,23 +106,28 @@ def getTestFailuresMessage() {
}

def messages = []
messages << "---\n\n### [Test Failures](${env.BUILD_URL}testReport)"

failures.take(5).each { failure ->
failures.take(3).each { failure ->
messages << """
---
### [Test Failures](${env.BUILD_URL}testReport)
<details><summary>${failure.fullDisplayName}</summary>
[Link to Jenkins](${failure.url})
"""

```
${failure.stdOut}
```
</details>
if (failure.stdOut) {
messages << "\n#### Standard Out\n```\n${failure.stdOut}\n```"
}

---
"""
if (failure.stdErr) {
messages << "\n#### Standard Error\n```\n${failure.stdErr}\n```"
}

if (failure.stacktrace) {
messages << "\n#### Stack Trace\n```\n${failure.stacktrace}\n```"
}

messages << "</details>\n\n---"
}

if (failures.size() > 3) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -432,6 +432,9 @@ const TimeseriesChartIntl = injectI18n(
}
focusLoadTo = Math.min(focusLoadTo, contextXMax);

const brushVisibility = focusLoadFrom !== contextXMin || focusLoadTo !== contextXMax;
this.setBrushVisibility(brushVisibility);

if (focusLoadFrom !== contextXMin || focusLoadTo !== contextXMax) {
this.setContextBrushExtent(new Date(focusLoadFrom), new Date(focusLoadTo), true);
const newSelectedBounds = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,14 @@
* you may not use this file except in compliance with the Elastic License.
*/

import {
FIELDS_BROWSER_CONTAINER,
FIELDS_BROWSER_FILTER_INPUT,
TIMELINE_FIELDS_BUTTON,
} from './selectors';
import { FIELDS_BROWSER_CONTAINER, FIELDS_BROWSER_FILTER_INPUT } from './selectors';
import {
assertAtLeastOneEventMatchesSearch,
executeKQL,
hostExistsQuery,
toggleTimelineVisibility,
} from '../timeline/helpers';
import { TIMELINE_DATA_PROVIDERS } from '../timeline/selectors';
import { TIMELINE_DATA_PROVIDERS, TIMELINE_FIELDS_BUTTON } from '../timeline/selectors';

/** Opens the timeline's Field Browser */
export const openTimelineFieldsBrowser = () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
/** A data provider rendered in the timeline's data providers drop area */
export const DATA_PROVIDER = '[data-test-subj="providerContainer"]';

export const TIMELINE_FIELDS_BUTTON =
'[data-test-subj="timeline"] [data-test-subj="show-field-browser"]';

/** Data providers are dropped and rendered in this area of the timeline */
export const TIMELINE_DATA_PROVIDERS = '[data-test-subj="dataProviders"]';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,40 @@
* you may not use this file except in compliance with the Elastic License.
*/

import { drag, drop } from '../../lib/drag_n_drop/helpers';
import {
clearFieldsBrowser,
clickOutsideFieldsBrowser,
openTimelineFieldsBrowser,
populateTimeline,
filterFieldsBrowser,
} from '../../lib/fields_browser/helpers';
import { HOSTS_PAGE } from '../../lib/urls';

import { loginAndWaitForPage, DEFAULT_TIMEOUT } from '../../../tasks/login';

import {
FIELDS_BROWSER_TITLE,
FIELDS_BROWSER_SELECTED_CATEGORY_TITLE,
FIELDS_BROWSER_SELECTED_CATEGORY_COUNT,
FIELDS_BROWSER_CATEGORIES_COUNT,
FIELDS_BROWSER_CONTAINER,
FIELDS_BROWSER_FIELDS_COUNT,
FIELDS_BROWSER_FILTER_INPUT,
FIELDS_BROWSER_HOST_CATEGORIES_COUNT,
FIELDS_BROWSER_SELECTED_CATEGORY_COUNT,
FIELDS_BROWSER_SELECTED_CATEGORY_TITLE,
FIELDS_BROWSER_SYSTEM_CATEGORIES_COUNT,
FIELDS_BROWSER_TITLE,
} from '../../lib/fields_browser/selectors';
import { HOSTS_PAGE } from '../../lib/urls';
import { loginAndWaitForPage, DEFAULT_TIMEOUT } from '../../lib/util/helpers';
FIELDS_BROWSER_FIELDS_COUNT,
FIELDS_BROWSER_MESSAGE_HEADER,
FIELDS_BROWSER_HOST_GEO_CITY_NAME_HEADER,
FIELDS_BROWSER_HOST_GEO_COUNTRY_NAME_HEADER,
FIELDS_BROWSER_HEADER_HOST_GEO_CONTINENT_NAME_HEADER,
} from '../../../screens/timeline/fields_browser';

import {
openTimeline,
populateTimeline,
openTimelineFieldsBrowser,
} from '../../../tasks/timeline/main';

import {
clearFieldsBrowser,
filterFieldsBrowser,
closeFieldsBrowser,
removesMessageField,
addsHostGeoCityNameToTimeline,
addsHostGeoCountryNameToTimelineDraggingIt,
addsHostGeoContinentNameToTimeline,
resetFields,
} from '../../../tasks/timeline/fields_browser';

const defaultHeaders = [
{ id: '@timestamp' },
Expand All @@ -41,6 +54,7 @@ describe('Fields Browser', () => {
context('Fields Browser rendering', () => {
before(() => {
loginAndWaitForPage(HOSTS_PAGE);
openTimeline();
populateTimeline();
openTimelineFieldsBrowser();
});
Expand Down Expand Up @@ -78,7 +92,7 @@ describe('Fields Browser', () => {

filterFieldsBrowser(filterInput);

cy.get(FIELDS_BROWSER_CATEGORIES_COUNT)
cy.get(FIELDS_BROWSER_CATEGORIES_COUNT, { timeout: DEFAULT_TIMEOUT })
.invoke('text')
.should('eq', '2 categories');
});
Expand All @@ -88,18 +102,13 @@ describe('Fields Browser', () => {

filterFieldsBrowser(filterInput);

cy.get(FIELDS_BROWSER_FILTER_INPUT, { timeout: DEFAULT_TIMEOUT }).should(
'not.have.class',
'euiFieldSearch-isLoading'
);

cy.get(FIELDS_BROWSER_HOST_CATEGORIES_COUNT)
.invoke('text')
.then(hostCategoriesCount => {
cy.get(FIELDS_BROWSER_SYSTEM_CATEGORIES_COUNT)
.invoke('text')
.then(systemCategoriesCount => {
cy.get(FIELDS_BROWSER_FIELDS_COUNT)
cy.get(FIELDS_BROWSER_FIELDS_COUNT, { timeout: DEFAULT_TIMEOUT })
.invoke('text')
.should('eq', `${+hostCategoriesCount + +systemCategoriesCount} fields`);
});
Expand All @@ -120,6 +129,7 @@ describe('Fields Browser', () => {
context('Editing the timeline', () => {
before(() => {
loginAndWaitForPage(HOSTS_PAGE);
openTimeline();
populateTimeline();
openTimelineFieldsBrowser();
});
Expand All @@ -130,31 +140,17 @@ describe('Fields Browser', () => {
});

it('removes the message field from the timeline when the user un-checks the field', () => {
const toggleField = 'message';

cy.get(`[data-test-subj="timeline"] [data-test-subj="header-text-${toggleField}"]`).should(
'exist'
);
cy.get(FIELDS_BROWSER_MESSAGE_HEADER).should('exist');

cy.get(
`[data-test-subj="timeline"] [data-test-subj="field-${toggleField}-checkbox"]`
).uncheck({
force: true,
});
removesMessageField();
closeFieldsBrowser();

clickOutsideFieldsBrowser();

cy.get(FIELDS_BROWSER_CONTAINER).should('not.exist');

cy.get(`[data-test-subj="timeline"] [data-test-subj="header-text-${toggleField}"]`).should(
'not.exist'
);
cy.get(FIELDS_BROWSER_MESSAGE_HEADER).should('not.exist');
});

it('selects a search results label with the expected count of categories matching the filter input', () => {
const category = 'host';

filterFieldsBrowser(`${category}.`);
filterFieldsBrowser(category);

cy.get(FIELDS_BROWSER_SELECTED_CATEGORY_TITLE)
.invoke('text')
Expand All @@ -163,75 +159,47 @@ describe('Fields Browser', () => {

it('adds a field to the timeline when the user clicks the checkbox', () => {
const filterInput = 'host.geo.c';
const toggleField = 'host.geo.city_name';

filterFieldsBrowser(filterInput);
cy.get(FIELDS_BROWSER_HOST_GEO_CITY_NAME_HEADER).should('not.exist');
addsHostGeoCityNameToTimeline();
closeFieldsBrowser();

cy.get(`[data-test-subj="timeline"] [data-test-subj="header-text-${toggleField}"]`).should(
'not.exist'
);

cy.get(`[data-test-subj="timeline"] [data-test-subj="field-${toggleField}-checkbox"]`).check({
force: true,
});

clickOutsideFieldsBrowser();

cy.get(`[data-test-subj="timeline"] [data-test-subj="header-text-${toggleField}"]`, {
cy.get(FIELDS_BROWSER_HOST_GEO_CITY_NAME_HEADER, {
timeout: DEFAULT_TIMEOUT,
}).should('exist');
});

it('adds a field to the timeline when the user drags and drops a field', () => {
const filterInput = 'host.geo.c';
const toggleField = 'host.geo.country_name';

filterFieldsBrowser(filterInput);

cy.get(`[data-test-subj="timeline"] [data-test-subj="header-text-${toggleField}"]`).should(
'not.exist'
);

cy.get(
`[data-test-subj="timeline"] [data-test-subj="field-name-${toggleField}"]`
).then(field => drag(field));
cy.get(FIELDS_BROWSER_HOST_GEO_COUNTRY_NAME_HEADER).should('not.exist');

cy.get(`[data-test-subj="timeline"] [data-test-subj="headers-group"]`).then(headersDropArea =>
drop(headersDropArea)
);
addsHostGeoCountryNameToTimelineDraggingIt();

cy.get(`[data-test-subj="timeline"] [data-test-subj="header-text-${toggleField}"]`, {
cy.get(FIELDS_BROWSER_HOST_GEO_COUNTRY_NAME_HEADER, {
timeout: DEFAULT_TIMEOUT,
}).should('exist');
});

it('resets all fields in the timeline when `Reset Fields` is clicked', () => {
const filterInput = 'host.geo.c';
const toggleField = 'host.geo.continent_name';

filterFieldsBrowser(filterInput);

cy.get(`[data-test-subj="timeline"] [data-test-subj="header-text-${toggleField}"]`).should(
'not.exist'
);

cy.get(`[data-test-subj="timeline"] [data-test-subj="field-${toggleField}-checkbox"]`).check({
force: true,
});
cy.get(FIELDS_BROWSER_HEADER_HOST_GEO_CONTINENT_NAME_HEADER).should('not.exist');

clickOutsideFieldsBrowser();
addsHostGeoContinentNameToTimeline();
closeFieldsBrowser();

cy.get(`[data-test-subj="timeline"] [data-test-subj="header-text-${toggleField}"]`).should(
'exist'
);
cy.get(FIELDS_BROWSER_HEADER_HOST_GEO_CONTINENT_NAME_HEADER).should('exist');

openTimelineFieldsBrowser();
resetFields();

cy.get('[data-test-subj="timeline"] [data-test-subj="reset-fields"]').click({ force: true });

cy.get(`[data-test-subj="timeline"] [data-test-subj="header-text-${toggleField}"]`).should(
'not.exist'
);
cy.get(FIELDS_BROWSER_HEADER_HOST_GEO_CONTINENT_NAME_HEADER).should('not.exist');
});
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,15 @@ import {
INSPECT_MODAL,
INSPECT_NETWORK_BUTTONS_IN_SIEM,
INSPECT_HOSTS_BUTTONS_IN_SIEM,
TIMELINE_SETTINGS_ICON,
TIMELINE_INSPECT_BUTTON,
} from '../../lib/inspect/selectors';
import { DEFAULT_TIMEOUT, loginAndWaitForPage } from '../../lib/util/helpers';
import { executeKQL, hostExistsQuery, toggleTimelineVisibility } from '../../lib/timeline/helpers';
import { closesModal, openStatsAndTables } from '../../lib/inspect/helpers';
} from '../../../screens/inspect';
import {
executeTimelineKQL,
openTimeline,
openTimelineSettings,
openTimelineInspectButton,
} from '../../../tasks/timeline/main';
import { DEFAULT_TIMEOUT, loginAndWaitForPage } from '../../../tasks/login';
import { closesModal, openStatsAndTables } from '../../../tasks/inspect';

describe('Inspect', () => {
context('Hosts stats and tables', () => {
Expand Down Expand Up @@ -51,12 +54,12 @@ describe('Inspect', () => {

context('Timeline', () => {
it('inspects the timeline', () => {
const hostExistsQuery = 'host.name: *';
loginAndWaitForPage(HOSTS_PAGE);
toggleTimelineVisibility();
executeKQL(hostExistsQuery);
cy.get(TIMELINE_SETTINGS_ICON).trigger('click', { force: true });
cy.get(TIMELINE_INSPECT_BUTTON, { timeout: DEFAULT_TIMEOUT }).should('not.be.disabled');
cy.get(TIMELINE_INSPECT_BUTTON).trigger('click', { force: true });
openTimeline();
executeTimelineKQL(hostExistsQuery);
openTimelineSettings();
openTimelineInspectButton();
cy.get(INSPECT_MODAL, { timeout: DEFAULT_TIMEOUT }).should('be.visible');
});
});
Expand Down
Loading

0 comments on commit c0be8a3

Please sign in to comment.