Skip to content

Commit

Permalink
Merge branch 'master' into pipeline-tasks
Browse files Browse the repository at this point in the history
  • Loading branch information
elasticmachine authored Jul 6, 2020
2 parents 7fa0b0b + e298317 commit 09f17a8
Show file tree
Hide file tree
Showing 349 changed files with 9,595 additions and 3,115 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
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@
"@babel/plugin-transform-modules-commonjs": "^7.10.1",
"@babel/register": "^7.10.1",
"@elastic/apm-rum": "^5.2.0",
"@elastic/charts": "19.6.3",
"@elastic/charts": "19.7.0",
"@elastic/datemath": "5.0.3",
"@elastic/ems-client": "7.9.3",
"@elastic/eui": "24.1.0",
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
2 changes: 1 addition & 1 deletion packages/kbn-ui-shared-deps/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"kbn:watch": "node scripts/build --dev --watch"
},
"dependencies": {
"@elastic/charts": "19.6.3",
"@elastic/charts": "19.7.0",
"@elastic/eui": "24.1.0",
"@elastic/numeral": "^2.5.0",
"@kbn/i18n": "1.0.0",
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
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import { WithMultiContent, useMultiContentContext, HookProps } from '../multi_co

export interface Props<T extends object> {
onSave: (data: T) => void | Promise<void>;
children: JSX.Element | JSX.Element[];
children: JSX.Element | Array<JSX.Element | null | false>;
isEditing?: boolean;
defaultActiveStep?: number;
defaultValue?: HookProps<T>['defaultValue'];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export function useMultiContentContext<T extends object = { [key: string]: any }
*
* @param contentId The content id to be added to the "contents" map
*/
export function useContent<T extends object = { [key: string]: any }>(contentId: keyof T) {
export function useContent<T extends object, K extends keyof T>(contentId: K) {
const { updateContentAt, saveSnapshotAndRemoveContent, getData } = useMultiContentContext<T>();

const updateContent = useCallback(
Expand All @@ -71,8 +71,11 @@ export function useContent<T extends object = { [key: string]: any }>(contentId:
};
}, [contentId, saveSnapshotAndRemoveContent]);

const data = getData();
const defaultValue = data[contentId];

return {
defaultValue: getData()[contentId]!,
defaultValue,
updateContent,
getData,
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,10 @@ export function useMultiContent<T extends object>({
* Validate the multi-content active content(s) in the DOM
*/
const validate = useCallback(async () => {
if (Object.keys(contents.current).length === 0) {
return Boolean(validation.isValid);
}

const updatedValidation = {} as { [key in keyof T]?: boolean | undefined };

for (const [id, _content] of Object.entries(contents.current)) {
Expand Down
7 changes: 2 additions & 5 deletions src/plugins/es_ui_shared/public/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
* In the future, each top level folder should be exported like that to avoid naming collision
*/
import * as Forms from './forms';
import * as Monaco from './monaco';

export { JsonEditor, OnJsonEditorUpdateHandler } from './components/json_editor';

Expand Down Expand Up @@ -53,10 +54,6 @@ export {
expandLiteralStrings,
} from './console_lang';

import * as Monaco from './monaco';

export { Monaco };

export {
AuthorizationContext,
AuthorizationProvider,
Expand All @@ -69,7 +66,7 @@ export {
useAuthorizationContext,
} from './authorization';

export { Forms };
export { Monaco, Forms };

/** dummy plugin, we just want esUiShared to have its own bundle */
export function plugin() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,13 @@ import { ValidationFunc } from '../../hook_form_lib';
import { isJSON } from '../../../validators/string';
import { ERROR_CODE } from './types';

export const isJsonField = (message: string) => (
...args: Parameters<ValidationFunc>
): ReturnType<ValidationFunc<any, ERROR_CODE>> => {
export const isJsonField = (
message: string,
{ allowEmptyString = false }: { allowEmptyString?: boolean } = {}
) => (...args: Parameters<ValidationFunc>): ReturnType<ValidationFunc<any, ERROR_CODE>> => {
const [{ value }] = args;

if (typeof value !== 'string') {
if (typeof value !== 'string' || (allowEmptyString && value.trim() === '')) {
return;
}

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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ export interface TutorialSchema {
name: string;
isBeta?: boolean;
shortDescription: string;
euiIconType?: IconType; // EUI icon type string, one of https://elastic.github.io/eui/#/icon;
euiIconType?: IconType; // EUI icon type string, one of https://elastic.github.io/eui/#/display/icons;
longDescription: string;
completionTimeMinutes?: number;
previewImagePath?: string;
Expand Down
77 changes: 77 additions & 0 deletions src/plugins/home/server/tutorials/googlecloud_metrics/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
/*
* 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 { i18n } from '@kbn/i18n';
import { TutorialsCategory } from '../../services/tutorials';
import {
onPremInstructions,
cloudInstructions,
onPremCloudInstructions,
} from '../instructions/metricbeat_instructions';
import {
TutorialContext,
TutorialSchema,
} from '../../services/tutorials/lib/tutorials_registry_types';

export function googlecloudMetricsSpecProvider(context: TutorialContext): TutorialSchema {
const moduleName = 'googlecloud';
return {
id: 'googlecloudMetrics',
name: i18n.translate('home.tutorials.googlecloudMetrics.nameTitle', {
defaultMessage: 'Google Cloud metrics',
}),
category: TutorialsCategory.METRICS,
shortDescription: i18n.translate('home.tutorials.googlecloudMetrics.shortDescription', {
defaultMessage:
'Fetch monitoring metrics from Google Cloud Platform using Stackdriver Monitoring API.',
}),
longDescription: i18n.translate('home.tutorials.googlecloudMetrics.longDescription', {
defaultMessage:
'The `googlecloud` Metricbeat module fetches monitoring metrics from Google Cloud Platform using Stackdriver Monitoring API. \
[Learn more]({learnMoreLink}).',
values: {
learnMoreLink: '{config.docs.beats.metricbeat}/metricbeat-module-googlecloud.html',
},
}),
euiIconType: 'logoGCP',
isBeta: false,
artifacts: {
dashboards: [
{
id: 'f40ee870-5e4a-11ea-a4f6-717338406083',
linkLabel: i18n.translate(
'home.tutorials.googlecloudMetrics.artifacts.dashboards.linkLabel',
{
defaultMessage: 'Google Cloud metrics dashboard',
}
),
isOverview: true,
},
],
exportedFields: {
documentationUrl: '{config.docs.beats.metricbeat}/exported-fields-googlecloud.html',
},
},
completionTimeMinutes: 10,
previewImagePath: '/plugins/home/assets/googlecloud_metrics/screenshot.png',
onPrem: onPremInstructions(moduleName, context),
elasticCloud: cloudInstructions(moduleName),
onPremElasticCloud: onPremCloudInstructions(moduleName),
};
}
Loading

0 comments on commit 09f17a8

Please sign in to comment.