Skip to content

Commit

Permalink
Merge branch 'master' into field_mapping_connector
Browse files Browse the repository at this point in the history
  • Loading branch information
kibanamachine authored Jun 18, 2021
2 parents f110d0c + 693823f commit cf9a26e
Show file tree
Hide file tree
Showing 140 changed files with 1,923 additions and 903 deletions.
2 changes: 1 addition & 1 deletion .buildkite/scripts/post_build_kibana.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ if [[ ! "${DISABLE_CI_STATS_SHIPPING:-}" ]]; then
echo "--- Ship Kibana Distribution Metrics to CI Stats"
node scripts/ship_ci_stats \
--metrics target/optimizer_bundle_metrics.json \
--metrics packages/kbn-ui-shared-deps/target/metrics.json
--metrics node_modules/@kbn/ui-shared-deps/shared_built_assets/metrics.json
fi

echo "--- Upload Build Artifacts"
Expand Down
2 changes: 1 addition & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ snapshots.js
/packages/kbn-test/src/functional_test_runner/__tests__/fixtures/
/packages/kbn-test/src/functional_test_runner/lib/config/__tests__/fixtures/
/packages/kbn-ui-framework/dist
/packages/kbn-ui-shared-deps/flot_charts
/packages/kbn-ui-shared-deps/src/flot_charts
/packages/kbn-monaco/src/painless/antlr

