diff --git a/.eslintrc.js b/.eslintrc.js index 27e18d74aecc4..ad86cde9dc52c 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -398,7 +398,7 @@ module.exports = { 'import/no-extraneous-dependencies': [ 'error', { - packageDir: resolve(__dirname, 'x-pack/package.json'), + packageDir: './x-pack/', }, ], }, @@ -417,7 +417,7 @@ module.exports = { { devDependencies: true, peerDependencies: true, - packageDir: resolve(__dirname, 'x-pack/package.json'), + packageDir: './x-pack/', }, ], }, @@ -429,7 +429,7 @@ module.exports = { 'import/no-extraneous-dependencies': [ 'error', { - packageDir: resolve(__dirname, 'x-pack/package.json'), + packageDir: './x-pack/', }, ], 'import/no-unresolved': [ diff --git a/.i18nrc.json b/.i18nrc.json index 30301d72f36ec..8ac1cf0fbd1ea 100644 --- a/.i18nrc.json +++ b/.i18nrc.json @@ -4,6 +4,7 @@ "inputControl":"src/core_plugins/input_control_vis", "kbn": "src/core_plugins/kibana", "markdownVis": "src/core_plugins/markdown_vis", + "metricVis": "src/core_plugins/metric_vis", "statusPage": "src/core_plugins/status_page", "xpack.idxMgmt": "x-pack/plugins/index_management" }, diff --git a/docs/discover/kuery.asciidoc b/docs/discover/kuery.asciidoc index 864b638ca8291..b4945bf5eea70 100644 --- a/docs/discover/kuery.asciidoc +++ b/docs/discover/kuery.asciidoc @@ -13,9 +13,9 @@ what's new. ============ Starting in 6.3, you can choose to opt-in to a number of exciting experimental query language enhancements under the -options menu in the query bar. Currently, opting in will enable autocomplete functionality, scripted field support, -and a simplified, easier to use syntax. We're hard at work building even more features for you to try out. Take -these features for a spin and let us know what you think! +options menu in the query bar. Currently, opting in will enable scripted field support and a simplified, easier to +use syntax. If you have a Basic license or above, autocomplete functionality will also be enabled. We're hard at +work building even more features for you to try out. Take these features for a spin and let us know what you think! ==== New Simplified Syntax diff --git a/docs/setup/settings.asciidoc b/docs/setup/settings.asciidoc index 7a21705336313..55128f213f356 100644 --- a/docs/setup/settings.asciidoc +++ b/docs/setup/settings.asciidoc @@ -22,7 +22,7 @@ you'll need to update your `kibana.yml` file. You can also enable SSL and set a `elasticsearch.customHeaders:`:: *Default: `{}`* Header names and values to send to Elasticsearch. Any custom headers cannot be overwritten by client-side headers, regardless of the `elasticsearch.requestHeadersWhitelist` configuration. -`elasticsearch.logQueries:`:: *Default: `false`* Logs queries sent to Elasticsearch. Requires `logging.verbose` set to `true`. This is useful for seeing the query DSL generated by applications that currently do not have a spy panel, for example Timelion and Monitoring. +`elasticsearch.logQueries:`:: *Default: `false`* Logs queries sent to Elasticsearch. Requires `logging.verbose` set to `true`. This is useful for seeing the query DSL generated by applications that currently do not have an inspector, for example Timelion and Monitoring. `elasticsearch.pingTimeout:`:: *Default: the value of the `elasticsearch.requestTimeout` setting* Time in milliseconds to wait for Elasticsearch to respond to pings. diff --git a/package.json b/package.json index 5370eb9ac579c..f2c760ed19cc1 100644 --- a/package.json +++ b/package.json @@ -201,8 +201,8 @@ "yauzl": "2.7.0" }, "devDependencies": { - "@babel/parser": "7.0.0-beta.52", - "@babel/types": "7.0.0-beta.31", + "@babel/parser": "^7.1.0", + "@babel/types": "^7.0.0", "@elastic/eslint-config-kibana": "link:packages/eslint-config-kibana", "@elastic/eslint-plugin-kibana-custom": "link:packages/eslint-plugin-kibana-custom", "@kbn/es": "link:packages/kbn-es", @@ -249,7 +249,7 @@ "@types/type-detect": "^4.0.1", "@types/uuid": "^3.4.4", "angular-mocks": "1.4.7", - "babel-eslint": "8.1.2", + "babel-eslint": "^9.0.0", "babel-jest": "^23.4.2", "backport": "4.4.1", "chai": "3.5.0", @@ -262,16 +262,16 @@ "enzyme": "3.2.0", "enzyme-adapter-react-16": "^1.1.1", "enzyme-to-json": "3.3.1", - "eslint": "4.14.0", - "eslint-config-prettier": "^2.9.0", - "eslint-plugin-babel": "4.1.2", - "eslint-plugin-import": "2.8.0", - "eslint-plugin-jest": "^21.22.0", - "eslint-plugin-mocha": "4.11.0", + "eslint": "^5.6.0", + "eslint-config-prettier": "^3.1.0", + "eslint-plugin-babel": "^5.2.0", + "eslint-plugin-import": "^2.14.0", + "eslint-plugin-jest": "^21.22.1", + "eslint-plugin-mocha": "^5.2.0", "eslint-plugin-no-unsanitized": "^3.0.2", - "eslint-plugin-prefer-object-spread": "1.2.1", - "eslint-plugin-prettier": "^2.6.0", - "eslint-plugin-react": "7.5.1", + "eslint-plugin-prefer-object-spread": "^1.2.1", + "eslint-plugin-prettier": "^2.6.2", + "eslint-plugin-react": "^7.11.1", "event-stream": "3.3.2", "expect.js": "0.3.1", "faker": "1.1.0", @@ -318,7 +318,7 @@ "normalize-path": "^3.0.0", "pixelmatch": "4.0.2", "postcss": "^7.0.2", - "prettier": "^1.14.0", + "prettier": "^1.14.3", "proxyquire": "1.7.11", "regenerate": "^1.4.0", "simple-git": "1.37.0", @@ -332,7 +332,7 @@ "ts-node": "^7.0.1", "tslint": "^5.11.0", "tslint-config-prettier": "^1.15.0", - "tslint-plugin-prettier": "^1.3.0", + "tslint-plugin-prettier": "^2.0.0", "typescript": "^3.0.3", "vinyl-fs": "^3.0.2", "xml2js": "^0.4.19", diff --git a/packages/eslint-config-kibana/jest.js b/packages/eslint-config-kibana/jest.js index 8c34fb00a000c..c28a9c48c6826 100644 --- a/packages/eslint-config-kibana/jest.js +++ b/packages/eslint-config-kibana/jest.js @@ -7,7 +7,7 @@ module.exports = { ], env: { - 'jest/globals': true, + 'jest': true, }, rules: { diff --git a/packages/eslint-config-kibana/package.json b/packages/eslint-config-kibana/package.json index 19574bb2df058..bb393553e987a 100644 --- a/packages/eslint-config-kibana/package.json +++ b/packages/eslint-config-kibana/package.json @@ -15,14 +15,14 @@ }, "homepage": "https://github.com/elastic/eslint-config-kibana#readme", "peerDependencies": { - "babel-eslint": "^8.0.0", - "eslint": "^4.1.0", - "eslint-plugin-babel": "^4.1.1", - "eslint-plugin-import": "^2.6.0", - "eslint-plugin-jest": "^21.22.0", - "eslint-plugin-mocha": "^4.9.0", + "babel-eslint": "^9.0.0", + "eslint": "^5.6.0", + "eslint-plugin-babel": "^5.2.0", + "eslint-plugin-import": "^2.14.0", + "eslint-plugin-jest": "^21.22.1", + "eslint-plugin-mocha": "^5.2.0", "eslint-plugin-no-unsanitized": "^3.0.2", "eslint-plugin-prefer-object-spread": "^1.2.1", - "eslint-plugin-react": "^7.1.0" + "eslint-plugin-react": "^7.11.1" } } diff --git a/packages/kbn-eslint-import-resolver-kibana/package.json b/packages/kbn-eslint-import-resolver-kibana/package.json index a0439beb04e61..9a6f506c022a6 100755 --- a/packages/kbn-eslint-import-resolver-kibana/package.json +++ b/packages/kbn-eslint-import-resolver-kibana/package.json @@ -11,8 +11,8 @@ }, "dependencies": { "debug": "^2.6.6", - "eslint-import-resolver-node": "^0.3.0", - "eslint-import-resolver-webpack": "^0.8.1", + "eslint-import-resolver-node": "^0.3.2", + "eslint-import-resolver-webpack": "^0.10.1", "glob-all": "^3.1.0", "lru-cache": "^4.1.2", "resolve": "^1.7.1", diff --git a/packages/kbn-eslint-import-resolver-kibana/yarn.lock b/packages/kbn-eslint-import-resolver-kibana/yarn.lock index 88a2b84696c19..72d146ec26691 100644 --- a/packages/kbn-eslint-import-resolver-kibana/yarn.lock +++ b/packages/kbn-eslint-import-resolver-kibana/yarn.lock @@ -687,27 +687,26 @@ escope@^3.6.0: esrecurse "^4.1.0" estraverse "^4.1.1" -eslint-import-resolver-node@^0.3.0: +eslint-import-resolver-node@^0.3.2: version "0.3.2" - resolved "https://registry.npmjs.org/eslint-import-resolver-node/-/eslint-import-resolver-node-0.3.2.tgz#58f15fb839b8d0576ca980413476aab2472db66a" + resolved "https://registry.yarnpkg.com/eslint-import-resolver-node/-/eslint-import-resolver-node-0.3.2.tgz#58f15fb839b8d0576ca980413476aab2472db66a" dependencies: debug "^2.6.9" resolve "^1.5.0" -eslint-import-resolver-webpack@^0.8.1: - version "0.8.4" - resolved "https://registry.npmjs.org/eslint-import-resolver-webpack/-/eslint-import-resolver-webpack-0.8.4.tgz#0f7cd74bc9d7fc1773e8d5fc25baf864b2f87a42" +eslint-import-resolver-webpack@^0.10.1: + version "0.10.1" + resolved "https://registry.yarnpkg.com/eslint-import-resolver-webpack/-/eslint-import-resolver-webpack-0.10.1.tgz#4cbceed2c0c43e488a74775c30861e58e00fb290" dependencies: array-find "^1.0.0" debug "^2.6.8" enhanced-resolve "~0.9.0" - find-root "^0.1.1" + find-root "^1.1.0" has "^1.0.1" interpret "^1.0.0" - is-absolute "^0.2.3" - lodash.get "^3.7.0" + lodash "^4.17.4" node-libs-browser "^1.0.0 || ^2.0.0" - resolve "^1.2.0" + resolve "^1.4.0" semver "^5.3.0" esrecurse@^4.1.0: @@ -817,9 +816,9 @@ fill-range@^4.0.0: repeat-string "^1.6.1" to-regex-range "^2.1.0" -find-root@^0.1.1: - version "0.1.2" - resolved "https://registry.npmjs.org/find-root/-/find-root-0.1.2.tgz#98d2267cff1916ccaf2743b3a0eea81d79d7dcd1" +find-root@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/find-root/-/find-root-1.1.0.tgz#abcfc8ba76f708c42a97b3d685b7e9450bfb9ce4" find-up@^2.0.0: version "2.1.0" @@ -1085,13 +1084,6 @@ invert-kv@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/invert-kv/-/invert-kv-1.0.0.tgz#104a8e4aaca6d3d8cd157a8ef8bfab2d7a3ffdb6" -is-absolute@^0.2.3: - version "0.2.6" - resolved "https://registry.npmjs.org/is-absolute/-/is-absolute-0.2.6.tgz#20de69f3db942ef2d87b9c2da36f172235b1b5eb" - dependencies: - is-relative "^0.2.1" - is-windows "^0.2.0" - is-accessor-descriptor@^0.1.6: version "0.1.6" resolved "https://registry.yarnpkg.com/is-accessor-descriptor/-/is-accessor-descriptor-0.1.6.tgz#a9e12cb3ae8d876727eeef3843f8a0897b5c98d6" @@ -1210,12 +1202,6 @@ is-plain-object@^2.0.1, is-plain-object@^2.0.3, is-plain-object@^2.0.4: dependencies: isobject "^3.0.1" -is-relative@^0.2.1: - version "0.2.1" - resolved "https://registry.npmjs.org/is-relative/-/is-relative-0.2.1.tgz#d27f4c7d516d175fb610db84bbeef23c3bc97aa5" - dependencies: - is-unc-path "^0.1.1" - is-stream@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/is-stream/-/is-stream-1.1.0.tgz#12d4a3dd4e68e0b79ceb8dbc84173ae80d91ca44" @@ -1224,16 +1210,6 @@ is-typedarray@~1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/is-typedarray/-/is-typedarray-1.0.0.tgz#e479c80858df0c1b11ddda6940f96011fcda4a9a" -is-unc-path@^0.1.1: - version "0.1.2" - resolved "https://registry.npmjs.org/is-unc-path/-/is-unc-path-0.1.2.tgz#6ab053a72573c10250ff416a3814c35178af39b9" - dependencies: - unc-path-regex "^0.1.0" - -is-windows@^0.2.0: - version "0.2.0" - resolved "https://registry.npmjs.org/is-windows/-/is-windows-0.2.0.tgz#de1aa6d63ea29dd248737b69f1ff8b8002d2108c" - is-windows@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/is-windows/-/is-windows-1.0.2.tgz#d1850eb9791ecd18e6182ce12a30f396634bb19d" @@ -1361,31 +1337,14 @@ locate-path@^2.0.0: p-locate "^2.0.0" path-exists "^3.0.0" -lodash._baseget@^3.0.0: - version "3.7.2" - resolved "https://registry.npmjs.org/lodash._baseget/-/lodash._baseget-3.7.2.tgz#1b6ae1d5facf3c25532350a13c1197cb8bb674f4" - -lodash._topath@^3.0.0: - version "3.8.1" - resolved "https://registry.npmjs.org/lodash._topath/-/lodash._topath-3.8.1.tgz#3ec5e2606014f4cb97f755fe6914edd8bfc00eac" - dependencies: - lodash.isarray "^3.0.0" - -lodash.get@^3.7.0: - version "3.7.0" - resolved "https://registry.npmjs.org/lodash.get/-/lodash.get-3.7.0.tgz#3ce68ae2c91683b281cc5394128303cbf75e691f" - dependencies: - lodash._baseget "^3.0.0" - lodash._topath "^3.0.0" - -lodash.isarray@^3.0.0: - version "3.0.4" - resolved "https://registry.npmjs.org/lodash.isarray/-/lodash.isarray-3.0.4.tgz#79e4eb88c36a8122af86f844aa9bcd851b5fbb55" - lodash@^4.14.0: version "4.17.5" resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.5.tgz#99a92d65c0272debe8c96b6057bc8fbfa3bed511" +lodash@^4.17.4: + version "4.17.11" + resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.11.tgz#b39ea6229ef607ecd89e2c8df12536891cac9b8d" + longest@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/longest/-/longest-1.0.1.tgz#30a0b2da38f73770e8294a0d22e6625ed77d0097" @@ -1946,7 +1905,13 @@ resolve-url@^0.2.1: version "0.2.1" resolved "https://registry.yarnpkg.com/resolve-url/-/resolve-url-0.2.1.tgz#2c637fe77c893afd2a663fe21aa9080068e2052a" -resolve@^1.2.0, resolve@^1.5.0, resolve@^1.7.1: +resolve@^1.4.0: + version "1.8.1" + resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.8.1.tgz#82f1ec19a423ac1fbd080b0bab06ba36e84a7a26" + dependencies: + path-parse "^1.0.5" + +resolve@^1.5.0, resolve@^1.7.1: version "1.7.1" resolved "https://registry.npmjs.org/resolve/-/resolve-1.7.1.tgz#aadd656374fd298aee895bc026b8297418677fd3" dependencies: @@ -2326,10 +2291,6 @@ uid-number@^0.0.6: version "0.0.6" resolved "https://registry.yarnpkg.com/uid-number/-/uid-number-0.0.6.tgz#0ea10e8035e8eb5b8e4449f06da1c730663baa81" -unc-path-regex@^0.1.0: - version "0.1.2" - resolved "https://registry.npmjs.org/unc-path-regex/-/unc-path-regex-0.1.2.tgz#e73dd3d7b0d7c5ed86fbac6b0ae7d8c6a69d50fa" - union-value@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/union-value/-/union-value-1.0.0.tgz#5c71c34cb5bad5dcebe3ea0cd08207ba5aa1aea4" diff --git a/packages/kbn-eslint-plugin-license-header/package.json b/packages/kbn-eslint-plugin-license-header/package.json index 1cd9fbc364a66..2c62a4232cf18 100644 --- a/packages/kbn-eslint-plugin-license-header/package.json +++ b/packages/kbn-eslint-plugin-license-header/package.json @@ -4,8 +4,8 @@ "private": true, "license": "Apache-2.0", "peerDependencies": { - "eslint": ">=4.0.0", - "babel-eslint": "^8.2.1" + "eslint": "^5.6.0", + "babel-eslint": "^9.0.0" }, "dependencies": { "dedent": "^0.7.0" diff --git a/packages/kbn-i18n/README.md b/packages/kbn-i18n/README.md index 54eadbd46ca9e..2a5abe3e2b1da 100644 --- a/packages/kbn-i18n/README.md +++ b/packages/kbn-i18n/README.md @@ -171,6 +171,37 @@ import memoizeIntlConstructor from 'intl-format-cache'; const getMessageFormat = memoizeIntlConstructor(IntlMessageFormat); ``` +## Vanilla JS + +`Intl-messageformat` package assumes that the +[Intl](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl) +global object exists in the runtime. `Intl` is present in all modern +browsers and Node.js 0.10+. In order to load i18n engine +in Node.js we should simply `import` this module (in Node.js, the +[data](https://github.com/yahoo/intl-messageformat/tree/master/dist/locale-data) +for all 200+ languages is loaded along with the library) and pass the translation +messages into `init` method: + +```js +import { i18n } from '@kbn/i18n'; + +i18n.init(messages); +``` + +One common use-case is that of internationalizing a string constant. Here's an +example of how we'd do that: + +```js +import { i18n } from '@kbn/i18n'; + +export const HELLO_WORLD = i18n.translate('hello.wonderful.world', { + defaultMessage: 'Greetings, planet Earth!', +}), +``` + +We're also able to use all methods exposed by the i18n engine +(see [I18n engine](#i18n-engine) section above for more details). + ## React [React-intl](https://github.com/yahoo/react-intl) library is used for internalization @@ -374,26 +405,6 @@ In order to translate attributes in Angular we should use `i18nFilter`: > ``` -## Node.JS - -`Intl-messageformat` package assumes that the -[Intl](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl) -global object exists in the runtime. `Intl` is present in all modern -browsers and Node.js 0.10+. In order to load i18n engine -in Node.js we should simply `import` this module (in Node.js, the -[data](https://github.com/yahoo/intl-messageformat/tree/master/dist/locale-data) -for all 200+ languages is loaded along with the library) and pass the translation -messages into `init` method: - -```js -import { i18n } from '@kbn/i18n'; - -i18n.init(messages); -``` - -After that we are able to use all methods exposed by the i18n engine -(see [I18n engine](#i18n-engine) section above for more details). - ## Build tools In order to simplify localization process, some build tools will be added: diff --git a/packages/kbn-plugin-generator/sao_template/template/package.json b/packages/kbn-plugin-generator/sao_template/template/package.json index f61e589960cd8..b1963b57abbe5 100755 --- a/packages/kbn-plugin-generator/sao_template/template/package.json +++ b/packages/kbn-plugin-generator/sao_template/template/package.json @@ -20,15 +20,15 @@ "@elastic/eslint-config-kibana": "link:../../kibana/packages/eslint-config-kibana", "@elastic/eslint-import-resolver-kibana": "link:../../kibana/packages/kbn-eslint-import-resolver-kibana", "@kbn/plugin-helpers": "link:../../kibana/packages/kbn-plugin-helpers", - "babel-eslint": "^8.0.2", - "eslint": "^4.11.0", - "eslint-plugin-babel": "^4.1.1", - "eslint-plugin-import": "^2.3.0", - "eslint-plugin-jest": "^21.22.0", - "eslint-plugin-mocha": "^4.9.0", + "babel-eslint": "^9.0.0", + "eslint": "^5.6.0", + "eslint-plugin-babel": "^5.2.0", + "eslint-plugin-import": "^2.14.0", + "eslint-plugin-jest": "^21.22.1", + "eslint-plugin-mocha": "^5.2.0", "eslint-plugin-no-unsanitized": "^3.0.2", "eslint-plugin-prefer-object-spread": "^1.2.1", - "eslint-plugin-react": "^7.0.1", + "eslint-plugin-react": "^7.11.1", "expect.js": "^0.3.1" } } diff --git a/packages/kbn-pm/package.json b/packages/kbn-pm/package.json index 4ca3f0b16400c..278e9eb30b7ac 100644 --- a/packages/kbn-pm/package.json +++ b/packages/kbn-pm/package.json @@ -51,7 +51,7 @@ "log-symbols": "^2.2.0", "mkdirp": "^0.5.1", "ora": "^1.4.0", - "prettier": "^1.14.0", + "prettier": "^1.14.3", "read-pkg": "^3.0.0", "rxjs": "^6.2.1", "spawn-sync": "^1.0.15", diff --git a/packages/kbn-pm/yarn.lock b/packages/kbn-pm/yarn.lock index c9bf49572df53..7fb23e4e76ef9 100644 --- a/packages/kbn-pm/yarn.lock +++ b/packages/kbn-pm/yarn.lock @@ -2909,9 +2909,9 @@ preserve@^0.2.0: version "0.2.0" resolved "https://registry.yarnpkg.com/preserve/-/preserve-0.2.0.tgz#815ed1f6ebc65926f865b310c0713bcb3315ce4b" -prettier@^1.14.0: - version "1.14.0" - resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.14.0.tgz#847c235522035fd988100f1f43cf20a7d24f9372" +prettier@^1.14.3: + version "1.14.3" + resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.14.3.tgz#90238dd4c0684b7edce5f83b0fb7328e48bd0895" private@^0.1.6, private@^0.1.7: version "0.1.8" diff --git a/packages/kbn-test/src/es/es_test_cluster.js b/packages/kbn-test/src/es/es_test_cluster.js index d969f7d6ec313..20bee8f1f0468 100644 --- a/packages/kbn-test/src/es/es_test_cluster.js +++ b/packages/kbn-test/src/es/es_test_cluster.js @@ -26,6 +26,7 @@ import { esTestConfig } from './es_test_config'; import { rmrfSync } from './rmrf_sync'; import { KIBANA_ROOT } from '../'; import elasticsearch from 'elasticsearch'; +const path = require('path'); export function createEsTestCluster(options = {}) { const { @@ -61,10 +62,17 @@ export function createEsTestCluster(options = {}) { } async start(esArgs = []) { - const { installPath } = - esFrom === 'source' - ? await cluster.installSource(config) - : await cluster.installSnapshot(config); + let installPath; + + if (esFrom === 'source') { + installPath = (await cluster.installSource(config)).installPath; + } else if (esFrom === 'snapshot') { + installPath = (await cluster.installSnapshot(config)).installPath; + } else if (path.isAbsolute(esFrom)) { + installPath = esFrom; + } else { + throw new Error(`unknown option esFrom "${esFrom}"`); + } await cluster.start(installPath, { esArgs: [ diff --git a/packages/kbn-test/src/functional_tests/cli/start_servers/__snapshots__/args.test.js.snap b/packages/kbn-test/src/functional_tests/cli/start_servers/__snapshots__/args.test.js.snap index 4c022abdf1f01..50da9f6836883 100644 --- a/packages/kbn-test/src/functional_tests/cli/start_servers/__snapshots__/args.test.js.snap +++ b/packages/kbn-test/src/functional_tests/cli/start_servers/__snapshots__/args.test.js.snap @@ -9,14 +9,14 @@ Usage: node scripts/functional_tests_server [options] [-- --] Options: - --help Display this menu and exit. - --config Pass in a config - --esFrom Build Elasticsearch from source or run from snapshot. Default: snapshot - --kibana-install-dir Run Kibana from existing install directory instead of from source. - --verbose Log everything. - --debug Run in debug mode. - --quiet Only log errors. - --silent Log nothing." + --help Display this menu and exit. + --config Pass in a config + --esFrom Build Elasticsearch from source, snapshot or path to existing install dir. Default: snapshot + --kibana-install-dir Run Kibana from existing install directory instead of from source. + --verbose Log everything. + --debug Run in debug mode. + --quiet Only log errors. + --silent Log nothing." `; exports[`process options for start servers CLI accepts debug option 1`] = ` @@ -26,6 +26,7 @@ Object { ], "createLogger": [Function], "debug": true, + "esFrom": "snapshot", "extraKbnOpts": undefined, } `; @@ -36,6 +37,7 @@ Object { "foo", ], "createLogger": [Function], + "esFrom": "snapshot", "extraKbnOpts": undefined, } `; @@ -49,6 +51,7 @@ Object { "foo", ], "createLogger": [Function], + "esFrom": "snapshot", "extraKbnOpts": Object { "server.foo": "bar", }, @@ -61,6 +64,7 @@ Object { "foo", ], "createLogger": [Function], + "esFrom": "snapshot", "extraKbnOpts": undefined, "quiet": true, } @@ -72,6 +76,7 @@ Object { "foo", ], "createLogger": [Function], + "esFrom": "snapshot", "extraKbnOpts": undefined, "silent": true, } @@ -94,6 +99,7 @@ Object { "foo", ], "createLogger": [Function], + "esFrom": "snapshot", "extraKbnOpts": undefined, "installDir": "foo", } @@ -105,6 +111,7 @@ Object { "foo", ], "createLogger": [Function], + "esFrom": "snapshot", "extraKbnOpts": undefined, "verbose": true, } diff --git a/packages/kbn-test/src/functional_tests/cli/start_servers/__snapshots__/cli.test.js.snap b/packages/kbn-test/src/functional_tests/cli/start_servers/__snapshots__/cli.test.js.snap index 8aa6f0787f02b..b54bf5dc84dd1 100644 --- a/packages/kbn-test/src/functional_tests/cli/start_servers/__snapshots__/cli.test.js.snap +++ b/packages/kbn-test/src/functional_tests/cli/start_servers/__snapshots__/cli.test.js.snap @@ -40,11 +40,4 @@ exports[`start servers CLI options rejects invalid options even if valid options functional_tests_server: invalid option [grep] ...stack trace... " -`; - -exports[`start servers CLI options rejects non-enum value for esFrom 1`] = ` -" -functional_tests_server: invalid argument [butter] to option [esFrom] - ...stack trace... -" -`; +`; \ No newline at end of file diff --git a/packages/kbn-test/src/functional_tests/cli/start_servers/args.js b/packages/kbn-test/src/functional_tests/cli/start_servers/args.js index ca62aff2649f8..170de1942232b 100644 --- a/packages/kbn-test/src/functional_tests/cli/start_servers/args.js +++ b/packages/kbn-test/src/functional_tests/cli/start_servers/args.js @@ -27,9 +27,8 @@ const options = { desc: 'Pass in a config', }, esFrom: { - arg: '', - choices: ['snapshot', 'source'], - desc: 'Build Elasticsearch from source or run from snapshot.', + arg: '', + desc: 'Build Elasticsearch from source, snapshot or path to existing install dir.', default: 'snapshot', }, 'kibana-install-dir': { @@ -54,7 +53,7 @@ export function displayHelp() { }; }) .map(option => { - return `--${option.usage.padEnd(28)} ${option.desc} ${option.default}`; + return `--${option.usage.padEnd(30)} ${option.desc} ${option.default}`; }) .join(`\n `); @@ -80,6 +79,10 @@ export function processOptions(userOptions, defaultConfigPath) { throw new Error(`functional_tests_server: config is required`); } + if (!userOptions.esFrom) { + userOptions.esFrom = 'snapshot'; + } + if (userOptions['kibana-install-dir']) { userOptions.installDir = userOptions['kibana-install-dir']; delete userOptions['kibana-install-dir']; diff --git a/packages/kbn-test/src/functional_tests/cli/start_servers/args.test.js b/packages/kbn-test/src/functional_tests/cli/start_servers/args.test.js index b85113b26ab8b..22c06b6ae3231 100644 --- a/packages/kbn-test/src/functional_tests/cli/start_servers/args.test.js +++ b/packages/kbn-test/src/functional_tests/cli/start_servers/args.test.js @@ -65,12 +65,6 @@ describe('process options for start servers CLI', () => { expect(options).toMatchSnapshot(); }); - it('rejects non-enum value for esFrom', () => { - expect(() => { - processOptions({ esFrom: 'butter' }, ['foo']); - }).toThrow('functional_tests_server: invalid argument [butter] to option [esFrom]'); - }); - it('accepts debug option', () => { const options = processOptions({ debug: true }, ['foo']); expect(options).toMatchSnapshot(); diff --git a/packages/kbn-test/src/functional_tests/cli/start_servers/cli.test.js b/packages/kbn-test/src/functional_tests/cli/start_servers/cli.test.js index f9b5e81ef63a2..43bab5a4afe89 100644 --- a/packages/kbn-test/src/functional_tests/cli/start_servers/cli.test.js +++ b/packages/kbn-test/src/functional_tests/cli/start_servers/cli.test.js @@ -126,15 +126,6 @@ describe('start servers CLI', () => { expect(exitMock).not.toHaveBeenCalled(); }); - it('rejects non-enum value for esFrom', async () => { - global.process.argv.push('--esFrom', 'butter'); - - await startServersCli('foo'); - - expect(exitMock).toHaveBeenCalledWith(1); - checkMockConsoleLogSnapshot(logMock); - }); - it('accepts debug option', async () => { global.process.argv.push('--debug'); diff --git a/src/core/public/fatal_errors/fatal_errors_service.tsx b/src/core/public/fatal_errors/fatal_errors_service.tsx index 3a7e821a368a6..942d05c41a51c 100644 --- a/src/core/public/fatal_errors/fatal_errors_service.tsx +++ b/src/core/public/fatal_errors/fatal_errors_service.tsx @@ -36,12 +36,17 @@ export class FatalErrorsService { private readonly errorInfo$ = new Rx.ReplaySubject(); constructor(private params: FatalErrorsParams) { - this.errorInfo$.pipe(first(), tap(() => this.onFirstError())).subscribe({ - error: error => { - // tslint:disable-next-line no-console - console.error('Uncaught error in fatal error screen internals', error); - }, - }); + this.errorInfo$ + .pipe( + first(), + tap(() => this.onFirstError()) + ) + .subscribe({ + error: error => { + // tslint:disable-next-line no-console + console.error('Uncaught error in fatal error screen internals', error); + }, + }); } public add = (error: Error | string, source?: string) => { diff --git a/src/core/server/config/config_service.ts b/src/core/server/config/config_service.ts index a3314d5657141..a087c6fa3e4b1 100644 --- a/src/core/server/config/config_service.ts +++ b/src/core/server/config/config_service.ts @@ -146,7 +146,10 @@ export class ConfigService { private getDistinctConfig(path: ConfigPath) { this.markAsHandled(path); - return this.config$.pipe(map(config => config.get(path)), distinctUntilChanged(isEqual)); + return this.config$.pipe( + map(config => config.get(path)), + distinctUntilChanged(isEqual) + ); } private markAsHandled(path: ConfigPath) { diff --git a/src/core/server/legacy_compat/logging/legacy_logging_server.test.ts b/src/core/server/legacy_compat/logging/legacy_logging_server.test.ts new file mode 100644 index 0000000000000..ab74c250abb4d --- /dev/null +++ b/src/core/server/legacy_compat/logging/legacy_logging_server.test.ts @@ -0,0 +1,99 @@ +/* + * 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. + */ + +jest.mock('../../../../server/config'); +jest.mock('../../../../server/logging'); + +import { LogLevel } from '../../logging/log_level'; +import { LegacyLoggingServer } from './legacy_logging_server'; + +test('correctly forwards log records.', () => { + const loggingServer = new LegacyLoggingServer({ events: {} }); + const onLogMock = jest.fn(); + loggingServer.on('log', onLogMock); + + const timestamp = 1554433221100; + const firstLogRecord = { + timestamp: new Date(timestamp), + level: LogLevel.Info, + context: 'some-context', + message: 'some-message', + }; + + const secondLogRecord = { + timestamp: new Date(timestamp), + level: LogLevel.Error, + context: 'some-context.sub-context', + message: 'some-message', + meta: { unknown: 2 }, + error: new Error('some-error'), + }; + + const thirdLogRecord = { + timestamp: new Date(timestamp), + level: LogLevel.Trace, + context: 'some-context.sub-context', + message: 'some-message', + meta: { tags: ['important', 'tags'] }, + }; + + loggingServer.log(firstLogRecord); + loggingServer.log(secondLogRecord); + loggingServer.log(thirdLogRecord); + + expect(onLogMock).toHaveBeenCalledTimes(3); + + const [[firstCall], [secondCall], [thirdCall]] = onLogMock.mock.calls; + expect(firstCall).toMatchInlineSnapshot(` +Object { + "data": "some-message", + "tags": Array [ + "info", + "some-context", + ], + "timestamp": 1554433221100, +} +`); + + expect(secondCall).toMatchInlineSnapshot(` +Object { + "data": [Error: some-error], + "tags": Array [ + "error", + "some-context", + "sub-context", + ], + "timestamp": 1554433221100, +} +`); + + expect(thirdCall).toMatchInlineSnapshot(` +Object { + "data": "some-message", + "tags": Array [ + "trace", + "some-context", + "sub-context", + "important", + "tags", + ], + "timestamp": 1554433221100, +} +`); +}); diff --git a/src/core/server/legacy_compat/logging/legacy_logging_server.ts b/src/core/server/legacy_compat/logging/legacy_logging_server.ts index 23906cc420abc..5a31fb366a5ed 100644 --- a/src/core/server/legacy_compat/logging/legacy_logging_server.ts +++ b/src/core/server/legacy_compat/logging/legacy_logging_server.ts @@ -72,7 +72,7 @@ export class LegacyLoggingServer extends EventEmitter { this.emit('log', { data: error || message, tags: [level.id.toLowerCase(), ...context.split('.'), ...(meta.tags || [])], - timestamp: timestamp.getMilliseconds(), + timestamp: timestamp.getTime(), }); } diff --git a/src/core_plugins/console/public/src/sense_editor/mode/input_highlight_rules.js b/src/core_plugins/console/public/src/sense_editor/mode/input_highlight_rules.js index 2cac57df4cd43..9ef1a8f31ac72 100644 --- a/src/core_plugins/console/public/src/sense_editor/mode/input_highlight_rules.js +++ b/src/core_plugins/console/public/src/sense_editor/mode/input_highlight_rules.js @@ -47,7 +47,7 @@ export function InputHighlightRules() { { token: 'paren.lparen', regex: '{', next: 'json', push: true } ], addEOL(['method'], /([a-zA-Z]+)/, 'start', 'method_sep') - , + , [ { token: 'whitespace', diff --git a/src/core_plugins/kibana/public/discover/controllers/discover.js b/src/core_plugins/kibana/public/discover/controllers/discover.js index 62b87e1c52c20..14ffacf8773d5 100644 --- a/src/core_plugins/kibana/public/discover/controllers/discover.js +++ b/src/core_plugins/kibana/public/discover/controllers/discover.js @@ -460,45 +460,45 @@ function discoverController( 'rows', 'fetchStatus' ], (function updateResultState() { - let prev = {}; - const status = { - LOADING: 'loading', // initial data load - READY: 'ready', // results came back - NO_RESULTS: 'none' // no results came back - }; - - function pick(rows, oldRows, fetchStatus) { - // initial state, pretend we are loading - if (rows == null && oldRows == null) return status.LOADING; - - const rowsEmpty = _.isEmpty(rows); - // An undefined fetchStatus means the requests are still being - // prepared to be sent. When all requests are completed, - // fetchStatus is set to null, so it's important that we - // specifically check for undefined to determine a loading status. - const preparingForFetch = _.isUndefined(fetchStatus); - if (preparingForFetch) return status.LOADING; - else if (rowsEmpty && fetchStatus) return status.LOADING; - else if (!rowsEmpty) return status.READY; - else return status.NO_RESULTS; - } + let prev = {}; + const status = { + LOADING: 'loading', // initial data load + READY: 'ready', // results came back + NO_RESULTS: 'none' // no results came back + }; + + function pick(rows, oldRows, fetchStatus) { + // initial state, pretend we are loading + if (rows == null && oldRows == null) return status.LOADING; + + const rowsEmpty = _.isEmpty(rows); + // An undefined fetchStatus means the requests are still being + // prepared to be sent. When all requests are completed, + // fetchStatus is set to null, so it's important that we + // specifically check for undefined to determine a loading status. + const preparingForFetch = _.isUndefined(fetchStatus); + if (preparingForFetch) return status.LOADING; + else if (rowsEmpty && fetchStatus) return status.LOADING; + else if (!rowsEmpty) return status.READY; + else return status.NO_RESULTS; + } - return function () { - const current = { - rows: $scope.rows, - fetchStatus: $scope.fetchStatus - }; + return function () { + const current = { + rows: $scope.rows, + fetchStatus: $scope.fetchStatus + }; - $scope.resultState = pick( - current.rows, - prev.rows, - current.fetchStatus, - prev.fetchStatus - ); + $scope.resultState = pick( + current.rows, + prev.rows, + current.fetchStatus, + prev.fetchStatus + ); - prev = current; - }; - }())); + prev = current; + }; + }())); if ($scope.opts.timefield) { setupVisualization(); diff --git a/src/core_plugins/metric_vis/public/metric_vis.js b/src/core_plugins/metric_vis/public/metric_vis.js index 167a9b55f9e06..a8869e1a27d3b 100644 --- a/src/core_plugins/metric_vis/public/metric_vis.js +++ b/src/core_plugins/metric_vis/public/metric_vis.js @@ -32,16 +32,16 @@ import { MetricVisComponent } from './metric_vis_controller'; // register the provider with the visTypes registry VisTypesRegistryProvider.register(MetricVisProvider); -function MetricVisProvider(Private) { +function MetricVisProvider(Private, i18n) { const VisFactory = Private(VisFactoryProvider); // return the visType object, which kibana will use to display and configure new // Vis object of this type. return VisFactory.createReactVisualization({ name: 'metric', - title: 'Metric', + title: i18n('metricVis.metricTitle', { defaultMessage: 'Metric' }), icon: 'visMetric', - description: 'Display a calculation as a single number', + description: i18n('metricVis.metricDescription', { defaultMessage: 'Display a calculation as a single number' }), category: CATEGORY.DATA, visConfig: { component: MetricVisComponent, @@ -73,7 +73,20 @@ function MetricVisProvider(Private) { }, editorConfig: { collections: { - metricColorMode: ['None', 'Labels', 'Background'], + metricColorMode: [ + { + id: 'None', + label: i18n('metricVis.colorModes.noneOptionLabel', { defaultMessage: 'None' }) + }, + { + id: 'Labels', + label: i18n('metricVis.colorModes.labelsOptionLabel', { defaultMessage: 'Labels' }) + }, + { + id: 'Background', + label: i18n('metricVis.colorModes.backgroundOptionLabel', { defaultMessage: 'Background' }) + } + ], colorSchemas: Object.keys(vislibColorMaps), }, optionsTemplate: '', @@ -81,7 +94,7 @@ function MetricVisProvider(Private) { { group: 'metrics', name: 'metric', - title: 'Metric', + title: i18n('metricVis.schemas.metricTitle', { defaultMessage: 'Metric' }), min: 1, aggFilter: [ '!std_dev', '!geo_centroid', @@ -92,7 +105,7 @@ function MetricVisProvider(Private) { }, { group: 'buckets', name: 'group', - title: 'Split Group', + title: i18n('metricVis.schemas.splitGroupTitle', { defaultMessage: 'Split Group' }), min: 0, max: 1, aggFilter: ['!geohash_grid', '!filter'] diff --git a/src/core_plugins/metric_vis/public/metric_vis_params.html b/src/core_plugins/metric_vis/public/metric_vis_params.html index 84db2d91e23f9..1edae37ff7e89 100644 --- a/src/core_plugins/metric_vis/public/metric_vis_params.html +++ b/src/core_plugins/metric_vis/public/metric_vis_params.html @@ -1,8 +1,12 @@
-