Skip to content

Commit

Permalink
Merge branch 'master' into issue-70695-fix-metrics-ui-obs-fn
Browse files Browse the repository at this point in the history
  • Loading branch information
elasticmachine authored Jul 6, 2020
2 parents 7493894 + 353f332 commit 9bb1f4e
Show file tree
Hide file tree
Showing 154 changed files with 3,454 additions and 1,604 deletions.
1 change: 1 addition & 0 deletions .ci/end2end.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ pipeline {
HOME = "${env.WORKSPACE}"
E2E_DIR = 'x-pack/plugins/apm/e2e'
PIPELINE_LOG_LEVEL = 'DEBUG'
KBN_OPTIMIZER_THEMES = 'v7light'
}
options {
timeout(time: 1, unit: 'HOURS')
Expand Down
2 changes: 1 addition & 1 deletion .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Delete any items that are not applicable to this PR.
- [ ] [Unit or functional tests](https://github.com/elastic/kibana/blob/master/CONTRIBUTING.md#cross-browser-compatibility) were updated or added to match the most common scenarios
- [ ] This was checked for [keyboard-only and screenreader accessibility](https://developer.mozilla.org/en-US/docs/Learn/Tools_and_testing/Cross_browser_testing/Accessibility#Accessibility_testing_checklist)
- [ ] This renders correctly on smaller devices using a responsive layout. (You can test this [in your browser](https://www.browserstack.com/guide/responsive-testing-on-local-server)
- [ ] This was checked for cross-browser compatibility, [including a check against IE11](https://github.com/elastic/kibana/blob/master/CONTRIBUTING.md#cross-browser-compatibility)
- [ ] This was checked for [cross-browser compatibility](https://www.elastic.co/support/matrix#matrix_browsers)

### For maintainers

Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,8 @@ afterAll(async () => {
await del(TMP_DIR);
});

it('builds expected bundles, saves bundle counts to metadata', async () => {
// FLAKY: https://github.com/elastic/kibana/issues/70762
it.skip('builds expected bundles, saves bundle counts to metadata', async () => {
const config = OptimizerConfig.create({
repoRoot: MOCK_REPO_DIR,
pluginScanDirs: [Path.resolve(MOCK_REPO_DIR, 'plugins')],
Expand Down Expand Up @@ -167,7 +168,8 @@ it('builds expected bundles, saves bundle counts to metadata', async () => {
`);
});

it('uses cache on second run and exist cleanly', async () => {
// FLAKY: https://github.com/elastic/kibana/issues/70764
it.skip('uses cache on second run and exist cleanly', async () => {
const config = OptimizerConfig.create({
repoRoot: MOCK_REPO_DIR,
pluginScanDirs: [Path.resolve(MOCK_REPO_DIR, 'plugins')],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export function NoDataPopover({
<p style={{ maxWidth: 300 }}>
{i18n.translate('data.noDataPopover.content', {
defaultMessage:
"This time range doesn't contain any data. Increase or adjust the time range to see more fields and create charts",
"This time range doesn't contain any data. Increase or adjust the time range to see more fields and create charts.",
})}
</p>
</EuiText>
Expand All @@ -66,11 +66,13 @@ export function NoDataPopover({
step={1}
stepsTotal={1}
isStepOpen={noDataPopoverVisible}
subtitle={i18n.translate('data.noDataPopover.title', { defaultMessage: 'Tip' })}
title=""
subtitle={i18n.translate('data.noDataPopover.subtitle', { defaultMessage: 'Tip' })}
title={i18n.translate('data.noDataPopover.title', { defaultMessage: 'Empty dataset' })}
footerAction={
<EuiButtonEmpty
size="s"
size="xs"
flush="right"
color="text"
data-test-subj="noDataPopoverDismissButton"
onClick={() => {
storage.set(NO_DATA_POPOVER_STORAGE_KEY, true);
Expand Down
2 changes: 0 additions & 2 deletions src/plugins/data/server/saved_objects/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@
* specific language governing permissions and limitations
* under the License.
*/

export { searchSavedObjectType } from './search';
export { querySavedObjectType } from './query';
export { indexPatternSavedObjectType } from './index_patterns';
export { kqlTelemetry } from './kql_telementry';
3 changes: 0 additions & 3 deletions src/plugins/data/server/search/search_service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ import {
} from './types';
import { registerSearchRoute } from './routes';
import { ES_SEARCH_STRATEGY, esSearchStrategyProvider } from './es_search';
import { searchSavedObjectType } from '../saved_objects';
import { DataPluginStart } from '../plugin';

export class SearchService implements Plugin<ISearchSetup, ISearchStart> {
Expand All @@ -36,8 +35,6 @@ export class SearchService implements Plugin<ISearchSetup, ISearchStart> {
constructor(private initializerContext: PluginInitializerContext) {}

public setup(core: CoreSetup<object, DataPluginStart>): ISearchSetup {
core.savedObjects.registerType(searchSavedObjectType);

this.registerSearchStrategy(
ES_SEARCH_STRATEGY,
esSearchStrategyProvider(this.initializerContext.config.legacy.globalConfig$)
Expand Down
2 changes: 2 additions & 0 deletions src/plugins/discover/server/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,13 @@
import { CoreSetup, CoreStart, Plugin } from 'kibana/server';
import { uiSettings } from './ui_settings';
import { capabilitiesProvider } from './capabilities_provider';
import { searchSavedObjectType } from './saved_objects';

export class DiscoverServerPlugin implements Plugin<object, object> {
public setup(core: CoreSetup) {
core.capabilities.registerProvider(capabilitiesProvider);
core.uiSettings.register(uiSettings);
core.savedObjects.registerType(searchSavedObjectType);

return {};
}
Expand Down
20 changes: 20 additions & 0 deletions src/plugins/discover/server/saved_objects/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/*
* Licensed to Elasticsearch B.V. under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch B.V. licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

export { searchSavedObjectType } from './search';
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*/

import { SavedObjectsType } from 'kibana/server';
import { searchSavedObjectTypeMigrations } from './search_migrations';
import { searchMigrations } from './search_migrations';

export const searchSavedObjectType: SavedObjectsType = {
name: 'search',
Expand All @@ -43,18 +43,18 @@ export const searchSavedObjectType: SavedObjectsType = {
},
mappings: {
properties: {
columns: { type: 'keyword' },
columns: { type: 'keyword', index: false },
description: { type: 'text' },
hits: { type: 'integer' },
hits: { type: 'integer', index: false },
kibanaSavedObjectMeta: {
properties: {
searchSourceJSON: { type: 'text' },
searchSourceJSON: { type: 'text', index: false },
},
},
sort: { type: 'keyword' },
sort: { type: 'keyword', index: false },
title: { type: 'text' },
version: { type: 'integer' },
},
},
migrations: searchSavedObjectTypeMigrations as any,
migrations: searchMigrations as any,
};
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@
*/

import { SavedObjectMigrationContext } from 'kibana/server';
import { searchSavedObjectTypeMigrations } from './search_migrations';
import { searchMigrations } from './search_migrations';

const savedObjectMigrationContext = (null as unknown) as SavedObjectMigrationContext;

describe('migration search', () => {
describe('6.7.2', () => {
const migrationFn = searchSavedObjectTypeMigrations['6.7.2'];
const migrationFn = searchMigrations['6.7.2'];

it('should migrate obsolete match_all query', () => {
const migratedDoc = migrationFn(
Expand Down Expand Up @@ -56,7 +56,7 @@ describe('migration search', () => {
});

describe('7.0.0', () => {
const migrationFn = searchSavedObjectTypeMigrations['7.0.0'];
const migrationFn = searchMigrations['7.0.0'];

test('skips errors when searchSourceJSON is null', () => {
const doc = {
Expand Down Expand Up @@ -278,7 +278,7 @@ Object {
});

describe('7.4.0', function () {
const migrationFn = searchSavedObjectTypeMigrations['7.4.0'];
const migrationFn = searchMigrations['7.4.0'];

test('transforms one dimensional sort arrays into two dimensional arrays', () => {
const doc = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

import { flow, get } from 'lodash';
import { SavedObjectMigrationFn } from 'kibana/server';
import { DEFAULT_QUERY_LANGUAGE } from '../../common';
import { DEFAULT_QUERY_LANGUAGE } from '../../../data/common';

const migrateMatchAllQuery: SavedObjectMigrationFn<any, any> = (doc) => {
const searchSourceJSON = get(doc, 'attributes.kibanaSavedObjectMeta.searchSourceJSON');
Expand Down Expand Up @@ -121,7 +121,7 @@ const migrateSearchSortToNestedArray: SavedObjectMigrationFn<any, any> = (doc) =
};
};

export const searchSavedObjectTypeMigrations = {
export const searchMigrations = {
'6.7.2': flow(migrateMatchAllQuery),
'7.0.0': flow(setNewReferences),
'7.4.0': flow(migrateSearchSortToNestedArray),
Expand Down
11 changes: 0 additions & 11 deletions src/plugins/expressions/common/execution/execution.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -475,17 +475,6 @@ describe('Execution', () => {
}
});

test('sets duration to 10 milliseconds when function executes 10 milliseconds', async () => {
const execution = createExecution('sleep 10', {}, true);
execution.start(-1);
await execution.result;

const node = execution.state.get().ast.chain[0];
expect(typeof node.debug?.duration).toBe('number');
expect(node.debug?.duration).toBeLessThan(50);
expect(node.debug?.duration).toBeGreaterThanOrEqual(5);
});

test('adds .debug field in expression AST on each executed function', async () => {
const execution = createExecution('add val=1 | add val=2 | add val=3', {}, true);
execution.start(-1);
Expand Down
1 change: 1 addition & 0 deletions test/functional/apps/dashboard/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ export default function ({ getService, loadTestFile }) {
after(unloadCurrentData);

loadTestFile(require.resolve('./empty_dashboard'));
loadTestFile(require.resolve('./url_field_formatter'));
loadTestFile(require.resolve('./embeddable_rendering'));
loadTestFile(require.resolve('./create_and_add_embeddables'));
loadTestFile(require.resolve('./edit_embeddable_redirects'));
Expand Down
91 changes: 91 additions & 0 deletions test/functional/apps/dashboard/url_field_formatter.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
/*
* Licensed to Elasticsearch B.V. under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch B.V. licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

import expect from '@kbn/expect';
import { WebElementWrapper } from 'test/functional/services/lib/web_element_wrapper';
import { FtrProviderContext } from '../../ftr_provider_context';

export default function ({ getService, getPageObjects }: FtrProviderContext) {
const { common, dashboard, settings, timePicker, visChart } = getPageObjects([
'common',
'dashboard',
'settings',
'timePicker',
'visChart',
]);
const esArchiver = getService('esArchiver');
const kibanaServer = getService('kibanaServer');
const testSubjects = getService('testSubjects');
const browser = getService('browser');
const fieldName = 'clientip';

const clickFieldAndCheckUrl = async (fieldLink: WebElementWrapper) => {
const fieldValue = await fieldLink.getVisibleText();
await fieldLink.click();
const windowHandlers = await browser.getAllWindowHandles();
expect(windowHandlers.length).to.equal(2);
await browser.switchToWindow(windowHandlers[1]);
const currentUrl = await browser.getCurrentUrl();
const fieldUrl = common.getHostPort() + '/app/' + fieldValue;
expect(currentUrl).to.equal(fieldUrl);
};

describe('Changing field formatter to Url', () => {
before(async function () {
await esArchiver.load('dashboard/current/kibana');
await kibanaServer.uiSettings.replace({
defaultIndex: '0bf35f60-3dc9-11e8-8660-4d65aa086b3c',
});
await common.navigateToApp('settings');
await settings.clickKibanaIndexPatterns();
await settings.clickIndexPatternLogstash();
await settings.filterField(fieldName);
await settings.openControlsByName(fieldName);
await settings.setFieldFormat('url');
await settings.controlChangeSave();
});

it('applied on dashboard', async () => {
await common.navigateToApp('dashboard');
await dashboard.loadSavedDashboard('dashboard with everything');
await dashboard.waitForRenderComplete();
const fieldLink = await visChart.getFieldLinkInVisTable(`${fieldName}: Descending`, 1);
await clickFieldAndCheckUrl(fieldLink);
});

it('applied on discover', async () => {
await common.navigateToApp('discover');
await timePicker.setAbsoluteRange(
'Sep 19, 2017 @ 06:31:44.000',
'Sep 23, 2018 @ 18:31:44.000'
);
await testSubjects.click('docTableExpandToggleColumn');
const fieldLink = await testSubjects.find(`tableDocViewRow-${fieldName}-value`);
await clickFieldAndCheckUrl(fieldLink);
});

afterEach(async function () {
const windowHandlers = await browser.getAllWindowHandles();
if (windowHandlers.length > 1) {
await browser.closeCurrentWindow();
await browser.switchToWindow(windowHandlers[0]);
}
});
});
}
14 changes: 14 additions & 0 deletions test/functional/page_objects/visualize_chart_page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,20 @@ export function VisualizeChartPageProvider({ getService, getPageObjects }: FtrPr
return element.getVisibleText();
}

public async getFieldLinkInVisTable(fieldName: string, rowIndex: number = 1) {
const tableVis = await testSubjects.find('tableVis');
const $ = await tableVis.parseDomContent();
const headers = $('span[ng-bind="::col.title"]')
.toArray()
.map((header: any) => $(header).text());
const fieldColumnIndex = headers.indexOf(fieldName);
return await find.byCssSelector(
`[data-test-subj="paginated-table-body"] tr:nth-of-type(${rowIndex}) td:nth-of-type(${
fieldColumnIndex + 1
}) a`
);
}

/**
* If you are writing new tests, you should rather look into getTableVisContent method instead.
* @deprecated Use getTableVisContent instead.
Expand Down
15 changes: 3 additions & 12 deletions x-pack/plugins/apm/e2e/cypress/integration/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,30 +6,21 @@

/* eslint-disable import/no-extraneous-dependencies */

const RANGE_FROM = '2020-06-01T14:59:32.686Z';
const RANGE_TO = '2020-06-16T16:59:36.219Z';

const BASE_URL = Cypress.config().baseUrl;

/** The default time in ms to wait for a Cypress command to complete */
export const DEFAULT_TIMEOUT = 60 * 1000;

export function loginAndWaitForPage(
url: string,
dateRange?: { to: string; from: string }
dateRange: { to: string; from: string }
) {
const username = Cypress.env('elasticsearch_username');
const password = Cypress.env('elasticsearch_password');

cy.log(`Authenticating via ${username} / ${password}`);
let rangeFrom = RANGE_FROM;
let rangeTo = RANGE_TO;
if (dateRange) {
rangeFrom = dateRange.from;
rangeTo = dateRange.to;
}

const fullUrl = `${BASE_URL}${url}?rangeFrom=${rangeFrom}&rangeTo=${rangeTo}`;

const fullUrl = `${BASE_URL}${url}?rangeFrom=${dateRange.from}&rangeTo=${dateRange.to}`;
cy.visit(fullUrl, { auth: { username, password } });

cy.viewport('macbook-15');
Expand Down
9 changes: 1 addition & 8 deletions x-pack/plugins/apm/e2e/cypress/integration/snapshots.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,5 @@
module.exports = {
"__version": "4.5.0",
"APM": {
"Transaction duration charts": {
"1": "55 ms",
"2": "28 ms",
"3": "0 ms"
}
},
"__version": "4.9.0",
"RUM Dashboard": {
"Client metrics": {
"1": "55 ",
Expand Down
Loading

0 comments on commit 9bb1f4e

Please sign in to comment.