# Bazel
Expand Down
2 changes: 1 addition & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -1471,7 +1471,7 @@ module.exports = {
},
},
{
files: ['packages/kbn-ui-shared-deps/flot_charts/**/*.js'],
files: ['packages/kbn-ui-shared-deps/src/flot_charts/**/*.js'],
env: {
jquery: true,
},
Expand Down
2 changes: 1 addition & 1 deletion .i18nrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"uiActionsExamples": "examples/ui_action_examples",
"share": "src/plugins/share",
"home": "src/plugins/home",
"flot": "packages/kbn-ui-shared-deps/flot_charts",
"flot": "packages/kbn-ui-shared-deps/src/flot_charts",
"charts": "src/plugins/charts",
"esUi": "src/plugins/es_ui_shared",
"devTools": "src/plugins/dev_tools",
Expand Down
1 change: 1 addition & 0 deletions docs/developer/getting-started/monorepo-packages.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -102,5 +102,6 @@ yarn kbn watch-bazel
- @kbn/std
- @kbn/telemetry-utils
- @kbn/tinymath
- @kbn/ui-shared-deps
- @kbn/utility-types
- @kbn/utils
24 changes: 24 additions & 0 deletions docs/management/connectors/action-types/email.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -95,13 +95,37 @@ The email connector can send email using many popular SMTP email services.

For more information about configuring the email connector to work with different email systems, refer to:

* <<elasticcloud>>
* <<gmail>>
* <<outlook>>
* <<exchange>>
* <<amazon-ses>>

For other email servers, you can check the list of well-known services that Nodemailer supports in the JSON file https://github.com/nodemailer/nodemailer/blob/master/lib/well-known/services.json[well-known/services.json]. The properties of the objects in those files &mdash; `host`, `port`, and `secure` &mdash; correspond to the same email connector configuration properties. A missing `secure` property in the "well-known/services.json" file is considered `false`. Typically, `port: 465` uses `secure: true`, and `port: 25` and `port: 587` use `secure: false`.

[float]
[[elasticcloud]]
==== Sending email from Elastic Cloud

IMPORTANT: These instructions require you to link:{cloud}/ec-watcher.html#ec-watcher-whitelist[whitelist] the email addresses that notifications get sent first.

Use the following connector settings to send email from Elastic Cloud:

Sender::
`[email protected]`

Host::
`dockerhost`

Port::
`10025`

Secure::
Toggle off

Authentication::
Toggle off

[float]
[[gmail]]
==== Sending email from Gmail
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@
"@kbn/std": "link:bazel-bin/packages/kbn-std",
"@kbn/tinymath": "link:bazel-bin/packages/kbn-tinymath",
"@kbn/ui-framework": "link:packages/kbn-ui-framework",
"@kbn/ui-shared-deps": "link:packages/kbn-ui-shared-deps",
"@kbn/ui-shared-deps": "link:bazel-bin/packages/kbn-ui-shared-deps",
"@kbn/utility-types": "link:bazel-bin/packages/kbn-utility-types",
"@kbn/common-utils": "link:bazel-bin/packages/kbn-common-utils",
"@kbn/utils": "link:bazel-bin/packages/kbn-utils",
Expand Down Expand Up @@ -291,6 +291,7 @@
"mapbox-gl-draw-rectangle-mode": "1.0.4",
"markdown-it": "^10.0.0",
"md5": "^2.1.0",
"mdast-util-to-hast": "10.0.1",
"memoize-one": "^5.0.0",
"mime": "^2.4.4",
"mime-types": "^2.1.27",
Expand Down
1 change: 1 addition & 0 deletions packages/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ filegroup(
"//packages/kbn-std:build",
"//packages/kbn-telemetry-tools:build",
"//packages/kbn-tinymath:build",
"//packages/kbn-ui-shared-deps:build",
"//packages/kbn-utility-types:build",
"//packages/kbn-utils:build",
],
Expand Down
3 changes: 2 additions & 1 deletion packages/kbn-monaco/src/esql/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
* Side Public License, v 1.
*/

import { LangModule as LangModuleType } from '../types';
import { ID } from './constants';
import { lexerRules } from './lexer_rules';

export const EsqlLang = { ID, lexerRules };
export const EsqlLang: LangModuleType = { ID, lexerRules };
21 changes: 21 additions & 0 deletions packages/kbn-monaco/src/helpers.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/
import { monaco } from './monaco_imports';
import { LangModule as LangModuleType } from './types';

function registerLanguage(language: LangModuleType) {
const { ID, lexerRules, languageConfiguration } = language;

monaco.languages.register({ id: ID });
monaco.languages.setMonarchTokensProvider(ID, lexerRules);
if (languageConfiguration) {
monaco.languages.setLanguageConfiguration(ID, languageConfiguration);
}
}

export { registerLanguage };
10 changes: 8 additions & 2 deletions packages/kbn-monaco/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,13 @@ import './register_globals';
export { monaco } from './monaco_imports';
export { XJsonLang } from './xjson';
export { PainlessLang, PainlessContext, PainlessAutocompleteField } from './painless';

/* eslint-disable-next-line @kbn/eslint/module_migration */
import * as BarePluginApi from 'monaco-editor/esm/vs/editor/editor.api';
export { BarePluginApi };

import { registerLanguage } from './helpers';
import {
LangModule as LangModuleType,
CompleteLangModule as CompleteLangModuleType,
} from './types';

export { BarePluginApi, registerLanguage, LangModuleType, CompleteLangModuleType };
3 changes: 2 additions & 1 deletion packages/kbn-monaco/src/painless/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@
import { ID } from './constants';
import { lexerRules, languageConfiguration } from './lexer_rules';
import { getSuggestionProvider, getSyntaxErrors } from './language';
import { CompleteLangModule as CompleteLangModuleType } from '../types';

export const PainlessLang = {
export const PainlessLang: CompleteLangModuleType = {
ID,
getSuggestionProvider,
lexerRules,
Expand Down
13 changes: 5 additions & 8 deletions packages/kbn-monaco/src/register_globals.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ import { XJsonLang } from './xjson';
import { PainlessLang } from './painless';
import { EsqlLang } from './esql';
import { monaco } from './monaco_imports';
import { registerLanguage } from './helpers';

// @ts-ignore
import xJsonWorkerSrc from '!!raw-loader!../../target_web/xjson.editor.worker.js';
// @ts-ignore
Expand All @@ -20,14 +22,9 @@ import painlessWorkerSrc from '!!raw-loader!../../target_web/painless.editor.wor
/**
* Register languages and lexer rules
*/
monaco.languages.register({ id: XJsonLang.ID });
monaco.languages.setMonarchTokensProvider(XJsonLang.ID, XJsonLang.lexerRules);
monaco.languages.setLanguageConfiguration(XJsonLang.ID, XJsonLang.languageConfiguration);
monaco.languages.register({ id: PainlessLang.ID });
monaco.languages.setMonarchTokensProvider(PainlessLang.ID, PainlessLang.lexerRules);
monaco.languages.setLanguageConfiguration(PainlessLang.ID, PainlessLang.languageConfiguration);
monaco.languages.register({ id: EsqlLang.ID });
monaco.languages.setMonarchTokensProvider(EsqlLang.ID, EsqlLang.lexerRules);
registerLanguage(XJsonLang);
registerLanguage(PainlessLang);
registerLanguage(EsqlLang);

/**
* Create web workers by language ID
Expand Down
22 changes: 22 additions & 0 deletions packages/kbn-monaco/src/types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/
import { monaco } from './monaco_imports';

export interface LangModule {
ID: string;
lexerRules: monaco.languages.IMonarchLanguage;
languageConfiguration?: monaco.languages.LanguageConfiguration;
getSuggestionProvider?: Function;
getSyntaxErrors?: Function;
}

export interface CompleteLangModule extends LangModule {
languageConfiguration: monaco.languages.LanguageConfiguration;
getSuggestionProvider: Function;
getSyntaxErrors: Function;
}
3 changes: 2 additions & 1 deletion packages/kbn-monaco/src/xjson/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,6 @@
import './language';
import { ID } from './constants';
import { lexerRules, languageConfiguration } from './lexer_rules';
import { LangModule as LangModuleType } from '../types';

export const XJsonLang = { ID, lexerRules, languageConfiguration };
export const XJsonLang: LangModuleType = { ID, lexerRules, languageConfiguration };
3 changes: 0 additions & 3 deletions packages/kbn-optimizer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,5 @@
"build": "../../node_modules/.bin/tsc",
"kbn:bootstrap": "yarn build",
"kbn:watch": "yarn build --watch"
},
"dependencies": {
"@kbn/ui-shared-deps": "link:../kbn-ui-shared-deps"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import cpy from 'cpy';
import del from 'del';
import { tap, filter } from 'rxjs/operators';
import { REPO_ROOT } from '@kbn/utils';
import { ToolingLog } from '@kbn/dev-utils';
import { ToolingLog, createReplaceSerializer } from '@kbn/dev-utils';
import { runOptimizer, OptimizerConfig, OptimizerUpdate, logOptimizerState } from '../index';

import { allValuesFrom } from '../common';
Expand All @@ -29,6 +29,8 @@ expect.addSnapshotSerializer({
test: (value: any) => typeof value === 'string' && value.includes(REPO_ROOT),
});

expect.addSnapshotSerializer(createReplaceSerializer(/\w+-fastbuild/, '<platform>-fastbuild'));

const log = new ToolingLog({
level: 'error',
writeTo: {
Expand Down Expand Up @@ -130,13 +132,13 @@ it('builds expected bundles, saves bundle counts to metadata', async () => {
expect(foo.cache.getModuleCount()).toBe(6);
expect(foo.cache.getReferencedFiles()).toMatchInlineSnapshot(`
Array [
<absolute path>/packages/kbn-optimizer/src/__fixtures__/__tmp__/mock_repo/bazel-out/<platform>-fastbuild/bin/packages/kbn-ui-shared-deps/target/public_path_module_creator.js,
<absolute path>/packages/kbn-optimizer/src/__fixtures__/__tmp__/mock_repo/plugins/foo/kibana.json,
<absolute path>/packages/kbn-optimizer/src/__fixtures__/__tmp__/mock_repo/plugins/foo/public/async_import.ts,
<absolute path>/packages/kbn-optimizer/src/__fixtures__/__tmp__/mock_repo/plugins/foo/public/ext.ts,
<absolute path>/packages/kbn-optimizer/src/__fixtures__/__tmp__/mock_repo/plugins/foo/public/index.ts,
<absolute path>/packages/kbn-optimizer/src/__fixtures__/__tmp__/mock_repo/plugins/foo/public/lib.ts,
<absolute path>/packages/kbn-optimizer/src/worker/entry_point_creator.ts,
<absolute path>/packages/kbn-ui-shared-deps/public_path_module_creator.js,
]
`);

Expand All @@ -153,6 +155,7 @@ it('builds expected bundles, saves bundle counts to metadata', async () => {
<absolute path>/node_modules/@kbn/optimizer/postcss.config.js,
<absolute path>/node_modules/css-loader/package.json,
<absolute path>/node_modules/style-loader/package.json,
<absolute path>/packages/kbn-optimizer/src/__fixtures__/__tmp__/mock_repo/bazel-out/<platform>-fastbuild/bin/packages/kbn-ui-shared-deps/target/public_path_module_creator.js,
<absolute path>/packages/kbn-optimizer/src/__fixtures__/__tmp__/mock_repo/plugins/bar/kibana.json,
<absolute path>/packages/kbn-optimizer/src/__fixtures__/__tmp__/mock_repo/plugins/bar/public/index.scss,
<absolute path>/packages/kbn-optimizer/src/__fixtures__/__tmp__/mock_repo/plugins/bar/public/index.ts,
Expand All @@ -162,7 +165,6 @@ it('builds expected bundles, saves bundle counts to metadata', async () => {
<absolute path>/packages/kbn-optimizer/src/__fixtures__/__tmp__/mock_repo/src/core/public/core_app/styles/_globals_v8dark.scss,
<absolute path>/packages/kbn-optimizer/src/__fixtures__/__tmp__/mock_repo/src/core/public/core_app/styles/_globals_v8light.scss,
<absolute path>/packages/kbn-optimizer/src/worker/entry_point_creator.ts,
<absolute path>/packages/kbn-ui-shared-deps/public_path_module_creator.js,
]
`);

Expand All @@ -173,10 +175,10 @@ it('builds expected bundles, saves bundle counts to metadata', async () => {

expect(baz.cache.getReferencedFiles()).toMatchInlineSnapshot(`
Array [
<absolute path>/packages/kbn-optimizer/src/__fixtures__/__tmp__/mock_repo/bazel-out/<platform>-fastbuild/bin/packages/kbn-ui-shared-deps/target/public_path_module_creator.js,
<absolute path>/packages/kbn-optimizer/src/__fixtures__/__tmp__/mock_repo/x-pack/baz/kibana.json,
<absolute path>/packages/kbn-optimizer/src/__fixtures__/__tmp__/mock_repo/x-pack/baz/public/index.ts,
<absolute path>/packages/kbn-optimizer/src/worker/entry_point_creator.ts,
<absolute path>/packages/kbn-ui-shared-deps/public_path_module_creator.js,
]
`);
});
Expand Down
15 changes: 13 additions & 2 deletions packages/kbn-optimizer/src/worker/populate_bundle_cache_plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,19 @@ export class PopulateBundleCachePlugin {
for (const module of compilation.modules) {
if (isNormalModule(module)) {
moduleCount += 1;
const path = getModulePath(module);
const parsedPath = parseFilePath(path);
let path = getModulePath(module);
let parsedPath = parseFilePath(path);

if (parsedPath.dirs.includes('bazel-out')) {
const index = parsedPath.dirs.indexOf('bazel-out');
path = Path.join(
workerConfig.repoRoot,
'bazel-out',
...parsedPath.dirs.slice(index + 1),
parsedPath.filename ?? ''
);
parsedPath = parseFilePath(path);
}

if (!parsedPath.dirs.includes('node_modules')) {
referencedFiles.add(path);
Expand Down
Loading

0 comments on commit cf9a26e

Please sign in to comment.