From e7c28fda290cd956409b12eb3aecdad5497f9df8 Mon Sep 17 00:00:00 2001 From: Brandon Kobel Date: Wed, 23 Jan 2019 05:55:27 -0800 Subject: [PATCH 01/29] throw config error based on the joi validation error (#29137) --- src/server/config/config.js | 5 ++++- src/server/config/config.test.js | 8 ++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/server/config/config.js b/src/server/config/config.js index b5b89ec579184..5587794c74f8a 100644 --- a/src/server/config/config.js +++ b/src/server/config/config.js @@ -124,7 +124,10 @@ export class Config { }); if (results.error) { - throw results.error; + const error = new Error(results.error.message); + error.name = results.error.name; + error.stack = results.error.stack; + throw error; } this[vals] = results.value; diff --git a/src/server/config/config.test.js b/src/server/config/config.test.js index 1887548cf7275..3b64f943b85f6 100644 --- a/src/server/config/config.test.js +++ b/src/server/config/config.test.js @@ -174,7 +174,7 @@ describe('lib/config/config', function () { }); it('should thow an exception when setting a value with the wrong type', function (done) { - expect.assertions(2); + expect.assertions(4); const run = function () { config.set('test.enable', 'something'); @@ -184,7 +184,11 @@ describe('lib/config/config', function () { run(); } catch (err) { expect(err).toHaveProperty('name', 'ValidationError'); - expect(err.details[0].message).toBe('"enable" must be a boolean'); + expect(err).toHaveProperty('message', + 'child \"test\" fails because [child \"enable\" fails because [\"enable\" must be a boolean]]' + ); + expect(err).not.toHaveProperty('details'); + expect(err).not.toHaveProperty('_object'); } done(); From ece86f60023746700b58b5d60e6a2577dee7525c Mon Sep 17 00:00:00 2001 From: Brandon Kobel Date: Wed, 23 Jan 2019 06:25:31 -0800 Subject: [PATCH 02/29] Switch implicit server.log behavior with tmpl to logWithMetadata (#29002) * Changing the optimizer's use to logWithMetadata * Switching ensureEsVersion to logWithMetadata * Changing pid logging to use logWithMetadata * Changing server/plugins to use logWithMetadata * Changing saved objects onBeforeWrite to logWithMetata * Changing server/status to server.logWithMetadata * Changing ui settings to use logWithMetadata * Removing _.template's usage from within log_format * Fixing initializing plugin log message * Fixing ensureEsVersion tests * Fixing health check tests * Fixing a few more forgotten tests --- .../lib/__tests__/ensure_es_version.js | 35 ++++++++++--------- .../lib/__tests__/health_check.js | 2 +- .../elasticsearch/lib/ensure_es_version.js | 17 +++++---- src/optimize/base_optimizer.js | 4 +-- .../dynamic_dll_plugin/dll_compiler.js | 10 +++--- .../dynamic_dll_plugin/dynamic_dll_plugin.js | 12 +++---- src/optimize/index.js | 2 +- src/optimize/watch/optmzr_role.js | 6 ++-- src/optimize/watch/watch_cache.ts | 10 +++--- src/optimize/watch/watch_optimizer.js | 11 +++--- src/server/logging/log_format.js | 5 --- src/server/pid/index.js | 11 +++--- src/server/plugins/lib/plugin.js | 3 +- src/server/plugins/scan_mixin.js | 12 +++---- .../service/create_saved_objects_service.js | 25 +++++++------ src/server/status/server_status.test.js | 2 +- src/server/status/status.js | 16 +++++---- src/server/status/status.test.js | 2 +- .../create_or_upgrade_integration.js | 10 +++--- .../create_or_upgrade_saved_config.js | 18 +++++----- .../create_or_upgrade_saved_config.js | 5 ++- src/ui/ui_settings/ui_settings_service.js | 10 +++--- .../ui_settings_service_factory.js | 4 +-- 23 files changed, 112 insertions(+), 120 deletions(-) diff --git a/src/legacy/core_plugins/elasticsearch/lib/__tests__/ensure_es_version.js b/src/legacy/core_plugins/elasticsearch/lib/__tests__/ensure_es_version.js index 07a4c5373d17f..24df2f9c5f893 100644 --- a/src/legacy/core_plugins/elasticsearch/lib/__tests__/ensure_es_version.js +++ b/src/legacy/core_plugins/elasticsearch/lib/__tests__/ensure_es_version.js @@ -34,6 +34,7 @@ describe('plugins/elasticsearch', () => { beforeEach(function () { server = { log: sinon.stub(), + logWithMetadata: sinon.stub(), plugins: { elasticsearch: { getCluster: sinon.stub().withArgs('admin').returns({ callWithInternalUser: sinon.stub() }), @@ -120,17 +121,17 @@ describe('plugins/elasticsearch', () => { it('warns if a node is only off by a patch version', async () => { setNodes('5.1.1'); await ensureEsVersion(server, KIBANA_VERSION); - sinon.assert.callCount(server.log, 2); - expect(server.log.getCall(0).args[0]).to.contain('debug'); - expect(server.log.getCall(1).args[0]).to.contain('warning'); + sinon.assert.callCount(server.logWithMetadata, 2); + expect(server.logWithMetadata.getCall(0).args[0]).to.contain('debug'); + expect(server.logWithMetadata.getCall(1).args[0]).to.contain('warning'); }); it('warns if a node is off by a patch version and without http publish address', async () => { setNodeWithoutHTTP('5.1.1'); await ensureEsVersion(server, KIBANA_VERSION); - sinon.assert.callCount(server.log, 2); - expect(server.log.getCall(0).args[0]).to.contain('debug'); - expect(server.log.getCall(1).args[0]).to.contain('warning'); + sinon.assert.callCount(server.logWithMetadata, 2); + expect(server.logWithMetadata.getCall(0).args[0]).to.contain('debug'); + expect(server.logWithMetadata.getCall(1).args[0]).to.contain('warning'); }); it('errors if a node incompatible and without http publish address', async () => { @@ -147,28 +148,28 @@ describe('plugins/elasticsearch', () => { setNodes('5.1.1'); await ensureEsVersion(server, KIBANA_VERSION); - sinon.assert.callCount(server.log, 2); - expect(server.log.getCall(0).args[0]).to.contain('debug'); - expect(server.log.getCall(1).args[0]).to.contain('warning'); + sinon.assert.callCount(server.logWithMetadata, 2); + expect(server.logWithMetadata.getCall(0).args[0]).to.contain('debug'); + expect(server.logWithMetadata.getCall(1).args[0]).to.contain('warning'); await ensureEsVersion(server, KIBANA_VERSION); - sinon.assert.callCount(server.log, 3); - expect(server.log.getCall(2).args[0]).to.contain('debug'); + sinon.assert.callCount(server.logWithMetadata, 3); + expect(server.logWithMetadata.getCall(2).args[0]).to.contain('debug'); }); it('warns again if the node list changes', async () => { setNodes('5.1.1'); await ensureEsVersion(server, KIBANA_VERSION); - sinon.assert.callCount(server.log, 2); - expect(server.log.getCall(0).args[0]).to.contain('debug'); - expect(server.log.getCall(1).args[0]).to.contain('warning'); + sinon.assert.callCount(server.logWithMetadata, 2); + expect(server.logWithMetadata.getCall(0).args[0]).to.contain('debug'); + expect(server.logWithMetadata.getCall(1).args[0]).to.contain('warning'); setNodes('5.1.2'); await ensureEsVersion(server, KIBANA_VERSION); - sinon.assert.callCount(server.log, 4); - expect(server.log.getCall(2).args[0]).to.contain('debug'); - expect(server.log.getCall(3).args[0]).to.contain('warning'); + sinon.assert.callCount(server.logWithMetadata, 4); + expect(server.logWithMetadata.getCall(2).args[0]).to.contain('debug'); + expect(server.logWithMetadata.getCall(3).args[0]).to.contain('warning'); }); }); }); diff --git a/src/legacy/core_plugins/elasticsearch/lib/__tests__/health_check.js b/src/legacy/core_plugins/elasticsearch/lib/__tests__/health_check.js index 0f736e61b76be..1a334083fb7b5 100644 --- a/src/legacy/core_plugins/elasticsearch/lib/__tests__/health_check.js +++ b/src/legacy/core_plugins/elasticsearch/lib/__tests__/health_check.js @@ -85,7 +85,7 @@ describe('plugins/elasticsearch', () => { // Setup the server mock server = { - log: sinon.stub(), + logWithMetadata: sinon.stub(), info: { port: 5601 }, config: function () { return { get, set }; }, plugins: { diff --git a/src/legacy/core_plugins/elasticsearch/lib/ensure_es_version.js b/src/legacy/core_plugins/elasticsearch/lib/ensure_es_version.js index 85ad2adfab5b9..5c34bd073500b 100644 --- a/src/legacy/core_plugins/elasticsearch/lib/ensure_es_version.js +++ b/src/legacy/core_plugins/elasticsearch/lib/ensure_es_version.js @@ -40,7 +40,7 @@ export function ensureEsVersion(server, kibanaVersion) { const { callWithInternalUser } = server.plugins.elasticsearch.getCluster('admin'); const isProd = server.config().get('env.prod'); - server.log(['plugin', 'debug'], 'Checking Elasticsearch version'); + server.logWithMetadata(['plugin', 'debug'], 'Checking Elasticsearch version'); return callWithInternalUser('nodes.info', { filterPath: [ 'nodes.*.version', @@ -92,15 +92,14 @@ export function ensureEsVersion(server, kibanaVersion) { const warningNodeNames = getHumanizedNodeNames(simplifiedNodes).join(', '); if (lastWarnedNodesForServer.get(server) !== warningNodeNames) { lastWarnedNodesForServer.set(server, warningNodeNames); - server.log(['warning'], { - tmpl: ( - `You're running Kibana ${kibanaVersion} with some different versions of ` + + server.logWithMetadata(['warning'], + `You're running Kibana ${kibanaVersion} with some different versions of ` + 'Elasticsearch. Update Kibana or Elasticsearch to the same ' + - `version to prevent compatibility issues: ${warningNodeNames}` - ), - kibanaVersion, - nodes: simplifiedNodes, - }); + `version to prevent compatibility issues: ${warningNodeNames}`, + { + kibanaVersion, + nodes: simplifiedNodes, + }); } } diff --git a/src/optimize/base_optimizer.js b/src/optimize/base_optimizer.js index 21f41e342bf9c..ea6ef1e5fe29c 100644 --- a/src/optimize/base_optimizer.js +++ b/src/optimize/base_optimizer.js @@ -46,7 +46,7 @@ const STATS_WARNINGS_FILTER = new RegExp([ export default class BaseOptimizer { constructor(opts) { - this.log = opts.log || (() => null); + this.logWithMetadata = opts.logWithMetadata || (() => null); this.uiBundles = opts.uiBundles; this.profile = opts.profile || false; @@ -270,7 +270,7 @@ export default class BaseOptimizer { new DynamicDllPlugin({ uiBundles: this.uiBundles, threadLoaderPoolConfig: this.getThreadLoaderPoolConfig(), - log: this.log + logWithMetadata: this.logWithMetadata }), new MiniCssExtractPlugin({ diff --git a/src/optimize/dynamic_dll_plugin/dll_compiler.js b/src/optimize/dynamic_dll_plugin/dll_compiler.js index 26065c90d345a..5853dcf86dc81 100644 --- a/src/optimize/dynamic_dll_plugin/dll_compiler.js +++ b/src/optimize/dynamic_dll_plugin/dll_compiler.js @@ -51,13 +51,13 @@ export class DllCompiler { }; } - constructor(uiBundles, threadLoaderPoolConfig, log) { + constructor(uiBundles, threadLoaderPoolConfig, logWithMetadata) { this.rawDllConfig = DllCompiler.getRawDllConfig( uiBundles, uiBundles.getCacheDirectory('babel'), threadLoaderPoolConfig ); - this.log = log || (() => null); + this.logWithMetadata = logWithMetadata || (() => null); } async init() { @@ -182,7 +182,7 @@ export class DllCompiler { async runWebpack(config) { return new Promise((resolve, reject) => { - this.log(['info', 'optimize:dynamic_dll_plugin'], 'Client vendors dll compilation started'); + this.logWithMetadata(['info', 'optimize:dynamic_dll_plugin'], 'Client vendors dll compilation started'); webpack(config, (err, stats) => { // If a critical error occurs or we have @@ -197,7 +197,7 @@ export class DllCompiler { })); if (webpackErrors) { - this.log( + this.logWithMetadata( ['fatal', 'optimize:dynamic_dll_plugin'], `Client vendors dll compilation failed` ); @@ -205,7 +205,7 @@ export class DllCompiler { } // Otherwise let it proceed - this.log( + this.logWithMetadata( ['info', 'optimize:dynamic_dll_plugin'], `Client vendors dll compilation finished with success` ); diff --git a/src/optimize/dynamic_dll_plugin/dynamic_dll_plugin.js b/src/optimize/dynamic_dll_plugin/dynamic_dll_plugin.js index c1d20606a49a3..480905fb234c0 100644 --- a/src/optimize/dynamic_dll_plugin/dynamic_dll_plugin.js +++ b/src/optimize/dynamic_dll_plugin/dynamic_dll_plugin.js @@ -40,9 +40,9 @@ function inPluginNodeModules(checkPath) { } export class DynamicDllPlugin { - constructor({ uiBundles, threadLoaderPoolConfig, log, maxCompilations = 1 }) { - this.log = log || (() => null); - this.dllCompiler = new DllCompiler(uiBundles, threadLoaderPoolConfig, log); + constructor({ uiBundles, threadLoaderPoolConfig, logWithMetadata, maxCompilations = 1 }) { + this.logWithMetadata = logWithMetadata || (() => null); + this.dllCompiler = new DllCompiler(uiBundles, threadLoaderPoolConfig, logWithMetadata); this.entryPaths = ''; this.afterCompilationEntryPaths = ''; this.maxCompilations = maxCompilations; @@ -92,7 +92,7 @@ export class DynamicDllPlugin { } registerTasksHooks(compiler) { - this.log(['info', 'optimize:dynamic_dll_plugin'], 'Started dynamic dll plugin tasks'); + this.logWithMetadata(['info', 'optimize:dynamic_dll_plugin'], 'Started dynamic dll plugin tasks'); this.registerBeforeCompileHook(compiler); this.registerCompilationHook(compiler); this.registerDoneHook(compiler); @@ -231,7 +231,7 @@ export class DynamicDllPlugin { // Only run this info log in the first performed dll compilation // per each execution run if (this.performedCompilations === 0) { - this.log( + this.logWithMetadata( ['info', 'optimize:dynamic_dll_plugin'], compilation.needsDLLCompilation ? 'Need to compile the client vendors dll' @@ -269,7 +269,7 @@ export class DynamicDllPlugin { if (this.forceDLLCreationFlag) { this.forceDLLCreationFlag = false; } - this.log(['info', 'optimize:dynamic_dll_plugin'], 'Finished all dynamic dll plugin tasks'); + this.logWithMetadata(['info', 'optimize:dynamic_dll_plugin'], 'Finished all dynamic dll plugin tasks'); }); } diff --git a/src/optimize/index.js b/src/optimize/index.js index b6ba806573e52..2820fe1a76457 100644 --- a/src/optimize/index.js +++ b/src/optimize/index.js @@ -62,7 +62,7 @@ export default async (kbnServer, server, config) => { // only require the FsOptimizer when we need to const optimizer = new FsOptimizer({ - log: (tags, data) => server.log(tags, data), + logWithMetadata: (tags, message, metadata) => server.logWithMetadata(tags, message, metadata), uiBundles, profile: config.get('optimize.profile'), sourceMaps: config.get('optimize.sourceMaps'), diff --git a/src/optimize/watch/optmzr_role.js b/src/optimize/watch/optmzr_role.js index 6c45774f4cdbc..d6b12f8c944b6 100644 --- a/src/optimize/watch/optmzr_role.js +++ b/src/optimize/watch/optmzr_role.js @@ -25,16 +25,16 @@ import { DllCompiler } from '../dynamic_dll_plugin'; import { WatchCache } from './watch_cache'; export default async (kbnServer, kibanaHapiServer, config) => { - const log = (tags, data) => kibanaHapiServer.log(tags, data); + const logWithMetadata = (tags, message, metadata) => kibanaHapiServer.logWithMetadata(tags, message, metadata); const watchOptimizer = new WatchOptimizer({ - log, + logWithMetadata, uiBundles: kbnServer.uiBundles, profile: config.get('optimize.profile'), sourceMaps: config.get('optimize.sourceMaps'), prebuild: config.get('optimize.watchPrebuild'), watchCache: new WatchCache({ - log, + logWithMetadata, outputPath: config.get('path.data'), dllsPath: DllCompiler.getRawDllConfig().outputPath, cachePath: resolve(kbnServer.uiBundles.getCacheDirectory(), '../'), diff --git a/src/optimize/watch/watch_cache.ts b/src/optimize/watch/watch_cache.ts index f744900c21e8c..5b594b30e9f8f 100644 --- a/src/optimize/watch/watch_cache.ts +++ b/src/optimize/watch/watch_cache.ts @@ -31,7 +31,7 @@ const readAsync = promisify(readFile); const writeAsync = promisify(writeFile); interface Params { - log: (tags: string[], data: string) => void; + logWithMetadata: (tags: string[], message: string, metadata?: { [key: string]: any }) => void; outputPath: string; dllsPath: string; cachePath: string; @@ -43,7 +43,7 @@ interface WatchCacheStateContent { } export class WatchCache { - private readonly log: Params['log']; + private readonly logWithMetadata: Params['logWithMetadata']; private readonly outputPath: Params['outputPath']; private readonly dllsPath: Params['dllsPath']; private readonly cachePath: Params['cachePath']; @@ -53,7 +53,7 @@ export class WatchCache { private isInitialized: boolean; constructor(params: Params) { - this.log = params.log; + this.logWithMetadata = params.logWithMetadata; this.outputPath = params.outputPath; this.dllsPath = params.dllsPath; this.cachePath = params.cachePath; @@ -87,7 +87,7 @@ export class WatchCache { } public async reset() { - this.log(['info', 'optimize:watch_cache'], 'The optimizer watch cache will reset'); + this.logWithMetadata(['info', 'optimize:watch_cache'], 'The optimizer watch cache will reset'); // start by deleting the state file to lower the // amount of time that another process might be able to @@ -116,7 +116,7 @@ export class WatchCache { // re-write new cache state file await this.write(); - this.log(['info', 'optimize:watch_cache'], 'The optimizer watch cache has reset'); + this.logWithMetadata(['info', 'optimize:watch_cache'], 'The optimizer watch cache has reset'); } private async buildShaWithMultipleFiles(filePaths: string[]) { diff --git a/src/optimize/watch/watch_optimizer.js b/src/optimize/watch/watch_optimizer.js index 82e77f8bc22d3..93e467740a6c6 100644 --- a/src/optimize/watch/watch_optimizer.js +++ b/src/optimize/watch/watch_optimizer.js @@ -156,16 +156,14 @@ export default class WatchOptimizer extends BaseOptimizer { switch (type) { case STATUS.RUNNING: if (!this.initialBuildComplete) { - this.log(['info', 'optimize'], { - tmpl: 'Optimization started', + this.logWithMetadata(['info', 'optimize'], `Optimization started`, { bundles: this.uiBundles.getIds() }); } break; case STATUS.SUCCESS: - this.log(['info', 'optimize'], { - tmpl: 'Optimization <%= status %> in <%= seconds %> seconds', + this.logWithMetadata(['info', 'optimize'], `Optimization success in ${seconds} seconds`, { bundles: this.uiBundles.getIds(), status: 'success', seconds @@ -176,8 +174,7 @@ export default class WatchOptimizer extends BaseOptimizer { // errors during initialization to the server, unlike the rest of the // errors produced here. Lets not muddy the console with extra errors if (!this.initializing) { - this.log(['fatal', 'optimize'], { - tmpl: 'Optimization <%= status %> in <%= seconds %> seconds<%= err %>', + this.logWithMetadata(['fatal', 'optimize'], `Optimization failed in ${seconds} seconds${error}`, { bundles: this.uiBundles.getIds(), status: 'failed', seconds, @@ -187,7 +184,7 @@ export default class WatchOptimizer extends BaseOptimizer { break; case STATUS.FATAL: - this.log('fatal', error); + this.logWithMetadata('fatal', error); process.exit(1); break; } diff --git a/src/server/logging/log_format.js b/src/server/logging/log_format.js index ab7fb8264c9d5..8caae11e2e499 100644 --- a/src/server/logging/log_format.js +++ b/src/server/logging/log_format.js @@ -162,11 +162,6 @@ export default class TransformObjStream extends Stream.Transform { else if (logWithMetadata.isLogEvent(event.data)) { _.assign(data, logWithMetadata.getLogEventData(event.data)); } - else if (_.isPlainObject(event.data) && event.data.tmpl) { - _.assign(data, event.data); - data.tmpl = undefined; - data.message = _.template(event.data.tmpl)(event.data); - } else { data.message = _.isString(event.data) ? event.data : inspect(event.data); } diff --git a/src/server/pid/index.js b/src/server/pid/index.js index 30592c525390c..cc53b8bd97f3d 100644 --- a/src/server/pid/index.js +++ b/src/server/pid/index.js @@ -33,24 +33,23 @@ export default Promise.method(function (kbnServer, server, config) { .catch(function (err) { if (err.code !== 'EEXIST') throw err; - const log = { - tmpl: 'pid file already exists at <%= path %>', + const message = `pid file already exists at ${path}`; + const metadata = { path: path, pid: pid }; if (config.get('pid.exclusive')) { - throw Boom.internal(_.template(log.tmpl)(log), log); + throw Boom.internal(message, { message, ...metadata }); } else { - server.log(['pid', 'warning'], log); + server.log(['pid', 'warning'], message, metadata); } return writeFile(path, pid); }) .then(function () { - server.log(['pid', 'debug'], { - tmpl: 'wrote pid file to <%= path %>', + server.logWithMetadata(['pid', 'debug'], `wrote pid file to ${path}`, { path: path, pid: pid }); diff --git a/src/server/plugins/lib/plugin.js b/src/server/plugins/lib/plugin.js index 7399804c818fe..46dd047a657cc 100644 --- a/src/server/plugins/lib/plugin.js +++ b/src/server/plugins/lib/plugin.js @@ -66,8 +66,7 @@ export class Plugin { this._server = server; this._options = options; - server.log(['plugins', 'debug'], { - tmpl: 'Initializing plugin <%= plugin.toString() %>', + server.logWithMetadata(['plugins', 'debug'], `Initializing plugin ${this.toString()}`, { plugin: this }); diff --git a/src/server/plugins/scan_mixin.js b/src/server/plugins/scan_mixin.js index 8a25ad231593a..5e21207482e9d 100644 --- a/src/server/plugins/scan_mixin.js +++ b/src/server/plugins/scan_mixin.js @@ -38,17 +38,16 @@ export async function scanMixin(kbnServer, server, config) { const logging$ = Rx.merge( pack$.pipe( tap(definition => { - server.log(['plugin', 'debug'], { - tmpl: 'Found plugin at <%= path %>', - path: definition.getPath() + const path = definition.getPath(); + server.logWithMetadata(['plugin', 'debug'], `Found plugin at ${path}`, { + path }); }) ), invalidDirectoryError$.pipe( tap(error => { - server.log(['plugin', 'warning'], { - tmpl: '<%= err.code %>: Unable to scan directory for plugins "<%= dir %>"', + server.logWithMetadata(['plugin', 'warning'], `${error.code}: Unable to scan directory for plugins "${error.path}"`, { err: error, dir: error.path }); @@ -57,8 +56,7 @@ export async function scanMixin(kbnServer, server, config) { invalidPackError$.pipe( tap(error => { - server.log(['plugin', 'warning'], { - tmpl: 'Skipping non-plugin directory at <%= path %>', + server.logWithMetadata(['plugin', 'warning'], `Skipping non-plugin directory at ${error.path}`, { path: error.path }); }) diff --git a/src/server/saved_objects/service/create_saved_objects_service.js b/src/server/saved_objects/service/create_saved_objects_service.js index 7432c92d52f44..8b56daa1a3398 100644 --- a/src/server/saved_objects/service/create_saved_objects_service.js +++ b/src/server/saved_objects/service/create_saved_objects_service.js @@ -49,17 +49,20 @@ export function createSavedObjectsService(server, schema, serializer, migrator) }, }); } catch (error) { - server.log(['debug', 'savedObjects'], { - tmpl: 'Attempt to write indexTemplate for SavedObjects index failed: <%= err.message %>', - es: { - resp: error.body, - status: error.status, - }, - err: { - message: error.message, - stack: error.stack, - }, - }); + server.logWithMetadata( + ['debug', 'savedObjects'], + `Attempt to write indexTemplate for SavedObjects index failed: ${error.message}`, + { + es: { + resp: error.body, + status: error.status, + }, + err: { + message: error.message, + stack: error.stack, + }, + } + ); // We reject with `es.ServiceUnavailable` because writing an index // template is a very simple operation so if we get an error here diff --git a/src/server/status/server_status.test.js b/src/server/status/server_status.test.js index 78ed017755aeb..c6e6721c0f926 100644 --- a/src/server/status/server_status.test.js +++ b/src/server/status/server_status.test.js @@ -31,7 +31,7 @@ describe('ServerStatus class', function () { let serverStatus; beforeEach(function () { - server = { expose: sinon.stub(), log: sinon.stub() }; + server = { expose: sinon.stub(), logWithMetadata: sinon.stub() }; serverStatus = new ServerStatus(server); }); diff --git a/src/server/status/status.js b/src/server/status/status.js index 54924fc88b53b..4255eb3531b0a 100644 --- a/src/server/status/status.js +++ b/src/server/status/status.js @@ -42,13 +42,15 @@ export default class Status extends EventEmitter { this.state === 'red' ? 'error' : 'info' ]; - server.log(tags, { - tmpl: 'Status changed from <%= prevState %> to <%= state %><%= message ? " - " + message : "" %>', - state: this.state, - message: this.message, - prevState: previous, - prevMsg: previousMsg - }); + server.logWithMetadata(tags, + `Status changed from ${ previous } to ${this.state}${ this.message ? ' - ' + this.message : '' }`, + { + state: this.state, + message: this.message, + prevState: previous, + prevMsg: previousMsg + } + ); }); } diff --git a/src/server/status/status.test.js b/src/server/status/status.test.js index c6bc967ca0766..48fdaeedbe5af 100644 --- a/src/server/status/status.test.js +++ b/src/server/status/status.test.js @@ -27,7 +27,7 @@ describe('Status class', function () { let serverStatus; beforeEach(function () { - server = { expose: sinon.stub(), log: sinon.stub() }; + server = { expose: sinon.stub(), logWithMetadata: sinon.stub() }; serverStatus = new ServerStatus(server); }); diff --git a/src/ui/ui_settings/create_or_upgrade_saved_config/__tests__/create_or_upgrade_integration.js b/src/ui/ui_settings/create_or_upgrade_saved_config/__tests__/create_or_upgrade_integration.js index 1c8ade94456d0..b407f5b327c7b 100644 --- a/src/ui/ui_settings/create_or_upgrade_saved_config/__tests__/create_or_upgrade_integration.js +++ b/src/ui/ui_settings/create_or_upgrade_saved_config/__tests__/create_or_upgrade_integration.js @@ -78,7 +78,7 @@ describe('createOrUpgradeSavedConfig()', () => { savedObjectsClient, version: '5.4.0', buildNum: 54099, - log: sinon.stub(), + logWithMetadata: sinon.stub(), }); const config540 = await savedObjectsClient.get('config', '5.4.0'); @@ -104,7 +104,7 @@ describe('createOrUpgradeSavedConfig()', () => { savedObjectsClient, version: '5.4.1', buildNum: 54199, - log: sinon.stub(), + logWithMetadata: sinon.stub(), }); const config541 = await savedObjectsClient.get('config', '5.4.1'); @@ -130,7 +130,7 @@ describe('createOrUpgradeSavedConfig()', () => { savedObjectsClient, version: '7.0.0-rc1', buildNum: 70010, - log: sinon.stub(), + logWithMetadata: sinon.stub(), }); const config700rc1 = await savedObjectsClient.get('config', '7.0.0-rc1'); @@ -157,7 +157,7 @@ describe('createOrUpgradeSavedConfig()', () => { savedObjectsClient, version: '7.0.0', buildNum: 70099, - log: sinon.stub(), + logWithMetadata: sinon.stub(), }); const config700 = await savedObjectsClient.get('config', '7.0.0'); @@ -185,7 +185,7 @@ describe('createOrUpgradeSavedConfig()', () => { savedObjectsClient, version: '6.2.3-rc1', buildNum: 62310, - log: sinon.stub(), + logWithMetadata: sinon.stub(), }); const config623rc1 = await savedObjectsClient.get('config', '6.2.3-rc1'); diff --git a/src/ui/ui_settings/create_or_upgrade_saved_config/__tests__/create_or_upgrade_saved_config.js b/src/ui/ui_settings/create_or_upgrade_saved_config/__tests__/create_or_upgrade_saved_config.js index 14b7013a4f625..9c36233d0d1f9 100644 --- a/src/ui/ui_settings/create_or_upgrade_saved_config/__tests__/create_or_upgrade_saved_config.js +++ b/src/ui/ui_settings/create_or_upgrade_saved_config/__tests__/create_or_upgrade_saved_config.js @@ -35,7 +35,7 @@ describe('uiSettings/createOrUpgradeSavedConfig', function () { const buildNum = chance.integer({ min: 1000, max: 5000 }); function setup() { - const log = sinon.stub(); + const logWithMetadata = sinon.stub(); const getUpgradeableConfig = sandbox.stub(getUpgradeableConfigNS, 'getUpgradeableConfig'); const savedObjectsClient = { create: sinon.stub().callsFake(async (type, attributes, options = {}) => ({ @@ -50,7 +50,7 @@ describe('uiSettings/createOrUpgradeSavedConfig', function () { savedObjectsClient, version, buildNum, - log, + logWithMetadata, ...options }); @@ -62,7 +62,7 @@ describe('uiSettings/createOrUpgradeSavedConfig', function () { return { buildNum, - log, + logWithMetadata, run, version, savedObjectsClient, @@ -120,17 +120,17 @@ describe('uiSettings/createOrUpgradeSavedConfig', function () { }); it('should log a message for upgrades', async () => { - const { getUpgradeableConfig, log, run } = setup(); + const { getUpgradeableConfig, logWithMetadata, run } = setup(); getUpgradeableConfig .returns({ id: prevVersion, attributes: { buildNum: buildNum - 100 } }); await run(); - sinon.assert.calledOnce(log); - sinon.assert.calledWithExactly(log, + sinon.assert.calledOnce(logWithMetadata); + sinon.assert.calledWithExactly(logWithMetadata, ['plugin', 'elasticsearch'], + sinon.match('Upgrade'), sinon.match({ - tmpl: sinon.match('Upgrade'), prevVersion, newVersion: version, }) @@ -138,7 +138,7 @@ describe('uiSettings/createOrUpgradeSavedConfig', function () { }); it('does not log when upgrade fails', async () => { - const { getUpgradeableConfig, log, run, savedObjectsClient } = setup(); + const { getUpgradeableConfig, logWithMetadata, run, savedObjectsClient } = setup(); getUpgradeableConfig .returns({ id: prevVersion, attributes: { buildNum: buildNum - 100 } }); @@ -154,7 +154,7 @@ describe('uiSettings/createOrUpgradeSavedConfig', function () { expect(error.message).to.be('foo'); } - sinon.assert.notCalled(log); + sinon.assert.notCalled(logWithMetadata); }); }); diff --git a/src/ui/ui_settings/create_or_upgrade_saved_config/create_or_upgrade_saved_config.js b/src/ui/ui_settings/create_or_upgrade_saved_config/create_or_upgrade_saved_config.js index 184e2ca9794a2..c175e583ee916 100644 --- a/src/ui/ui_settings/create_or_upgrade_saved_config/create_or_upgrade_saved_config.js +++ b/src/ui/ui_settings/create_or_upgrade_saved_config/create_or_upgrade_saved_config.js @@ -26,7 +26,7 @@ export async function createOrUpgradeSavedConfig(options) { savedObjectsClient, version, buildNum, - log, + logWithMetadata, onWriteError, } = options; @@ -58,8 +58,7 @@ export async function createOrUpgradeSavedConfig(options) { } if (upgradeableConfig) { - log(['plugin', 'elasticsearch'], { - tmpl: 'Upgrade config from <%= prevVersion %> to <%= newVersion %>', + logWithMetadata(['plugin', 'elasticsearch'], `Upgrade config from ${upgradeableConfig.id} to ${version}`, { prevVersion: upgradeableConfig.id, newVersion: version }); diff --git a/src/ui/ui_settings/ui_settings_service.js b/src/ui/ui_settings/ui_settings_service.js index c755b0b6932bd..0451dc588c923 100644 --- a/src/ui/ui_settings/ui_settings_service.js +++ b/src/ui/ui_settings/ui_settings_service.js @@ -46,8 +46,8 @@ export class UiSettingsService { // we use a function for getDefaults() so that defaults can be different in // different scenarios, and so they can change over time getDefaults = () => ({}), - // function that accepts log messages in the same format as server.log - log = () => {}, + // function that accepts log messages in the same format as server.logWithMetadata + logWithMetadata = () => {}, overrides = {}, } = options; @@ -57,7 +57,7 @@ export class UiSettingsService { this._savedObjectsClient = savedObjectsClient; this._getDefaults = getDefaults; this._overrides = overrides; - this._log = log; + this._logWithMetadata = logWithMetadata; } async getDefaults() { @@ -157,7 +157,7 @@ export class UiSettingsService { savedObjectsClient: this._savedObjectsClient, version: this._id, buildNum: this._buildNum, - log: this._log, + logWithMetadata: this._logWithMetadata, }); await this._write({ @@ -195,7 +195,7 @@ export class UiSettingsService { savedObjectsClient: this._savedObjectsClient, version: this._id, buildNum: this._buildNum, - log: this._log, + logWithMetadata: this._logWithMetadata, onWriteError(error, attributes) { if (isNotAuthorizedError(error) || isForbiddenError(error)) { return attributes; diff --git a/src/ui/ui_settings/ui_settings_service_factory.js b/src/ui/ui_settings/ui_settings_service_factory.js index 7112ddf7374e4..f83a0d9825557 100644 --- a/src/ui/ui_settings/ui_settings_service_factory.js +++ b/src/ui/ui_settings/ui_settings_service_factory.js @@ -47,6 +47,6 @@ export function uiSettingsServiceFactory(server, options) { savedObjectsClient, getDefaults, overrides, - log: (...args) => server.log(...args), + logWithMetadata: (...args) => server.logWithMetadata(...args), }); -} \ No newline at end of file +} From f56ed2c99975724f58642ac63c440d132ca9fe19 Mon Sep 17 00:00:00 2001 From: Nox911 Date: Wed, 23 Jan 2019 17:54:57 +0300 Subject: [PATCH 03/29] Fix template (#28922) --- .../watch_edit_execute_detail/watch_edit_execute_detail.html | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/x-pack/plugins/watcher/public/sections/watch_edit/components/watch_edit_execute_detail/watch_edit_execute_detail.html b/x-pack/plugins/watcher/public/sections/watch_edit/components/watch_edit_execute_detail/watch_edit_execute_detail.html index 684d5ac5de59b..69e7a282f5ec9 100644 --- a/x-pack/plugins/watcher/public/sections/watch_edit/components/watch_edit_execute_detail/watch_edit_execute_detail.html +++ b/x-pack/plugins/watcher/public/sections/watch_edit/components/watch_edit_execute_detail/watch_edit_execute_detail.html @@ -94,9 +94,12 @@ type="checkbox" ng-model="watchEditExecuteDetail.executeDetails.ignoreCondition" class="kuiCheckBox" + /> + + > + From 80a193341ea341f17ba4f422d52d7b935039feb7 Mon Sep 17 00:00:00 2001 From: Andrew Cholakian Date: Wed, 23 Jan 2019 07:16:57 -0800 Subject: [PATCH 04/29] [Uptime] Remove broken stacked chart in monitor detail page. (#29019) This chart had no legend and the sum of it was incorrect. We can bring this back later in a form that actually functions. --- .../queries/monitor_charts/monitor_charts.tsx | 119 +++++------------- 1 file changed, 30 insertions(+), 89 deletions(-) diff --git a/x-pack/plugins/uptime/public/components/queries/monitor_charts/monitor_charts.tsx b/x-pack/plugins/uptime/public/components/queries/monitor_charts/monitor_charts.tsx index a7dfc0938d66c..b7957f578b20c 100644 --- a/x-pack/plugins/uptime/public/components/queries/monitor_charts/monitor_charts.tsx +++ b/x-pack/plugins/uptime/public/components/queries/monitor_charts/monitor_charts.tsx @@ -112,9 +112,6 @@ export const MonitorCharts = ({ const durationDomain = avgDurationSeries.concat(areaRttSeries); const durationLimits = [0, Math.max(...durationDomain.map(({ y }) => y))]; - // find the greatest y-value for rtt chart - const rttLimits = [0, Math.max(...maxRtt.map(({ y }) => y))]; - return ( @@ -122,58 +119,38 @@ export const MonitorCharts = ({

- + - - - - @@ -182,80 +159,44 @@ export const MonitorCharts = ({

- + -
- - -

- -

-
- - - - - -
); }} From 8f54a6fc43c94eae18e85000d673e25b801a1852 Mon Sep 17 00:00:00 2001 From: Justin Kambic Date: Wed, 23 Jan 2019 10:36:03 -0500 Subject: [PATCH 05/29] [Uptime] Disable update button for SDP (#29150) * Disable update button for SDP. * Update SDP style. --- x-pack/plugins/uptime/public/uptime_app.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/x-pack/plugins/uptime/public/uptime_app.tsx b/x-pack/plugins/uptime/public/uptime_app.tsx index 1f181970c8b0a..f0a4daa6fc5ea 100644 --- a/x-pack/plugins/uptime/public/uptime_app.tsx +++ b/x-pack/plugins/uptime/public/uptime_app.tsx @@ -148,7 +148,7 @@ class Application extends React.Component {
{ this.persistState ); }} + showUpdateButton={false} />
From e7069089db89d1e1f3e3d5bba17d82e9517d344a Mon Sep 17 00:00:00 2001 From: Paul Sanwald Date: Wed, 23 Jan 2019 11:56:30 -0500 Subject: [PATCH 06/29] Small improvements to add cluster page (#29142) Improve text around what port should be entered, and add a tooltip that explains the "Not Connected" error message. --- .../remote_cluster_form.js | 2 +- .../connection_status/connection_status.js | 26 +++++++++++++++---- 2 files changed, 22 insertions(+), 6 deletions(-) diff --git a/x-pack/plugins/remote_clusters/public/sections/components/remote_cluster_form/remote_cluster_form.js b/x-pack/plugins/remote_clusters/public/sections/components/remote_cluster_form/remote_cluster_form.js index 791c5ea43f218..dee024944d33a 100644 --- a/x-pack/plugins/remote_clusters/public/sections/components/remote_cluster_form/remote_cluster_form.js +++ b/x-pack/plugins/remote_clusters/public/sections/components/remote_cluster_form/remote_cluster_form.js @@ -327,7 +327,7 @@ export const RemoteClusterForm = injectI18n( helpText={( )} isInvalid={showErrors} diff --git a/x-pack/plugins/remote_clusters/public/sections/remote_cluster_list/components/connection_status/connection_status.js b/x-pack/plugins/remote_clusters/public/sections/remote_cluster_list/components/connection_status/connection_status.js index c60d6f9c74a11..d316267f435e0 100644 --- a/x-pack/plugins/remote_clusters/public/sections/remote_cluster_list/components/connection_status/connection_status.js +++ b/x-pack/plugins/remote_clusters/public/sections/remote_cluster_list/components/connection_status/connection_status.js @@ -12,6 +12,7 @@ import { EuiFlexGroup, EuiFlexItem, EuiIcon, + EuiIconTip, EuiText, } from '@elastic/eui'; @@ -43,16 +44,31 @@ export function ConnectionStatus({ isConnected }) { }); } + const seedNodeTooltip = i18n.translate('xpack.remoteClusters.connectedStatus.notConnectedToolTip', { + defaultMessage: "Ensure the seed nodes are configured with the remote cluster's transport port, not the http port.", + }); + return ( - {icon} + + + {icon} + + + + + {message} + + + - - - {message} - + + ); From 09f890483f7fc300a33b0a7b52833afa2bdb0868 Mon Sep 17 00:00:00 2001 From: Nathan Reese Date: Wed, 23 Jan 2019 10:21:41 -0700 Subject: [PATCH 07/29] [Maps] Move alpha from style descriptor to layer descriptor (#29059) * default alpha * update heatmap descriptor to use constant * clean-up * use ValidatedRange to ensure alphaValue can not be set to invalid value * fix jest test expect * move alpha to layer property * ensure defaults are set when Layer object is instantiated --- .../gis/public/actions/store_actions.js | 8 +-- .../public/angular/get_initial_layers.test.js | 6 +- .../public/components/layer_panel/index.js | 15 +---- .../layer_panel/settings_panel/index.js | 8 +-- .../settings_panel/settings_panel.js | 13 ++-- .../shared/components/validated_range.js | 19 ++++-- .../gis/public/shared/layers/heatmap_layer.js | 7 +- .../plugins/gis/public/shared/layers/layer.js | 17 +++-- .../es_geohashgrid_source.js | 65 +++++++------------ .../vector/size/size_range_selector.js | 4 ++ .../vector/size/static_size_selection.js | 2 + .../shared/layers/styles/heatmap_style.js | 30 ++++----- .../public/shared/layers/styles/tile_style.js | 20 +++--- .../shared/layers/styles/vector_style.js | 28 +++----- .../layers/styles/vector_style_defaults.js | 4 +- .../gis/public/shared/layers/tile_layer.js | 16 +++-- .../gis/public/shared/layers/vector_layer.js | 17 +++-- x-pack/plugins/gis/public/store/map.js | 8 --- .../sample_data/web_logs_saved_objects.json | 2 +- 19 files changed, 133 insertions(+), 156 deletions(-) diff --git a/x-pack/plugins/gis/public/actions/store_actions.js b/x-pack/plugins/gis/public/actions/store_actions.js index 6eb5a12883d65..dc6a170b6f470 100644 --- a/x-pack/plugins/gis/public/actions/store_actions.js +++ b/x-pack/plugins/gis/public/actions/store_actions.js @@ -42,7 +42,6 @@ export const UPDATE_LAYER_STYLE_FOR_SELECTED_LAYER = 'UPDATE_LAYER_STYLE'; export const PROMOTE_TEMPORARY_STYLES = 'PROMOTE_TEMPORARY_STYLES'; export const CLEAR_TEMPORARY_STYLES = 'CLEAR_TEMPORARY_STYLES'; export const TOUCH_LAYER = 'TOUCH_LAYER'; -export const UPDATE_LAYER_ALPHA_VALUE = 'UPDATE_LAYER_ALPHA_VALUE'; export const UPDATE_SOURCE_PROP = 'UPDATE_SOURCE_PROP'; export const SET_REFRESH_CONFIG = 'SET_REFRESH_CONFIG'; export const SET_MOUSE_COORDINATES = 'SET_MOUSE_COORDINATES'; @@ -352,11 +351,12 @@ export function updateLayerMaxZoom(id, maxZoom) { }; } -export function updateLayerAlphaValue(id, newAlphaValue) { +export function updateLayerAlpha(id, alpha) { return { - type: UPDATE_LAYER_ALPHA_VALUE, + type: UPDATE_LAYER_PROP, id, - newAlphaValue + propName: 'alpha', + newValue: alpha, }; } diff --git a/x-pack/plugins/gis/public/angular/get_initial_layers.test.js b/x-pack/plugins/gis/public/angular/get_initial_layers.test.js index 8cf99b2201482..47f610d8cf8db 100644 --- a/x-pack/plugins/gis/public/angular/get_initial_layers.test.js +++ b/x-pack/plugins/gis/public/angular/get_initial_layers.test.js @@ -45,6 +45,7 @@ describe('Saved object does not have layer list', () => { const layers = getInitialLayers(null, dataSources); expect(layers).toEqual([{ + "alpha": 1, dataRequests: [], id: layers[0].id, label: null, @@ -56,7 +57,7 @@ describe('Saved object does not have layer list', () => { url: 'myTileUrl', }, style: { - properties: undefined, + properties: {}, type: 'TILE', }, temporary: false, @@ -72,6 +73,7 @@ describe('Saved object does not have layer list', () => { const layers = getInitialLayers(null, dataSources); expect(layers).toEqual([{ + "alpha": 1, dataRequests: [], id: layers[0].id, label: null, @@ -83,7 +85,7 @@ describe('Saved object does not have layer list', () => { type: 'EMS_TMS' }, style: { - properties: undefined, + properties: {}, type: 'TILE', }, temporary: false, diff --git a/x-pack/plugins/gis/public/components/layer_panel/index.js b/x-pack/plugins/gis/public/components/layer_panel/index.js index 158a0b1a6f105..cd14860b7ccf3 100644 --- a/x-pack/plugins/gis/public/components/layer_panel/index.js +++ b/x-pack/plugins/gis/public/components/layer_panel/index.js @@ -7,12 +7,6 @@ import { connect } from 'react-redux'; import { LayerPanel } from './view'; import { getSelectedLayer } from '../../selectors/map_selectors'; -import { - updateLayerLabel, - updateLayerMaxZoom, - updateLayerMinZoom, - updateLayerAlphaValue -} from '../../actions/store_actions'; function mapStateToProps(state = {}) { return { @@ -20,13 +14,8 @@ function mapStateToProps(state = {}) { }; } -function mapDispatchToProps(dispatch) { - return { - updateLabel: (id, label) => dispatch(updateLayerLabel(id, label)), - updateMinZoom: (id, minZoom) => dispatch(updateLayerMinZoom(id, minZoom)), - updateMaxZoom: (id, maxZoom) => dispatch(updateLayerMaxZoom(id, maxZoom)), - updateAlphaValue: (id, alphaValue) => dispatch(updateLayerAlphaValue(id, alphaValue)) - }; +function mapDispatchToProps(/* dispatch */) { + return {}; } const connectedLayerPanel = connect(mapStateToProps, mapDispatchToProps)(LayerPanel); diff --git a/x-pack/plugins/gis/public/components/layer_panel/settings_panel/index.js b/x-pack/plugins/gis/public/components/layer_panel/settings_panel/index.js index b943c2ffc2a64..2bbcbe3273e01 100644 --- a/x-pack/plugins/gis/public/components/layer_panel/settings_panel/index.js +++ b/x-pack/plugins/gis/public/components/layer_panel/settings_panel/index.js @@ -4,7 +4,6 @@ * you may not use this file except in compliance with the Elastic License. */ -import _ from 'lodash'; import { connect } from 'react-redux'; import { SettingsPanel } from './settings_panel'; import { getSelectedLayer } from '../../../selectors/map_selectors'; @@ -12,19 +11,18 @@ import { updateLayerLabel, updateLayerMaxZoom, updateLayerMinZoom, - updateLayerAlphaValue, + updateLayerAlpha, updateSourceProp, } from '../../../actions/store_actions'; function mapStateToProps(state = {}) { const selectedLayer = getSelectedLayer(state); return { - alphaValue: _.get(selectedLayer.getCurrentStyle(), '_descriptor.properties.alphaValue', 1), + alpha: selectedLayer.getAlpha(), label: selectedLayer.getLabel(), layerId: selectedLayer.getId(), maxZoom: selectedLayer.getMaxZoom(), minZoom: selectedLayer.getMinZoom(), - alphaValue: _.get(selectedLayer.getCurrentStyle(), '_descriptor.properties.alphaValue', 1), renderSourceDetails: selectedLayer.renderSourceDetails, renderSourceSettingsEditor: selectedLayer.renderSourceSettingsEditor, }; @@ -35,7 +33,7 @@ function mapDispatchToProps(dispatch) { updateLabel: (id, label) => dispatch(updateLayerLabel(id, label)), updateMinZoom: (id, minZoom) => dispatch(updateLayerMinZoom(id, minZoom)), updateMaxZoom: (id, maxZoom) => dispatch(updateLayerMaxZoom(id, maxZoom)), - updateAlphaValue: (id, alphaValue) => dispatch(updateLayerAlphaValue(id, alphaValue)), + updateAlpha: (id, alpha) => dispatch(updateLayerAlpha(id, alpha)), updateSourceProp: (id, propName, value) => dispatch(updateSourceProp(id, propName, value)), }; } diff --git a/x-pack/plugins/gis/public/components/layer_panel/settings_panel/settings_panel.js b/x-pack/plugins/gis/public/components/layer_panel/settings_panel/settings_panel.js index 7884497a3a410..8efb06622f0bc 100644 --- a/x-pack/plugins/gis/public/components/layer_panel/settings_panel/settings_panel.js +++ b/x-pack/plugins/gis/public/components/layer_panel/settings_panel/settings_panel.js @@ -17,6 +17,7 @@ import { EuiSpacer, EuiLink, } from '@elastic/eui'; +import { ValidatedRange } from '../../../shared/components/validated_range'; export class SettingsPanel extends Component { @@ -45,10 +46,8 @@ export class SettingsPanel extends Component { this.props.updateMaxZoom(this.props.layerId, zoom); } - onAlphaValueChange = (event) => { - const sanitizedValue = parseFloat(event.target.value); - const alphaValue = isNaN(sanitizedValue) ? '' : sanitizedValue; - this.props.updateAlphaValue(this.props.layerId, alphaValue); + onAlphaChange = (alpha) => { + this.props.updateAlpha(this.props.layerId, alpha); } onSourceChange = ({ propName, value }) => { @@ -113,12 +112,12 @@ export class SettingsPanel extends Component { label="Layer transparency" >
- { - const sanitizedValue = parseInt(e.target.value, 10); + const sanitizedValue = parseFloat(e.target.value, 10); let newValue = isNaN(sanitizedValue) ? '' : sanitizedValue; // work around for https://github.com/elastic/eui/issues/1458 // TODO remove once above EUI issue is resolved @@ -56,11 +56,19 @@ export class ValidatedRange extends React.Component { }; render() { + const { + max, + min, + value, // eslint-disable-line no-unused-vars + onChange, // eslint-disable-line no-unused-vars + ...rest + } = this.props; + let errorMessage; if (!this.state.isValid) { errorMessage = ( - {`Must be between ${this.props.min} and ${this.props.max}`} + {`Must be between ${min} and ${max}`} ); } @@ -68,12 +76,11 @@ export class ValidatedRange extends React.Component { return ( {errorMessage} diff --git a/x-pack/plugins/gis/public/shared/layers/heatmap_layer.js b/x-pack/plugins/gis/public/shared/layers/heatmap_layer.js index ee0b9651b0fd4..8459dd833f4ce 100644 --- a/x-pack/plugins/gis/public/shared/layers/heatmap_layer.js +++ b/x-pack/plugins/gis/public/shared/layers/heatmap_layer.js @@ -88,7 +88,12 @@ export class HeatmapLayer extends ALayer { } mbMap.setLayoutProperty(heatmapLayerId, 'visibility', this.isVisible() ? 'visible' : 'none'); - this._style.setMBPaintProperties(mbMap, heatmapLayerId, SCALED_PROPERTY_NAME); + this._style.setMBPaintProperties({ + mbMap, + layerId: heatmapLayerId, + propertyName: SCALED_PROPERTY_NAME, + alpha: this.getAlpha(), + }); mbMap.setLayerZoomRange(heatmapLayerId, this._descriptor.minZoom, this._descriptor.maxZoom); } diff --git a/x-pack/plugins/gis/public/shared/layers/layer.js b/x-pack/plugins/gis/public/shared/layers/layer.js index 054219d86e43d..2a9d56f28e0d6 100644 --- a/x-pack/plugins/gis/public/shared/layers/layer.js +++ b/x-pack/plugins/gis/public/shared/layers/layer.js @@ -14,7 +14,7 @@ const NO_SOURCE_UPDATE_REQUIRED = false; export class ALayer { constructor({ layerDescriptor, source, style }) { - this._descriptor = layerDescriptor; + this._descriptor = ALayer.createDescriptor(layerDescriptor); this._source = source; this._style = style; @@ -30,16 +30,15 @@ export class ALayer { return mbStyle.sources[sourceId].data; } - static createDescriptor(options) { - const layerDescriptor = {}; + static createDescriptor(options = {}) { + const layerDescriptor = { ...options }; - layerDescriptor.dataRequests = []; - layerDescriptor.id = Math.random().toString(36).substr(2, 5); + layerDescriptor.dataRequests = _.get(options, 'dataRequests', []); + layerDescriptor.id = _.get(options, 'id', Math.random().toString(36).substr(2, 5)); layerDescriptor.label = options.label && options.label.length > 0 ? options.label : null; layerDescriptor.minZoom = _.get(options, 'minZoom', 0); layerDescriptor.maxZoom = _.get(options, 'maxZoom', 24); - layerDescriptor.source = options.source; - layerDescriptor.sourceDescriptor = options.sourceDescriptor; + layerDescriptor.alpha = _.get(options, 'alpha', 0.75); layerDescriptor.visible = options.visible || true; layerDescriptor.temporary = options.temporary || false; layerDescriptor.style = options.style || {}; @@ -109,6 +108,10 @@ export class ALayer { return this._descriptor.maxZoom; } + getAlpha() { + return this._descriptor.alpha; + } + getZoomConfig() { return { minZoom: this._descriptor.minZoom, diff --git a/x-pack/plugins/gis/public/shared/layers/sources/es_geohashgrid_source/es_geohashgrid_source.js b/x-pack/plugins/gis/public/shared/layers/sources/es_geohashgrid_source/es_geohashgrid_source.js index 7431ff45278f3..a5897ea047576 100644 --- a/x-pack/plugins/gis/public/shared/layers/sources/es_geohashgrid_source/es_geohashgrid_source.js +++ b/x-pack/plugins/gis/public/shared/layers/sources/es_geohashgrid_source/es_geohashgrid_source.js @@ -301,48 +301,31 @@ export class ESGeohashGridSource extends VectorSource { sourceDescriptor: this._descriptor, ...options }); - descriptor.style = { - ...descriptor.style, - type: 'VECTOR', - properties: { - fillColor: { - type: 'DYNAMIC', - options: { - field: { - label: COUNT_PROP_LABEL, - name: COUNT_PROP_NAME, - origin: 'source' - }, - color: 'Blues' - } - }, - lineColor: { - type: 'STATIC', - options: { - color: '#cccccc' - } - }, - lineWidth: { - type: 'STATIC', - options: { - size: 1 - } - }, - iconSize: { - type: 'DYNAMIC', - options: { - field: { - label: COUNT_PROP_LABEL, - name: COUNT_PROP_NAME, - origin: 'source' - }, - minSize: 4, - maxSize: 32, - } - }, - alphaValue: 1 + descriptor.style = VectorStyle.createDescriptor({ + fillColor: { + type: VectorStyle.STYLE_TYPE.DYNAMIC, + options: { + field: { + label: COUNT_PROP_LABEL, + name: COUNT_PROP_NAME, + origin: 'source' + }, + color: 'Blues' + } + }, + iconSize: { + type: VectorStyle.STYLE_TYPE.DYNAMIC, + options: { + field: { + label: COUNT_PROP_LABEL, + name: COUNT_PROP_NAME, + origin: 'source' + }, + minSize: 4, + maxSize: 32, + } } - }; + }); return descriptor; } diff --git a/x-pack/plugins/gis/public/shared/layers/styles/components/vector/size/size_range_selector.js b/x-pack/plugins/gis/public/shared/layers/styles/components/vector/size/size_range_selector.js index dda95f336c8d1..88b5926e2cf36 100644 --- a/x-pack/plugins/gis/public/shared/layers/styles/components/vector/size/size_range_selector.js +++ b/x-pack/plugins/gis/public/shared/layers/styles/components/vector/size/size_range_selector.js @@ -43,6 +43,8 @@ export function SizeRangeSelector({ minSize, maxSize, onChange }) { max={DEFAULT_MAX_SIZE} value={minSize} onChange={onMinSizeChange} + showInput + showRange /> @@ -56,6 +58,8 @@ export function SizeRangeSelector({ minSize, maxSize, onChange }) { max={DEFAULT_MAX_SIZE} value={maxSize} onChange={onMaxSizeChange} + showInput + showRange /> diff --git a/x-pack/plugins/gis/public/shared/layers/styles/components/vector/size/static_size_selection.js b/x-pack/plugins/gis/public/shared/layers/styles/components/vector/size/static_size_selection.js index 2a8ba9b6c7dac..0a0c29e28c289 100644 --- a/x-pack/plugins/gis/public/shared/layers/styles/components/vector/size/static_size_selection.js +++ b/x-pack/plugins/gis/public/shared/layers/styles/components/vector/size/static_size_selection.js @@ -20,6 +20,8 @@ export function StaticSizeSelection({ onChange, styleOptions }) { max={100} value={styleOptions.size} onChange={onSizeChange} + showInput + showRange /> ); } diff --git a/x-pack/plugins/gis/public/shared/layers/styles/heatmap_style.js b/x-pack/plugins/gis/public/shared/layers/styles/heatmap_style.js index c87729dc06620..7d1a80f6918ec 100644 --- a/x-pack/plugins/gis/public/shared/layers/styles/heatmap_style.js +++ b/x-pack/plugins/gis/public/shared/layers/styles/heatmap_style.js @@ -14,20 +14,23 @@ export class HeatmapStyle { static type = 'HEATMAP'; - constructor(styleDescriptor) { - this._descriptor = styleDescriptor; + constructor(styleDescriptor = {}) { + this._descriptor = HeatmapStyle.createDescriptor( + styleDescriptor.refinement, + styleDescriptor.properties + ); } static canEdit(styleInstance) { return styleInstance.constructor === HeatmapStyle; } - static createDescriptor(refinement) { + static createDescriptor(refinement, properties = {}) { return { type: HeatmapStyle.type, refinement: refinement || 'coarse', properties: { - alphaValue: 1 + ...properties } }; } @@ -47,15 +50,8 @@ export class HeatmapStyle { } - _getMBOpacity() { - const DEFAULT_OPACITY = 1; - return typeof this._descriptor.properties.alphaValue === 'number' ? this._descriptor.properties.alphaValue : DEFAULT_OPACITY; - } - - setMBPaintProperties(mbMap, pointLayerID, property) { - + setMBPaintProperties({ alpha, mbMap, layerId, propertyName }) { let radius; - const opacity = this._getMBOpacity(); if (this._descriptor.refinement === 'coarse') { radius = 64; } else if (this._descriptor.refinement === 'fine') { @@ -65,12 +61,12 @@ export class HeatmapStyle { } else { throw new Error(`Refinement param not recognized: ${this._descriptor.refinement}`); } - mbMap.setPaintProperty(pointLayerID, 'heatmap-radius', radius); - mbMap.setPaintProperty(pointLayerID, 'heatmap-weight', { - "type": 'identity', - "property": property + mbMap.setPaintProperty(layerId, 'heatmap-radius', radius); + mbMap.setPaintProperty(layerId, 'heatmap-weight', { + type: 'identity', + property: propertyName }); - mbMap.setPaintProperty(pointLayerID, 'heatmap-opacity', opacity); + mbMap.setPaintProperty(layerId, 'heatmap-opacity', alpha); } getRefinement() { diff --git a/x-pack/plugins/gis/public/shared/layers/styles/tile_style.js b/x-pack/plugins/gis/public/shared/layers/styles/tile_style.js index d0441df57def7..fc07c01aeafcb 100644 --- a/x-pack/plugins/gis/public/shared/layers/styles/tile_style.js +++ b/x-pack/plugins/gis/public/shared/layers/styles/tile_style.js @@ -8,18 +8,20 @@ export class TileStyle { static type = 'TILE'; - constructor(styleDescriptor) { - this._descriptor = styleDescriptor; + constructor(styleDescriptor = {}) { + this._descriptor = TileStyle.createDescriptor(styleDescriptor.properties); } static canEdit(styleInstance) { return styleInstance.constructor === TileStyle; } - static createDescriptor(properties) { + static createDescriptor(properties = {}) { return { type: TileStyle.type, - properties + properties: { + ...properties, + } }; } @@ -27,13 +29,7 @@ export class TileStyle { return 'Tile style'; } - _getMBOpacity() { - const DEFAULT_OPACITY = 1; - return typeof this._descriptor.properties.alphaValue === 'number' ? this._descriptor.properties.alphaValue : DEFAULT_OPACITY; - } - - setMBPaintProperties(mbMap, tileLayerID) { - const opacity = this._getMBOpacity(); - mbMap.setPaintProperty(tileLayerID, 'raster-opacity', opacity); + setMBPaintProperties({ alpha, mbMap, layerId }) { + mbMap.setPaintProperty(layerId, 'raster-opacity', alpha); } } diff --git a/x-pack/plugins/gis/public/shared/layers/styles/vector_style.js b/x-pack/plugins/gis/public/shared/layers/styles/vector_style.js index 03d216ecce6c5..55acb03f64221 100644 --- a/x-pack/plugins/gis/public/shared/layers/styles/vector_style.js +++ b/x-pack/plugins/gis/public/shared/layers/styles/vector_style.js @@ -11,7 +11,7 @@ import { FillableCircle, FillableVector } from '../../icons/additional_layer_ico import { ColorGradient } from '../../icons/color_gradient'; import { getHexColorRangeStrings } from '../../utils/color_utils'; import { VectorStyleEditor } from './components/vector/vector_style_editor'; -import { DEFAULT_ALPHA_VALUE, getDefaultStaticProperties } from './vector_style_defaults'; +import { getDefaultStaticProperties } from './vector_style_defaults'; export class VectorStyle { @@ -22,7 +22,7 @@ export class VectorStyle { return `__kbn__scaled(${fieldName})`; } - constructor(descriptor) { + constructor(descriptor = {}) { this._descriptor = VectorStyle.createDescriptor(descriptor.properties); } @@ -30,11 +30,10 @@ export class VectorStyle { return styleInstance.constructor === VectorStyle; } - static createDescriptor(properties) { - const defaultStyleProperties = getDefaultStaticProperties(); + static createDescriptor(properties = {}) { return { type: VectorStyle.type, - properties: { ...defaultStyleProperties, ...properties } + properties: { ...getDefaultStaticProperties(), ...properties } }; } @@ -259,10 +258,6 @@ export class VectorStyle { return null; } - _getMBOpacity() { - return _.get(this._descriptor.properties, 'alphaValue', DEFAULT_ALPHA_VALUE); - } - _getMbSize(styleDescriptor) { if (styleDescriptor.type === VectorStyle.STYLE_TYPE.STATIC) { return styleDescriptor.options.size; @@ -282,13 +277,11 @@ export class VectorStyle { return null; } - setMBPaintProperties(mbMap, sourceId, fillLayerId, lineLayerId) { - const opacity = this._getMBOpacity(); - + setMBPaintProperties({ alpha, mbMap, fillLayerId, lineLayerId }) { if (this._descriptor.properties.fillColor) { const color = this._getMBColor(this._descriptor.properties.fillColor); mbMap.setPaintProperty(fillLayerId, 'fill-color', color); - mbMap.setPaintProperty(fillLayerId, 'fill-opacity', opacity); + mbMap.setPaintProperty(fillLayerId, 'fill-opacity', alpha); } else { mbMap.setPaintProperty(fillLayerId, 'fill-color', null); mbMap.setPaintProperty(fillLayerId, 'fill-opacity', 0); @@ -297,7 +290,7 @@ export class VectorStyle { if (this._descriptor.properties.lineColor) { const color = this._getMBColor(this._descriptor.properties.lineColor); mbMap.setPaintProperty(lineLayerId, 'line-color', color); - mbMap.setPaintProperty(lineLayerId, 'line-opacity', opacity); + mbMap.setPaintProperty(lineLayerId, 'line-opacity', alpha); } else { mbMap.setPaintProperty(lineLayerId, 'line-color', null); @@ -312,12 +305,11 @@ export class VectorStyle { } } - setMBPaintPropertiesForPoints(mbMap, sourceId, pointLayerId) { - const opacity = this._getMBOpacity(); + setMBPaintPropertiesForPoints({ alpha, mbMap, pointLayerId }) { if (this._descriptor.properties.fillColor) { const color = this._getMBColor(this._descriptor.properties.fillColor); mbMap.setPaintProperty(pointLayerId, 'circle-color', color); - mbMap.setPaintProperty(pointLayerId, 'circle-opacity', opacity); + mbMap.setPaintProperty(pointLayerId, 'circle-opacity', alpha); } else { mbMap.setPaintProperty(pointLayerId, 'circle-color', null); mbMap.setPaintProperty(pointLayerId, 'circle-opacity', 0); @@ -325,7 +317,7 @@ export class VectorStyle { if (this._descriptor.properties.lineColor) { const color = this._getMBColor(this._descriptor.properties.lineColor); mbMap.setPaintProperty(pointLayerId, 'circle-stroke-color', color); - mbMap.setPaintProperty(pointLayerId, 'circle-stroke-opacity', opacity); + mbMap.setPaintProperty(pointLayerId, 'circle-stroke-opacity', alpha); } else { mbMap.setPaintProperty(pointLayerId, 'circle-stroke-color', null); diff --git a/x-pack/plugins/gis/public/shared/layers/styles/vector_style_defaults.js b/x-pack/plugins/gis/public/shared/layers/styles/vector_style_defaults.js index 7e0aa83f887dc..fa45178d66764 100644 --- a/x-pack/plugins/gis/public/shared/layers/styles/vector_style_defaults.js +++ b/x-pack/plugins/gis/public/shared/layers/styles/vector_style_defaults.js @@ -8,7 +8,7 @@ import { VectorStyle } from './vector_style'; import { COLOR_GRADIENTS } from './components/vector/color/color_ramp_select'; const DEFAULT_COLORS = ['#e6194b', '#3cb44b', '#ffe119', '#f58231', '#911eb4']; -export const DEFAULT_ALPHA_VALUE = 1; + export const DEFAULT_MIN_SIZE = 1; export const DEFAULT_MAX_SIZE = 64; @@ -43,7 +43,6 @@ export function getDefaultStaticProperties(mapColors = []) { size: 10 } }, - alphaValue: DEFAULT_ALPHA_VALUE }; } @@ -75,6 +74,5 @@ export function getDefaultDynamicProperties() { maxSize: DEFAULT_MAX_SIZE } }, - alphaValue: DEFAULT_ALPHA_VALUE }; } diff --git a/x-pack/plugins/gis/public/shared/layers/tile_layer.js b/x-pack/plugins/gis/public/shared/layers/tile_layer.js index 0519cde0faf5d..5950398a6ff10 100644 --- a/x-pack/plugins/gis/public/shared/layers/tile_layer.js +++ b/x-pack/plugins/gis/public/shared/layers/tile_layer.js @@ -4,11 +4,11 @@ * you may not use this file except in compliance with the Elastic License. */ +import _ from 'lodash'; import { ALayer } from './layer'; import React from 'react'; import { EuiIcon } from '@elastic/eui'; import { TileStyle } from '../layers/styles/tile_style'; -import _ from 'lodash'; export class TileLayer extends ALayer { @@ -16,17 +16,15 @@ export class TileLayer extends ALayer { constructor({ layerDescriptor, source, style }) { super({ layerDescriptor, source, style }); - if (!style || !_.get(style, '_descriptor.properties.alphaValue')) { - const defaultStyle = TileStyle.createDescriptor({ - alphaValue: 1 - }); - this._style = new TileStyle(defaultStyle); + if (!style) { + this._style = new TileStyle(); } } static createDescriptor(options) { const tileLayerDescriptor = super.createDescriptor(options); tileLayerDescriptor.type = TileLayer.type; + tileLayerDescriptor.alpha = _.get(options, 'alpha', 1); tileLayerDescriptor.style = TileStyle.createDescriptor(tileLayerDescriptor.style.properties); return tileLayerDescriptor; @@ -57,7 +55,11 @@ export class TileLayer extends ALayer { mbMap.setLayoutProperty(layerId, 'visibility', this.isVisible() ? 'visible' : 'none'); mbMap.setLayerZoomRange(layerId, this._descriptor.minZoom, this._descriptor.maxZoom); - this._style && this._style.setMBPaintProperties(mbMap, layerId); + this._style && this._style.setMBPaintProperties({ + alpha: this.getAlpha(), + mbMap, + layerId, + }); } getIcon() { diff --git a/x-pack/plugins/gis/public/shared/layers/vector_layer.js b/x-pack/plugins/gis/public/shared/layers/vector_layer.js index 735546e63c2cc..b81bf0dfff83c 100644 --- a/x-pack/plugins/gis/public/shared/layers/vector_layer.js +++ b/x-pack/plugins/gis/public/shared/layers/vector_layer.js @@ -397,13 +397,17 @@ export class VectorLayer extends ALayer { }); mbMap.setFilter(pointLayerId, ['any', ['==', ['geometry-type'], 'Point'], ['==', ['geometry-type'], 'MultiPoint']]); } - this._style.setMBPaintPropertiesForPoints(mbMap, this.getId(), pointLayerId); + this._style.setMBPaintPropertiesForPoints({ + alpha: this.getAlpha(), + mbMap, + pointLayerId: pointLayerId, + }); mbMap.setLayoutProperty(pointLayerId, 'visibility', this.isVisible() ? 'visible' : 'none'); mbMap.setLayerZoomRange(pointLayerId, this._descriptor.minZoom, this._descriptor.maxZoom); this._addTooltipListeners(mbMap, pointLayerId); } - _setMbLinePolygonProeprties(mbMap) { + _setMbLinePolygonProperties(mbMap) { const sourceId = this.getId(); const fillLayerId = this.getId() + '_fill'; const lineLayerId = this.getId() + '_line'; @@ -437,7 +441,12 @@ export class VectorLayer extends ALayer { ['==', ['geometry-type'], 'MultiLineString'] ]); } - this._style.setMBPaintProperties(mbMap, this.getId(), fillLayerId, lineLayerId, this.isTemporary()); + this._style.setMBPaintProperties({ + alpha: this.getAlpha(), + mbMap, + fillLayerId, + lineLayerId, + }); mbMap.setLayoutProperty(fillLayerId, 'visibility', this.isVisible() ? 'visible' : 'none'); mbMap.setLayoutProperty(lineLayerId, 'visibility', this.isVisible() ? 'visible' : 'none'); mbMap.setLayerZoomRange(lineLayerId, this._descriptor.minZoom, this._descriptor.maxZoom); @@ -447,7 +456,7 @@ export class VectorLayer extends ALayer { _syncStylePropertiesWithMb(mbMap) { this._setMbPointsProperties(mbMap); - this._setMbLinePolygonProeprties(mbMap); + this._setMbLinePolygonProperties(mbMap); } _syncSourceBindingWithMb(mbMap) { diff --git a/x-pack/plugins/gis/public/store/map.js b/x-pack/plugins/gis/public/store/map.js index cf32464034a9c..78cc2560ae7e3 100644 --- a/x-pack/plugins/gis/public/store/map.js +++ b/x-pack/plugins/gis/public/store/map.js @@ -27,7 +27,6 @@ import { CLEAR_TEMPORARY_STYLES, SET_JOINS, TOUCH_LAYER, - UPDATE_LAYER_ALPHA_VALUE, UPDATE_SOURCE_PROP, SET_REFRESH_CONFIG, TRIGGER_REFRESH_TIMER, @@ -192,13 +191,6 @@ export function map(state = INITIAL_STATE, action) { return { ...state, selectedLayerId: match ? action.selectedLayerId : null }; case UPDATE_LAYER_ORDER: return { ...state, layerList: action.newLayerOrder.map(layerNumber => state.layerList[layerNumber]) }; - case UPDATE_LAYER_ALPHA_VALUE: - const alphaLayer = state.layerList.find(layer => layer.id === action.id); - const preAlphaStyle = alphaLayer.style; - return updateLayerInList(state, action.id, 'style', - { ...preAlphaStyle, properties: { ...preAlphaStyle.properties, - alphaValue: action.newAlphaValue } - }); case UPDATE_LAYER_PROP: return updateLayerInList(state, action.id, action.propName, action.newValue); case UPDATE_SOURCE_PROP: diff --git a/x-pack/plugins/gis/server/sample_data/web_logs_saved_objects.json b/x-pack/plugins/gis/server/sample_data/web_logs_saved_objects.json index 07d7ad845fe58..09e9d7f271c60 100644 --- a/x-pack/plugins/gis/server/sample_data/web_logs_saved_objects.json +++ b/x-pack/plugins/gis/server/sample_data/web_logs_saved_objects.json @@ -8,7 +8,7 @@ "title" : "[Logs] Web Traffic", "description" : "", "mapStateJSON" : "{\"zoom\":3.92,\"center\":{\"lon\":-83.95443,\"lat\":38.02463},\"timeFilters\":{\"from\":\"now-7d\",\"to\":\"now\"}}", - "layerListJSON" : "[{\"id\":\"0hmz5\",\"sourceDescriptor\":{\"type\":\"EMS_TMS\",\"id\":\"road_map\"},\"visible\":true,\"temporary\":false,\"style\":{\"type\":\"TILE\",\"properties\":{\"alphaValue\":1}},\"type\":\"TILE\",\"minZoom\":0,\"maxZoom\":24},{\"id\":\"ajk2l\",\"label\":\"logs(heatmap)\",\"minZoom\":0,\"maxZoom\":9,\"sourceDescriptor\":{\"type\":\"ES_GEOHASH_GRID\",\"id\":\"60c5dffb-7fca-431c-b1f0-9cc2e6697e8c\",\"indexPatternId\":\"90943e30-9a47-11e8-b64d-95841ca0b247\",\"geoField\":\"geo.coordinates\",\"requestType\":\"heatmap\"},\"visible\":true,\"temporary\":false,\"style\":{\"type\":\"HEATMAP\",\"refinement\":\"coarse\",\"properties\":{\"alphaValue\":0.75},\"previousStyle\":null},\"type\":\"HEATMAP\"},{\"id\":\"6hgh2\",\"label\":\"logs(documents)\",\"minZoom\":7,\"maxZoom\":24,\"sourceDescriptor\":{\"id\":\"541f2ca1-6a0f-4937-8846-a589222b7f28\",\"type\":\"ES_SEARCH\",\"indexPatternId\":\"90943e30-9a47-11e8-b64d-95841ca0b247\",\"geoField\":\"geo.coordinates\",\"limit\":2048,\"filterByMapBounds\":true,\"showTooltip\":true,\"tooltipProperties\":[\"timestamp\",\"clientip\",\"url\"]},\"visible\":true,\"temporary\":false,\"style\":{\"type\":\"VECTOR\",\"properties\":{\"fillColor\":{\"type\":\"STATIC\",\"options\":{\"color\":\"#e6194b\"}},\"lineColor\":{\"type\":\"STATIC\",\"options\":{\"color\":\"#FFFFFF\"}},\"lineWidth\":{\"type\":\"STATIC\",\"options\":{\"size\":1}},\"iconSize\":{\"type\":\"STATIC\",\"options\":{\"size\":10}},\"alphaValue\":0.75},\"previousStyle\":null},\"type\":\"VECTOR\"}]", + "layerListJSON" : "[{\"id\":\"0hmz5\",\"sourceDescriptor\":{\"type\":\"EMS_TMS\",\"id\":\"road_map\"},\"visible\":true,\"temporary\":false,\"style\":{\"type\":\"TILE\",\"properties\":{\"alphaValue\":1}},\"type\":\"TILE\",\"alpha\":1,\"minZoom\":0,\"maxZoom\":24},{\"id\":\"ajk2l\",\"label\":\"logs(heatmap)\",\"alpha\":1,\"minZoom\":0,\"maxZoom\":9,\"sourceDescriptor\":{\"type\":\"ES_GEOHASH_GRID\",\"id\":\"60c5dffb-7fca-431c-b1f0-9cc2e6697e8c\",\"indexPatternId\":\"90943e30-9a47-11e8-b64d-95841ca0b247\",\"geoField\":\"geo.coordinates\",\"requestType\":\"heatmap\"},\"visible\":true,\"temporary\":false,\"style\":{\"type\":\"HEATMAP\",\"refinement\":\"coarse\",\"properties\":{\"alphaValue\":0.75},\"previousStyle\":null},\"type\":\"HEATMAP\"},{\"id\":\"6hgh2\",\"label\":\"logs(documents)\",\"alpha\":1,\"minZoom\":7,\"maxZoom\":24,\"sourceDescriptor\":{\"id\":\"541f2ca1-6a0f-4937-8846-a589222b7f28\",\"type\":\"ES_SEARCH\",\"indexPatternId\":\"90943e30-9a47-11e8-b64d-95841ca0b247\",\"geoField\":\"geo.coordinates\",\"limit\":2048,\"filterByMapBounds\":true,\"showTooltip\":true,\"tooltipProperties\":[\"timestamp\",\"clientip\",\"url\"]},\"visible\":true,\"temporary\":false,\"style\":{\"type\":\"VECTOR\",\"properties\":{\"fillColor\":{\"type\":\"STATIC\",\"options\":{\"color\":\"#e6194b\"}},\"lineColor\":{\"type\":\"STATIC\",\"options\":{\"color\":\"#FFFFFF\"}},\"lineWidth\":{\"type\":\"STATIC\",\"options\":{\"size\":1}},\"iconSize\":{\"type\":\"STATIC\",\"options\":{\"size\":10}},\"alphaValue\":0.75},\"previousStyle\":null},\"type\":\"VECTOR\"}]", "uiStateJSON" : "{\"isDarkMode\":false}", "bounds" : { "type" : "envelope", From a11e4714203ffecbac086770fb5267d6813c2fdd Mon Sep 17 00:00:00 2001 From: Jason Rhodes Date: Wed, 23 Jan 2019 13:46:09 -0500 Subject: [PATCH 08/29] Updates React et al to 16.6 (#24707) * Updates react to 16.6 (latest) * Updated fragment-based snapshots for Kibana root unit tests * Updated fragment-based snapshots for x-pack unit tests * Removed xpack yarn.lock file bc it is no longer needed, it was reintroduced by accident during a rebase in this branch * React 16.6 snapshot updates, round 2 (mostly Fragment snapshot diffs) * Updated last round of React 16.6 snapshots * Fixes query bar issue with 16.4 gDSFP lifecycle * Updated yarn lock (arraybuffer.slice updated) * Updates snapshots where executeQueryOptions prop appears --- package.json | 11 +- .../dashboard_listing.test.js.snap | 84 +- .../__snapshots__/home.test.js.snap | 30 +- .../recently_accessed.test.js.snap | 126 +- .../__snapshots__/tutorial.test.js.snap | 150 ++- .../create_index_pattern_wizard.test.js.snap | 24 +- .../__snapshots__/header.test.js.snap | 26 +- .../__jest__/__snapshots__/table.test.js.snap | 38 +- .../__snapshots__/flyout.test.js.snap | 74 +- .../__snapshots__/header.test.js.snap | 4 +- .../__snapshots__/relationships.test.js.snap | 514 ++++---- .../__jest__/__snapshots__/table.test.js.snap | 4 +- .../form/__snapshots__/form.test.js.snap | 394 +++--- .../search/__snapshots__/search.test.js.snap | 4 +- .../__snapshots__/new_vis_modal.test.tsx.snap | 1064 ++++++++++------- .../__snapshots__/field_editor.test.js.snap | 846 +++++++------ .../field_format_editor.test.js.snap | 6 +- .../bytes/__snapshots__/bytes.test.js.snap | 4 +- .../color/__snapshots__/color.test.js.snap | 12 +- .../date/__snapshots__/date.test.js.snap | 4 +- .../__snapshots__/duration.test.js.snap | 8 +- .../number/__snapshots__/number.test.js.snap | 4 +- .../__snapshots__/percent.test.js.snap | 4 +- .../__snapshots__/static_lookup.test.js.snap | 8 +- .../string/__snapshots__/string.test.js.snap | 4 +- .../__snapshots__/truncate.test.js.snap | 4 +- .../url/__snapshots__/url.test.js.snap | 12 +- .../disabled_call_out.test.js.snap | 4 +- .../warning_call_out.test.js.snap | 4 +- .../public/query_bar/components/query_bar.tsx | 3 +- .../url_panel_content.test.js.snap | 8 +- x-pack/package.json | 11 +- .../TransactionOverview.test.js.snap | 8 +- .../__snapshots__/HistoryTabs.test.tsx.snap | 4 +- .../__snapshots__/upload_license.test.js.snap | 478 +++++--- .../__snapshots__/form_label.test.js.snap | 8 +- .../actions_section.test.js.snap | 12 +- .../conditions_section.test.js.snap | 16 +- .../rule_editor_flyout.test.js.snap | 16 +- .../__snapshots__/scope_section.test.js.snap | 92 +- .../delete_rule_modal.test.js.snap | 12 +- .../explorer_chart_label.test.js.snap | 96 +- .../__snapshots__/editor.test.js.snap | 24 +- .../__snapshots__/list.test.js.snap | 4 +- .../__snapshots__/calendar_form.test.js.snap | 96 +- .../__snapshots__/events_table.test.js.snap | 8 +- .../__snapshots__/import_modal.test.js.snap | 4 +- .../imported_events.test.js.snap | 4 +- .../table/__snapshots__/table.test.js.snap | 4 +- .../edit/__snapshots__/header.test.js.snap | 128 +- .../edit/__snapshots__/toolbar.test.js.snap | 8 +- .../list/__snapshots__/header.test.js.snap | 4 +- .../list/__snapshots__/table.test.js.snap | 374 +++--- .../__snapshots__/ccr_shard.test.js.snap | 102 +- .../report_info_button.test.tsx.snap | 20 +- .../basic_login_form.test.tsx.snap | 4 +- .../collapsible_panel.test.tsx.snap | 14 +- .../elasticsearch_privileges.test.tsx.snap | 354 +++--- .../index_privilege_form.test.tsx.snap | 380 +++--- .../index_privileges.test.tsx.snap | 2 +- .../impacted_spaces_flyout.test.tsx.snap | 4 +- .../simple_privilege_form.test.tsx.snap | 4 +- .../space_aware_privilege_form.test.tsx.snap | 260 ++-- .../advanced_settings_subtitle.test.tsx.snap | 4 +- .../secure_space_message.test.tsx.snap | 4 +- .../delete_spaces_button.test.tsx.snap | 4 +- .../space_identifier.test.tsx.snap | 4 +- .../spaces_grid_pages.test.tsx.snap | 220 ++-- .../space_selector.test.tsx.snap | 30 +- .../__snapshots__/checkup_tab.test.tsx.snap | 686 ++++++----- .../__snapshots__/telemetry_form.test.js.snap | 4 +- yarn.lock | 185 ++- 72 files changed, 3734 insertions(+), 3444 deletions(-) diff --git a/package.json b/package.json index 1a4b99a1048b9..fb58309ea7a27 100644 --- a/package.json +++ b/package.json @@ -190,11 +190,11 @@ "pug": "^2.0.3", "querystring-browser": "1.0.4", "raw-loader": "0.5.1", - "react": "^16.3.0", + "react": "^16.6.0", "react-addons-shallow-compare": "15.6.2", "react-anything-sortable": "^1.7.4", "react-color": "^2.13.8", - "react-dom": "^16.3.0", + "react-dom": "^16.6.0", "react-grid-layout": "^0.16.2", "react-input-range": "^1.3.0", "react-markdown": "^3.1.4", @@ -324,9 +324,10 @@ "classnames": "2.2.5", "dedent": "^0.7.0", "delete-empty": "^2.0.0", - "enzyme": "3.2.0", - "enzyme-adapter-react-16": "^1.1.1", - "enzyme-to-json": "3.3.1", + "enzyme": "^3.7.0", + "enzyme-adapter-react-16": "^1.6.0", + "enzyme-adapter-utils": "^1.8.1", + "enzyme-to-json": "^3.3.4", "eslint": "^5.6.0", "eslint-config-prettier": "^3.1.0", "eslint-plugin-babel": "^5.2.0", diff --git a/src/legacy/core_plugins/kibana/public/dashboard/listing/__snapshots__/dashboard_listing.test.js.snap b/src/legacy/core_plugins/kibana/public/dashboard/listing/__snapshots__/dashboard_listing.test.js.snap index 7e03ebb675111..acb9ee97a6957 100644 --- a/src/legacy/core_plugins/kibana/public/dashboard/listing/__snapshots__/dashboard_listing.test.js.snap +++ b/src/legacy/core_plugins/kibana/public/dashboard/listing/__snapshots__/dashboard_listing.test.js.snap @@ -524,50 +524,48 @@ exports[`after fetch renders warning when listingLimit is exceeded 1`] = ` - - - } - > -

- - - , - "listingLimitText": - listingLimit - , - "listingLimitValue": 1, - "totalDashboards": 2, - } + + } + > +

+ + + , + "listingLimitText": + listingLimit + , + "listingLimitValue": 1, + "totalDashboards": 2, } - /> -

-
- -
+ } + /> +

+ + - - - - + + - - + - - - label0 - - - - - + + + - - - - - - + + + + - - - label1 - - - - + label1 + + + - -
- - Home - - / - - - Add data - - / - - jest test tutorial -
- -
+
+ + Home + + / + + + Add data + + / + + jest test tutorial +
+
- -
- - Home - - / - - - Add data - - / - - jest test tutorial -
- -
+
+ + Home + + / + + + Add data + + / + + jest test tutorial +
+
- -
- - Home - - / - - - Add data - - / - - jest test tutorial -
- -
+
+ + Home + + / + + + Add data + + / + + jest test tutorial +
+
+
- + `; exports[`CreateIndexPatternWizard renders index pattern step when there are indices 1`] = ` - +
- + `; exports[`CreateIndexPatternWizard renders the empty state when there are no indices 1`] = ` - +
- + `; exports[`CreateIndexPatternWizard renders time field step when step is set to 2 1`] = ` - +
- + `; exports[`CreateIndexPatternWizard renders when there are no indices but there are remote clusters 1`] = ` - +
- + `; exports[`CreateIndexPatternWizard shows system indices even if there are no other indices if the include system indices is toggled 1`] = ` - +
- + `; diff --git a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/create_index_pattern_wizard/components/header/__jest__/__snapshots__/header.test.js.snap b/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/create_index_pattern_wizard/components/header/__jest__/__snapshots__/header.test.js.snap index 02ba1ee8fc730..6d77035e82041 100644 --- a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/create_index_pattern_wizard/components/header/__jest__/__snapshots__/header.test.js.snap +++ b/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/create_index_pattern_wizard/components/header/__jest__/__snapshots__/header.test.js.snap @@ -16,13 +16,11 @@ exports[`Header should render a different name, prompt, and beta tag if provided } } /> - - - - + + - - -
- Test prompt -
-
+ +
+ Test prompt +
diff --git a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/source_filters_table/components/table/__jest__/__snapshots__/table.test.js.snap b/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/source_filters_table/components/table/__jest__/__snapshots__/table.test.js.snap index 8fc08181be4a1..80f44fbcb5d04 100644 --- a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/source_filters_table/components/table/__jest__/__snapshots__/table.test.js.snap +++ b/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/source_filters_table/components/table/__jest__/__snapshots__/table.test.js.snap @@ -2,26 +2,24 @@ exports[`Table editing should show a save button 1`] = `
- - - - + +
`; diff --git a/src/legacy/core_plugins/kibana/public/management/sections/objects/components/objects_table/components/flyout/__jest__/__snapshots__/flyout.test.js.snap b/src/legacy/core_plugins/kibana/public/management/sections/objects/components/objects_table/components/flyout/__jest__/__snapshots__/flyout.test.js.snap index 317cf1fc32564..03c36783f4c72 100644 --- a/src/legacy/core_plugins/kibana/public/management/sections/objects/components/objects_table/components/flyout/__jest__/__snapshots__/flyout.test.js.snap +++ b/src/legacy/core_plugins/kibana/public/management/sections/objects/components/objects_table/components/flyout/__jest__/__snapshots__/flyout.test.js.snap @@ -24,45 +24,43 @@ exports[`Flyout conflicts should allow conflict resolution 1`] = ` /> - - - - } - > -

- - - , - } + + + } + > +

+ + + , } - /> -

-
-
+ } + /> +

+ + - + `; diff --git a/src/legacy/core_plugins/kibana/public/management/sections/objects/components/objects_table/components/relationships/__jest__/__snapshots__/relationships.test.js.snap b/src/legacy/core_plugins/kibana/public/management/sections/objects/components/objects_table/components/relationships/__jest__/__snapshots__/relationships.test.js.snap index 5f10fa8eb10cf..957b5b3fb534c 100644 --- a/src/legacy/core_plugins/kibana/public/management/sections/objects/components/objects_table/components/relationships/__jest__/__snapshots__/relationships.test.js.snap +++ b/src/legacy/core_plugins/kibana/public/management/sections/objects/components/objects_table/components/relationships/__jest__/__snapshots__/relationships.test.js.snap @@ -40,77 +40,73 @@ exports[`Relationships should render dashboards normally 1`] = ` textStyle="normal" type="row" > - - } > - - } - > -

- -

-
-
- -
+

+ +

+ + +
@@ -248,142 +244,134 @@ exports[`Relationships should render searches normally 1`] = ` textStyle="normal" type="row" > - - } > - - } - > -

- -

-
-
- + +

+ + + + -
- - } > - - } - > -

- -

-
-
- -
+

+ +

+ + + @@ -429,77 +417,73 @@ exports[`Relationships should render visualizations normally 1`] = ` textStyle="normal" type="row" > - - } > - - } - > -

- -

-
-
- -
+

+ +

+ + + diff --git a/src/legacy/core_plugins/kibana/public/management/sections/objects/components/objects_table/components/table/__jest__/__snapshots__/table.test.js.snap b/src/legacy/core_plugins/kibana/public/management/sections/objects/components/objects_table/components/table/__jest__/__snapshots__/table.test.js.snap index d3ca955a95a54..55a6c904d55f8 100644 --- a/src/legacy/core_plugins/kibana/public/management/sections/objects/components/objects_table/components/table/__jest__/__snapshots__/table.test.js.snap +++ b/src/legacy/core_plugins/kibana/public/management/sections/objects/components/objects_table/components/table/__jest__/__snapshots__/table.test.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`Table should render normally 1`] = ` - +
-
+ `; diff --git a/src/legacy/core_plugins/kibana/public/management/sections/settings/components/form/__snapshots__/form.test.js.snap b/src/legacy/core_plugins/kibana/public/management/sections/settings/components/form/__snapshots__/form.test.js.snap index 3f5625a19b66c..41455f90a6baf 100644 --- a/src/legacy/core_plugins/kibana/public/management/sections/settings/components/form/__snapshots__/form.test.js.snap +++ b/src/legacy/core_plugins/kibana/public/management/sections/settings/components/form/__snapshots__/form.test.js.snap @@ -1,9 +1,9 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`Form should not render no settings message when instructed not to 1`] = ``; +exports[`Form should not render no settings message when instructed not to 1`] = ``; exports[`Form should render no settings message when there are no settings 1`] = ` - + - + `; exports[`Form should render normally 1`] = ` - - + - - - + + - - -

- General -

-
-
-
- - + General + + + +
+ + - + -
-
- -
- + + + + - - - + + - - -

- Dashboard -

-
-
-
- - + Dashboard + + + +
+ + -
-
- -
- + + + + - - - + + - +

+ X-pack +

+ + - -

- X-pack -

-
- - - - - - - , - "settingsCount": 9, - } + + + + + + , + "settingsCount": 9, } - /> - - -
-
- - + + + +
+ + -
-
- -
-
+ } + /> + + + + `; diff --git a/src/legacy/core_plugins/kibana/public/management/sections/settings/components/search/__snapshots__/search.test.js.snap b/src/legacy/core_plugins/kibana/public/management/sections/settings/components/search/__snapshots__/search.test.js.snap index cdfc62c5134b8..70ad5b3819a88 100644 --- a/src/legacy/core_plugins/kibana/public/management/sections/settings/components/search/__snapshots__/search.test.js.snap +++ b/src/legacy/core_plugins/kibana/public/management/sections/settings/components/search/__snapshots__/search.test.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`Search should render normally 1`] = ` - + - + `; diff --git a/src/legacy/core_plugins/kibana/public/visualize/wizard/__snapshots__/new_vis_modal.test.tsx.snap b/src/legacy/core_plugins/kibana/public/visualize/wizard/__snapshots__/new_vis_modal.test.tsx.snap index 5caafbdcd6484..84a6749eae4c1 100644 --- a/src/legacy/core_plugins/kibana/public/visualize/wizard/__snapshots__/new_vis_modal.test.tsx.snap +++ b/src/legacy/core_plugins/kibana/public/visualize/wizard/__snapshots__/new_vis_modal.test.tsx.snap @@ -229,66 +229,263 @@ exports[`NewVisModal should render as expected 1`] = ` } > - +
+
+ +
+
+
+ New Visualization +
+
+
+
+
+
+
+
+
+ +
+ + + +
+
+
+
+
+ +
+
+
+
+

+ Select a visualization type +

+
+
+

+ Start creating your visualization by selecting a type for that visualization. +

+
+
+
+
+
+
+
+
+ } > - -
-
- +
+
- - -
- - -
- - - -
-
-
+ + + + + +
+ - +
- +
- -
+
+ +
+ +
+ +
+ +
+ - -
- - -
- - - - -
- + + + +
- - - - -
-
+ + + + +
+
+
+
-
- - -
-
- -
+ +
+
+ - -
- - Vis Type 1 - - } - onBlur={[Function]} - onClick={[Function]} - onFocus={[Function]} - onMouseEnter={[Function]} - onMouseLeave={[Function]} +
-
- -
- - Vis with search - - } - onBlur={[Function]} - onClick={[Function]} - onFocus={[Function]} - onMouseEnter={[Function]} - onMouseLeave={[Function]} - > -
+ + + + Vis with search + + } onBlur={[Function]} onClick={[Function]} onFocus={[Function]} onMouseEnter={[Function]} onMouseLeave={[Function]} - type="button" > -
- - - -
-

- + + + + +

+

- Vis with search - -

-
- - -
- -
- -
- -
- - -
+ Vis with search + +

+
+ + +
+ +
+ +
+ +
+ + - -

- - Select a visualization type - -

-
- -
- - - + Select a visualization type + + + +
+ + + -

- - Start creating your visualization by selecting a type for that visualization. - -

-
-
-
-
-
-
- -
- +
+

+ + Start creating your visualization by selecting a type for that visualization. + +

+
+ + +
+ +
+ +
+ +
-
- - + + + diff --git a/src/ui/public/field_editor/__snapshots__/field_editor.test.js.snap b/src/ui/public/field_editor/__snapshots__/field_editor.test.js.snap index 38bc79e4bab3f..68255e74fa46f 100644 --- a/src/ui/public/field_editor/__snapshots__/field_editor.test.js.snap +++ b/src/ui/public/field_editor/__snapshots__/field_editor.test.js.snap @@ -15,29 +15,27 @@ exports[`FieldEditor should render create new scripted field correctly 1`] = ` size="m" /> - - - - + + - + } + isVisible={false} + lang="painless" + onClose={[Function]} + /> - - - } - label={ - - Test format - , - } + + } + label={ + + Test format + , } - /> - } - > - - - + } + > + + @@ -153,47 +149,43 @@ exports[`FieldEditor should render create new scripted field correctly 1`] = ` onChange={[Function]} /> - - + + + + + + doc['some_field'].value + , + } + } + /> + +
+ - -
- - - - - doc['some_field'].value - , - } - } - /> - -
- - - -
-
-
+ + - - - - + + - + } + isVisible={false} + lang="painless" + name="test" + onClose={[Function]} + script="doc.test.value" + /> - - - } - label={ - - Test format - , - } + + } + label={ + + Test format + , } - /> - } - > - - - + } + > + + @@ -389,48 +377,44 @@ exports[`FieldEditor should render edit scripted field correctly 1`] = ` onChange={[Function]} /> - - + + + + + + doc['some_field'].value + , + } + } + /> + +
+ - -
- - - - - doc['some_field'].value - , - } - } - /> - -
- - - -
-
-
+ + - - - - + + - + } + isVisible={false} + lang="painless" + name="foobar" + onClose={[Function]} + /> - - - } - label={ - - Test format - , - } + + } + label={ + + Test format + , } - /> - } - > - - - + } + > + + @@ -690,47 +670,43 @@ exports[`FieldEditor should show conflict field warning 1`] = ` onChange={[Function]} /> - - + + + + + + doc['some_field'].value + , + } + } + /> + +
+ - -
- - - - - doc['some_field'].value - , - } - } - /> - -
- - - -
-
-
+ + - - - - + + - + } + isVisible={false} + lang="testlang" + name="test" + onClose={[Function]} + script="doc.test.value" + /> @@ -963,47 +937,45 @@ exports[`FieldEditor should show deprecated lang warning 1`] = ` value="number" /> - - - } - label={ - - Test format - , - } + + } + label={ + + Test format + , } - /> - } - > - - - + } + > + + @@ -1012,48 +984,44 @@ exports[`FieldEditor should show deprecated lang warning 1`] = ` onChange={[Function]} /> - - + + + + + + doc['some_field'].value + , + } + } + /> + +
+ - -
- - - - - doc['some_field'].value - , - } - } - /> - -
- - - -
-
-
+ + + - + `; -exports[`FieldFormatEditor should render nothing if there is no editor for the format 1`] = ``; +exports[`FieldFormatEditor should render nothing if there is no editor for the format 1`] = ``; diff --git a/src/ui/public/field_editor/components/field_format_editor/editors/bytes/__snapshots__/bytes.test.js.snap b/src/ui/public/field_editor/components/field_format_editor/editors/bytes/__snapshots__/bytes.test.js.snap index 480d65ae01f4a..38b3890005a98 100644 --- a/src/ui/public/field_editor/components/field_format_editor/editors/bytes/__snapshots__/bytes.test.js.snap +++ b/src/ui/public/field_editor/components/field_format_editor/editors/bytes/__snapshots__/bytes.test.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`BytesFormatEditor should render normally 1`] = ` - + - + `; diff --git a/src/ui/public/field_editor/components/field_format_editor/editors/color/__snapshots__/color.test.js.snap b/src/ui/public/field_editor/components/field_format_editor/editors/color/__snapshots__/color.test.js.snap index 299a9f91ac705..0a2ba6a12ce43 100644 --- a/src/ui/public/field_editor/components/field_format_editor/editors/color/__snapshots__/color.test.js.snap +++ b/src/ui/public/field_editor/components/field_format_editor/editors/color/__snapshots__/color.test.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`ColorFormatEditorComponent should render multiple colors 1`] = ` - + - + `; exports[`ColorFormatEditorComponent should render other type normally (range field) 1`] = ` - + - + `; exports[`ColorFormatEditorComponent should render string type normally (regex field) 1`] = ` - + - + `; diff --git a/src/ui/public/field_editor/components/field_format_editor/editors/date/__snapshots__/date.test.js.snap b/src/ui/public/field_editor/components/field_format_editor/editors/date/__snapshots__/date.test.js.snap index 59481cd6e19a5..7502b03af40c6 100644 --- a/src/ui/public/field_editor/components/field_format_editor/editors/date/__snapshots__/date.test.js.snap +++ b/src/ui/public/field_editor/components/field_format_editor/editors/date/__snapshots__/date.test.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`DateFormatEditor should render normally 1`] = ` - + - + `; diff --git a/src/ui/public/field_editor/components/field_format_editor/editors/duration/__snapshots__/duration.test.js.snap b/src/ui/public/field_editor/components/field_format_editor/editors/duration/__snapshots__/duration.test.js.snap index 1381973452a1e..438e3a3c9932b 100644 --- a/src/ui/public/field_editor/components/field_format_editor/editors/duration/__snapshots__/duration.test.js.snap +++ b/src/ui/public/field_editor/components/field_format_editor/editors/duration/__snapshots__/duration.test.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`DurationFormatEditor should render human readable output normally 1`] = ` - + - + `; exports[`DurationFormatEditor should render non-human readable output normally 1`] = ` - + - + `; diff --git a/src/ui/public/field_editor/components/field_format_editor/editors/number/__snapshots__/number.test.js.snap b/src/ui/public/field_editor/components/field_format_editor/editors/number/__snapshots__/number.test.js.snap index 7f07331c77994..97947f01612c3 100644 --- a/src/ui/public/field_editor/components/field_format_editor/editors/number/__snapshots__/number.test.js.snap +++ b/src/ui/public/field_editor/components/field_format_editor/editors/number/__snapshots__/number.test.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`NumberFormatEditor should render normally 1`] = ` - + - + `; diff --git a/src/ui/public/field_editor/components/field_format_editor/editors/percent/__snapshots__/percent.test.js.snap b/src/ui/public/field_editor/components/field_format_editor/editors/percent/__snapshots__/percent.test.js.snap index f0ee8f15d509b..a04f27cacf59e 100644 --- a/src/ui/public/field_editor/components/field_format_editor/editors/percent/__snapshots__/percent.test.js.snap +++ b/src/ui/public/field_editor/components/field_format_editor/editors/percent/__snapshots__/percent.test.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`PercentFormatEditor should render normally 1`] = ` - + - + `; diff --git a/src/ui/public/field_editor/components/field_format_editor/editors/static_lookup/__snapshots__/static_lookup.test.js.snap b/src/ui/public/field_editor/components/field_format_editor/editors/static_lookup/__snapshots__/static_lookup.test.js.snap index 31ac15c41eb8e..68a7a03e47c10 100644 --- a/src/ui/public/field_editor/components/field_format_editor/editors/static_lookup/__snapshots__/static_lookup.test.js.snap +++ b/src/ui/public/field_editor/components/field_format_editor/editors/static_lookup/__snapshots__/static_lookup.test.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`StaticLookupFormatEditorComponent should render multiple lookup entries and unknown key value 1`] = ` - + - + `; exports[`StaticLookupFormatEditorComponent should render normally 1`] = ` - + - + `; diff --git a/src/ui/public/field_editor/components/field_format_editor/editors/string/__snapshots__/string.test.js.snap b/src/ui/public/field_editor/components/field_format_editor/editors/string/__snapshots__/string.test.js.snap index 17089261bd2fc..537c31f64d5f0 100644 --- a/src/ui/public/field_editor/components/field_format_editor/editors/string/__snapshots__/string.test.js.snap +++ b/src/ui/public/field_editor/components/field_format_editor/editors/string/__snapshots__/string.test.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`StringFormatEditor should render normally 1`] = ` - + - + `; diff --git a/src/ui/public/field_editor/components/field_format_editor/editors/truncate/__snapshots__/truncate.test.js.snap b/src/ui/public/field_editor/components/field_format_editor/editors/truncate/__snapshots__/truncate.test.js.snap index e6aa80cb39dca..d6651e5568d58 100644 --- a/src/ui/public/field_editor/components/field_format_editor/editors/truncate/__snapshots__/truncate.test.js.snap +++ b/src/ui/public/field_editor/components/field_format_editor/editors/truncate/__snapshots__/truncate.test.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`TruncateFormatEditor should render normally 1`] = ` - + - + `; diff --git a/src/ui/public/field_editor/components/field_format_editor/editors/url/__snapshots__/url.test.js.snap b/src/ui/public/field_editor/components/field_format_editor/editors/url/__snapshots__/url.test.js.snap index 923b92eeaf47a..20d42c19f04bd 100644 --- a/src/ui/public/field_editor/components/field_format_editor/editors/url/__snapshots__/url.test.js.snap +++ b/src/ui/public/field_editor/components/field_format_editor/editors/url/__snapshots__/url.test.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`UrlFormatEditor should render label template help 1`] = ` - + - + `; exports[`UrlFormatEditor should render normally 1`] = ` - + - + `; exports[`UrlFormatEditor should render url template help 1`] = ` - + - + `; diff --git a/src/ui/public/field_editor/components/scripting_call_outs/__snapshots__/disabled_call_out.test.js.snap b/src/ui/public/field_editor/components/scripting_call_outs/__snapshots__/disabled_call_out.test.js.snap index d2e4a89bc9b45..7aeade16748ee 100644 --- a/src/ui/public/field_editor/components/scripting_call_outs/__snapshots__/disabled_call_out.test.js.snap +++ b/src/ui/public/field_editor/components/scripting_call_outs/__snapshots__/disabled_call_out.test.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`ScriptingDisabledCallOut should render normally 1`] = ` - + - + `; exports[`ScriptingDisabledCallOut should render nothing if not visible 1`] = `""`; diff --git a/src/ui/public/field_editor/components/scripting_call_outs/__snapshots__/warning_call_out.test.js.snap b/src/ui/public/field_editor/components/scripting_call_outs/__snapshots__/warning_call_out.test.js.snap index e9bbdf801d1fb..790ed21d44cda 100644 --- a/src/ui/public/field_editor/components/scripting_call_outs/__snapshots__/warning_call_out.test.js.snap +++ b/src/ui/public/field_editor/components/scripting_call_outs/__snapshots__/warning_call_out.test.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`ScriptingWarningCallOut should render normally 1`] = ` - + - + `; exports[`ScriptingWarningCallOut should render nothing if not visible 1`] = `""`; diff --git a/src/ui/public/query_bar/components/query_bar.tsx b/src/ui/public/query_bar/components/query_bar.tsx index 02f240ffc352b..af91fea37eb43 100644 --- a/src/ui/public/query_bar/components/query_bar.tsx +++ b/src/ui/public/query_bar/components/query_bar.tsx @@ -110,7 +110,7 @@ export class QueryBarUI extends Component { }; } - return null; + return { currentProps: nextProps }; } /* @@ -132,6 +132,7 @@ export class QueryBarUI extends Component { }, inputIsPristine: true, isSuggestionsVisible: false, + currentProps: this.props, index: null, suggestions: [], suggestionLimit: 50, diff --git a/src/ui/public/share/components/__snapshots__/url_panel_content.test.js.snap b/src/ui/public/share/components/__snapshots__/url_panel_content.test.js.snap index 05669cf36e2dc..1b0c705db40e3 100644 --- a/src/ui/public/share/components/__snapshots__/url_panel_content.test.js.snap +++ b/src/ui/public/share/components/__snapshots__/url_panel_content.test.js.snap @@ -186,7 +186,9 @@ exports[`render 1`] = ` afterMessage="Copied" anchorClassName="sharePanel__copyAnchor" textToCopy="http://localhost/" - /> + > + + `; @@ -365,6 +367,8 @@ exports[`should enable saved object export option when objectId is provided 1`] afterMessage="Copied" anchorClassName="sharePanel__copyAnchor" textToCopy="http://localhost/" - /> + > + + `; diff --git a/x-pack/package.json b/x-pack/package.json index 2b21a858a6827..30f47b109994f 100644 --- a/x-pack/package.json +++ b/x-pack/package.json @@ -73,9 +73,10 @@ "copy-webpack-plugin": "^4.5.2", "del": "^3.0.0", "dotenv": "2.0.0", - "enzyme": "3.2.0", - "enzyme-adapter-react-16": "^1.1.1", - "enzyme-to-json": "3.3.1", + "enzyme": "^3.7.0", + "enzyme-adapter-react-16": "^1.6.0", + "enzyme-adapter-utils": "^1.8.1", + "enzyme-to-json": "^3.3.4", "expect.js": "0.3.1", "fancy-log": "^1.3.2", "fetch-mock": "7.3.0", @@ -220,12 +221,12 @@ "puid": "1.0.5", "puppeteer-core": "^1.7.0", "raw-loader": "0.5.1", - "react": "^16.3.0", + "react": "^16.6.0", "react-apollo": "^2.1.4", "react-beautiful-dnd": "^8.0.7", "react-clipboard.js": "^1.1.2", "react-datetime": "^2.14.0", - "react-dom": "^16.3.0", + "react-dom": "^16.6.0", "react-dropzone": "^4.2.9", "react-markdown-renderer": "^1.4.0", "react-portal": "^3.2.0", diff --git a/x-pack/plugins/apm/public/components/app/TransactionOverview/__jest__/__snapshots__/TransactionOverview.test.js.snap b/x-pack/plugins/apm/public/components/app/TransactionOverview/__jest__/__snapshots__/TransactionOverview.test.js.snap index d960d846a1da9..cc5c169bbda11 100644 --- a/x-pack/plugins/apm/public/components/app/TransactionOverview/__jest__/__snapshots__/TransactionOverview.test.js.snap +++ b/x-pack/plugins/apm/public/components/app/TransactionOverview/__jest__/__snapshots__/TransactionOverview.test.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`TransactionOverviewView should render with type filter controls 1`] = ` - + - + `; exports[`TransactionOverviewView should render without type filter controls if there is just a single type 1`] = ` - + - + `; diff --git a/x-pack/plugins/apm/public/components/shared/HistoryTabs/__test__/__snapshots__/HistoryTabs.test.tsx.snap b/x-pack/plugins/apm/public/components/shared/HistoryTabs/__test__/__snapshots__/HistoryTabs.test.tsx.snap index 3e4c0b0656578..f9ed76ec38cd3 100644 --- a/x-pack/plugins/apm/public/components/shared/HistoryTabs/__test__/__snapshots__/HistoryTabs.test.tsx.snap +++ b/x-pack/plugins/apm/public/components/shared/HistoryTabs/__test__/__snapshots__/HistoryTabs.test.tsx.snap @@ -21,7 +21,7 @@ exports[`HistoryTabs should change the selected item on tab click 2`] = ` `; exports[`HistoryTabs should render correctly 1`] = ` - + - + `; diff --git a/x-pack/plugins/license_management/__jest__/__snapshots__/upload_license.test.js.snap b/x-pack/plugins/license_management/__jest__/__snapshots__/upload_license.test.js.snap index 46b1c5be7eef3..b2ea097186891 100644 --- a/x-pack/plugins/license_management/__jest__/__snapshots__/upload_license.test.js.snap +++ b/x-pack/plugins/license_management/__jest__/__snapshots__/upload_license.test.js.snap @@ -175,83 +175,180 @@ exports[`UploadLicense should display a modal when license requires acknowledgem />
- - } - confirmButtonText={ - - } - onCancel={[Function]} - onConfirm={[Function]} - title={ - - } - > - -
- - +
+
+
+ Confirm License Upload +
+
+
+
+
+
+ Some functionality will be lost if you replace your TRIAL license with a BASIC license. Review the list of features below. +
+
+
    +
  • + Watcher will be disabled +
  • +
+
+
+
+
+
+ + +
+
+
+
+
+ } + > + + } + confirmButtonText={ + + } + onCancel={[Function]} + onConfirm={[Function]} + title={ + + } + > + + +
+
+ - - - -
- -
-
- - -
- +
+ + +
- - - - - -
-
+ + +
+ +
- -
-
-
+ + + + + `; exports[`FormLabel Full initialization 1`] = ` - + + `; diff --git a/x-pack/plugins/ml/public/components/rule_editor/__snapshots__/actions_section.test.js.snap b/x-pack/plugins/ml/public/components/rule_editor/__snapshots__/actions_section.test.js.snap index 36fe079f33ddc..13dda08db4187 100644 --- a/x-pack/plugins/ml/public/components/rule_editor/__snapshots__/actions_section.test.js.snap +++ b/x-pack/plugins/ml/public/components/rule_editor/__snapshots__/actions_section.test.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`ActionsSection renders with no actions selected 1`] = ` - + - + `; exports[`ActionsSection renders with skip_result and skip_model_update selected 1`] = ` - + - + `; exports[`ActionsSection renders with skip_result selected 1`] = ` - + - + `; diff --git a/x-pack/plugins/ml/public/components/rule_editor/__snapshots__/conditions_section.test.js.snap b/x-pack/plugins/ml/public/components/rule_editor/__snapshots__/conditions_section.test.js.snap index a3c9364d96740..839a18efdb67c 100644 --- a/x-pack/plugins/ml/public/components/rule_editor/__snapshots__/conditions_section.test.js.snap +++ b/x-pack/plugins/ml/public/components/rule_editor/__snapshots__/conditions_section.test.js.snap @@ -5,7 +5,7 @@ exports[`ConditionsSectionExpression don't render when not enabled with conditio exports[`ConditionsSectionExpression don't render when the section is not enabled 1`] = `""`; exports[`ConditionsSectionExpression renders when enabled with empty conditions supplied 1`] = ` - + @@ -21,11 +21,11 @@ exports[`ConditionsSectionExpression renders when enabled with empty conditions values={Object {}} /> - + `; exports[`ConditionsSectionExpression renders when enabled with no conditions supplied 1`] = ` - + @@ -41,11 +41,11 @@ exports[`ConditionsSectionExpression renders when enabled with no conditions sup values={Object {}} /> - + `; exports[`ConditionsSectionExpression renders when enabled with one condition 1`] = ` - + - + `; exports[`ConditionsSectionExpression renders when enabled with two conditions 1`] = ` - + - + `; diff --git a/x-pack/plugins/ml/public/components/rule_editor/__snapshots__/rule_editor_flyout.test.js.snap b/x-pack/plugins/ml/public/components/rule_editor/__snapshots__/rule_editor_flyout.test.js.snap index 077b3cb9de824..fe592b0b0f7bc 100644 --- a/x-pack/plugins/ml/public/components/rule_editor/__snapshots__/rule_editor_flyout.test.js.snap +++ b/x-pack/plugins/ml/public/components/rule_editor/__snapshots__/rule_editor_flyout.test.js.snap @@ -5,7 +5,7 @@ exports[`RuleEditorFlyout don't render after closing the flyout 1`] = `""`; exports[`RuleEditorFlyout don't render when not opened 1`] = `""`; exports[`RuleEditorFlyout renders the flyout after adding a condition to a rule 1`] = ` - + - + `; exports[`RuleEditorFlyout renders the flyout after setting the rule to edit 1`] = ` - + - + `; exports[`RuleEditorFlyout renders the flyout for creating a rule with conditions only 1`] = ` - + - + `; exports[`RuleEditorFlyout renders the select action component for a detector with a rule 1`] = ` - + - + `; diff --git a/x-pack/plugins/ml/public/components/rule_editor/__snapshots__/scope_section.test.js.snap b/x-pack/plugins/ml/public/components/rule_editor/__snapshots__/scope_section.test.js.snap index 243771b04b05b..89f1898217958 100644 --- a/x-pack/plugins/ml/public/components/rule_editor/__snapshots__/scope_section.test.js.snap +++ b/x-pack/plugins/ml/public/components/rule_editor/__snapshots__/scope_section.test.js.snap @@ -3,7 +3,7 @@ exports[`ScopeSection don't render when no partitioning fields 1`] = `""`; exports[`ScopeSection false canGetFilters privilege show NoPermissionCallOut when no filter list IDs 1`] = ` - + - - - + - + `; exports[`ScopeSection renders when enabled with no scope supplied 1`] = ` - + - - - + - + `; exports[`ScopeSection renders when enabled with scope supplied 1`] = ` - + - - - + - + `; exports[`ScopeSection renders when not enabled 1`] = ` - + - + `; exports[`ScopeSection show NoFilterListsCallOut when no filter list IDs 1`] = ` - + - - - + - + `; diff --git a/x-pack/plugins/ml/public/components/rule_editor/select_rule_action/__snapshots__/delete_rule_modal.test.js.snap b/x-pack/plugins/ml/public/components/rule_editor/select_rule_action/__snapshots__/delete_rule_modal.test.js.snap index 9d9fe4082ec91..37be903bc85b2 100644 --- a/x-pack/plugins/ml/public/components/rule_editor/select_rule_action/__snapshots__/delete_rule_modal.test.js.snap +++ b/x-pack/plugins/ml/public/components/rule_editor/select_rule_action/__snapshots__/delete_rule_modal.test.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`DeleteRuleModal renders as delete button after opening and closing modal 1`] = ` - + - + `; exports[`DeleteRuleModal renders as delete button when not visible 1`] = ` - + - + `; exports[`DeleteRuleModal renders modal after clicking delete rule link 1`] = ` - + - + `; diff --git a/x-pack/plugins/ml/public/explorer/explorer_charts/components/explorer_chart_label/__snapshots__/explorer_chart_label.test.js.snap b/x-pack/plugins/ml/public/explorer/explorer_charts/components/explorer_chart_label/__snapshots__/explorer_chart_label.test.js.snap index 05150c9925afc..6b6930fe40ccf 100644 --- a/x-pack/plugins/ml/public/explorer/explorer_charts/components/explorer_chart_label/__snapshots__/explorer_chart_label.test.js.snap +++ b/x-pack/plugins/ml/public/explorer/explorer_charts/components/explorer_chart_label/__snapshots__/explorer_chart_label.test.js.snap @@ -1,77 +1,67 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`ExplorerChartLabelBadge Render the chart label in one line. 1`] = ` - + - - high_sum(nginx.access.body_sent.bytes) over nginx.access.remote_ip (population-03) - - -  –  - + high_sum(nginx.access.body_sent.bytes) over nginx.access.remote_ip (population-03) +  –  - - + + + } - key="nginx.access.remote_ip 72.57.0.53" + position="top" + size="s" + type="questionInCircle" /> - - - - } - position="top" - size="s" - type="questionInCircle" - /> - - + - + `; exports[`ExplorerChartLabelBadge Render the chart label in two lines. 1`] = ` - + - - high_sum(nginx.access.body_sent.bytes) over nginx.access.remote_ip (population-03) - - -   - + high_sum(nginx.access.body_sent.bytes) over nginx.access.remote_ip (population-03) +   - + `; diff --git a/x-pack/plugins/ml/public/jobs/components/custom_url_editor/__snapshots__/editor.test.js.snap b/x-pack/plugins/ml/public/jobs/components/custom_url_editor/__snapshots__/editor.test.js.snap index 6d2563b8a19c5..91a671f095f55 100644 --- a/x-pack/plugins/ml/public/jobs/components/custom_url_editor/__snapshots__/editor.test.js.snap +++ b/x-pack/plugins/ml/public/jobs/components/custom_url_editor/__snapshots__/editor.test.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`CustomUrlEditor renders the editor for a dashboard type URL with a label 1`] = ` - + - + `; exports[`CustomUrlEditor renders the editor for a discover type URL with an entity and empty time range interval 1`] = ` - + - + `; exports[`CustomUrlEditor renders the editor for a discover type URL with valid time range interval 1`] = ` - + - + `; exports[`CustomUrlEditor renders the editor for a new dashboard type URL with no label 1`] = ` - + - + `; exports[`CustomUrlEditor renders the editor for other type of URL with duplicate label 1`] = ` - + - + `; exports[`CustomUrlEditor renders the editor for other type of URL with unique label 1`] = ` - + - + `; diff --git a/x-pack/plugins/ml/public/jobs/components/custom_url_editor/__snapshots__/list.test.js.snap b/x-pack/plugins/ml/public/jobs/components/custom_url_editor/__snapshots__/list.test.js.snap index dd76563bc7b76..a7cafe60fb63f 100644 --- a/x-pack/plugins/ml/public/jobs/components/custom_url_editor/__snapshots__/list.test.js.snap +++ b/x-pack/plugins/ml/public/jobs/components/custom_url_editor/__snapshots__/list.test.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`CustomUrlList renders a list of custom URLs 1`] = ` - + - + `; diff --git a/x-pack/plugins/ml/public/settings/calendars/edit/calendar_form/__snapshots__/calendar_form.test.js.snap b/x-pack/plugins/ml/public/settings/calendars/edit/calendar_form/__snapshots__/calendar_form.test.js.snap index 7814870fa8aae..2e0f8bca89a5a 100644 --- a/x-pack/plugins/ml/public/settings/calendars/edit/calendar_form/__snapshots__/calendar_form.test.js.snap +++ b/x-pack/plugins/ml/public/settings/calendars/edit/calendar_form/__snapshots__/calendar_form.test.js.snap @@ -25,58 +25,56 @@ exports[`CalendarForm CalendarId shown as title when editing 1`] = ` exports[`CalendarForm Renders calendar form 1`] = ` - - - } - > - - - + - } - > - + + - - + } + > + + + @@ -65,11 +65,11 @@ exports[`EventsTable Renders events table with no search bar 1`] = ` } } /> - + `; exports[`EventsTable Renders events table with search bar 1`] = ` - + @@ -177,5 +177,5 @@ exports[`EventsTable Renders events table with search bar 1`] = ` } } /> - + `; diff --git a/x-pack/plugins/ml/public/settings/calendars/edit/import_modal/__snapshots__/import_modal.test.js.snap b/x-pack/plugins/ml/public/settings/calendars/edit/import_modal/__snapshots__/import_modal.test.js.snap index 45c1bfc53b549..0d1bc10a13f92 100644 --- a/x-pack/plugins/ml/public/settings/calendars/edit/import_modal/__snapshots__/import_modal.test.js.snap +++ b/x-pack/plugins/ml/public/settings/calendars/edit/import_modal/__snapshots__/import_modal.test.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`ImportModal Renders import modal 1`] = ` - + - + `; diff --git a/x-pack/plugins/ml/public/settings/calendars/edit/imported_events/__snapshots__/imported_events.test.js.snap b/x-pack/plugins/ml/public/settings/calendars/edit/imported_events/__snapshots__/imported_events.test.js.snap index 3db746ce38758..d2773bb09c6e1 100644 --- a/x-pack/plugins/ml/public/settings/calendars/edit/imported_events/__snapshots__/imported_events.test.js.snap +++ b/x-pack/plugins/ml/public/settings/calendars/edit/imported_events/__snapshots__/imported_events.test.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`ImportedEvents Renders imported events 1`] = ` - + @@ -68,5 +68,5 @@ exports[`ImportedEvents Renders imported events 1`] = ` onChange={[MockFunction]} /> - + `; diff --git a/x-pack/plugins/ml/public/settings/calendars/list/table/__snapshots__/table.test.js.snap b/x-pack/plugins/ml/public/settings/calendars/list/table/__snapshots__/table.test.js.snap index a2c09dc7f5162..7ac8b56ba9469 100644 --- a/x-pack/plugins/ml/public/settings/calendars/list/table/__snapshots__/table.test.js.snap +++ b/x-pack/plugins/ml/public/settings/calendars/list/table/__snapshots__/table.test.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`CalendarsListTable renders the table with all calendars 1`] = ` - + - + `; diff --git a/x-pack/plugins/ml/public/settings/filter_lists/edit/__snapshots__/header.test.js.snap b/x-pack/plugins/ml/public/settings/filter_lists/edit/__snapshots__/header.test.js.snap index 101a65c499856..39e3fcf066362 100644 --- a/x-pack/plugins/ml/public/settings/filter_lists/edit/__snapshots__/header.test.js.snap +++ b/x-pack/plugins/ml/public/settings/filter_lists/edit/__snapshots__/header.test.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`EditFilterListHeader renders the header when creating a new filter list with ID, description and items set 1`] = ` - + - + `; exports[`EditFilterListHeader renders the header when creating a new filter list with the ID not set 1`] = ` - + - + `; exports[`EditFilterListHeader renders the header when editing an existing unused filter list with no description or items 1`] = ` - + - - -

- -

-
- -
-
+ +

+ +

+
+ + `; exports[`EditFilterListHeader renders the header when editing an existing used filter list with description and items set 1`] = ` - + - -
+ - - - - - - - - + + + -
- + -
-
+ + + `; diff --git a/x-pack/plugins/ml/public/settings/filter_lists/edit/__snapshots__/toolbar.test.js.snap b/x-pack/plugins/ml/public/settings/filter_lists/edit/__snapshots__/toolbar.test.js.snap index f286a971aea7a..fd87730372ad3 100644 --- a/x-pack/plugins/ml/public/settings/filter_lists/edit/__snapshots__/toolbar.test.js.snap +++ b/x-pack/plugins/ml/public/settings/filter_lists/edit/__snapshots__/toolbar.test.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`EditFilterListToolbar renders the toolbar with no items selected 1`] = ` - + - + `; exports[`EditFilterListToolbar renders the toolbar with one item selected 1`] = ` - + - + `; diff --git a/x-pack/plugins/ml/public/settings/filter_lists/list/__snapshots__/header.test.js.snap b/x-pack/plugins/ml/public/settings/filter_lists/list/__snapshots__/header.test.js.snap index 27ac7dafaa27f..08763ad9d5f29 100644 --- a/x-pack/plugins/ml/public/settings/filter_lists/list/__snapshots__/header.test.js.snap +++ b/x-pack/plugins/ml/public/settings/filter_lists/list/__snapshots__/header.test.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`Filter Lists Header renders header 1`] = ` - + - + `; diff --git a/x-pack/plugins/ml/public/settings/filter_lists/list/__snapshots__/table.test.js.snap b/x-pack/plugins/ml/public/settings/filter_lists/list/__snapshots__/table.test.js.snap index 4f264c00980f2..dfed87f5c1fc7 100644 --- a/x-pack/plugins/ml/public/settings/filter_lists/list/__snapshots__/table.test.js.snap +++ b/x-pack/plugins/ml/public/settings/filter_lists/list/__snapshots__/table.test.js.snap @@ -1,205 +1,201 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`Filter Lists Table renders with filter lists and selection supplied 1`] = ` - - - + , - , + , - ], - } + }, + ] + } + />, + ], } - selection={ - Object { - "onSelectionChange": [Function], - "selectable": [Function], - "selectableMessage": [Function], - } + } + selection={ + Object { + "onSelectionChange": [Function], + "selectable": [Function], + "selectableMessage": [Function], } - sorting={ - Object { - "sort": Object { - "direction": "asc", - "field": "filter_id", - }, - } + } + sorting={ + Object { + "sort": Object { + "direction": "asc", + "field": "filter_id", + }, } - /> - - + } + /> + `; exports[`Filter Lists Table renders with filter lists supplied 1`] = ` - - - + , - , - ], - } - } - selection={ + "field": "filter_id", + "name": "ID", + "render": [Function], + "sortable": true, + }, Object { - "onSelectionChange": [Function], - "selectable": [Function], - "selectableMessage": [Function], - } - } - sorting={ + "field": "description", + "name": "Description", + "sortable": true, + }, Object { - "sort": Object { - "direction": "asc", - "field": "filter_id", - }, - } + "field": "item_count", + "name": "Item count", + "sortable": true, + }, + Object { + "field": "used_by", + "name": "In use", + "render": [Function], + "sortable": true, + }, + ] + } + executeQueryOptions={Object {}} + isSelectable={true} + itemId="filter_id" + items={ + Array [ + Object { + "description": "List of known safe domains", + "filter_id": "safe_domains", + "item_count": 500, + "used_by": Object { + "jobs": Array [ + "dns_exfiltration", + ], + }, + }, + Object { + "description": "US East AWS instances", + "filter_id": "us_east_instances", + "item_count": 20, + "used_by": Object { + "jobs": Array [], + }, + }, + ] + } + pagination={true} + responsive={true} + search={ + Object { + "box": Object { + "incremental": true, + }, + "filters": Array [], + "toolsRight": Array [ + , + , + ], + } + } + selection={ + Object { + "onSelectionChange": [Function], + "selectable": [Function], + "selectableMessage": [Function], + } + } + sorting={ + Object { + "sort": Object { + "direction": "asc", + "field": "filter_id", + }, } - /> - - + } + /> + `; diff --git a/x-pack/plugins/monitoring/public/components/elasticsearch/ccr_shard/__snapshots__/ccr_shard.test.js.snap b/x-pack/plugins/monitoring/public/components/elasticsearch/ccr_shard/__snapshots__/ccr_shard.test.js.snap index 9285aa7226e57..d4b789d4b79da 100644 --- a/x-pack/plugins/monitoring/public/components/elasticsearch/ccr_shard/__snapshots__/ccr_shard.test.js.snap +++ b/x-pack/plugins/monitoring/public/components/elasticsearch/ccr_shard/__snapshots__/ccr_shard.test.js.snap @@ -115,44 +115,42 @@ exports[`CcrShard that it renders normally 1`] = ` responsive={true} wrap={true} > - - - - - - - + + + + + + - - - - - + + + - - -

- September 27, 2018 9:32:09 AM -

-
- - - { + +

+ September 27, 2018 9:32:09 AM +

+
+ + + { "read_exceptions": [], "follower_global_checkpoint": 3049, "follower_index": "follower", @@ -218,8 +215,7 @@ exports[`CcrShard that it renders normally 1`] = ` "total_index_time_millis": 41827, "total_transferred_bytes": 234156 } - -
+ diff --git a/x-pack/plugins/reporting/public/components/__snapshots__/report_info_button.test.tsx.snap b/x-pack/plugins/reporting/public/components/__snapshots__/report_info_button.test.tsx.snap index 7ee7c00d6837f..0c08e3e69f24a 100644 --- a/x-pack/plugins/reporting/public/components/__snapshots__/report_info_button.test.tsx.snap +++ b/x-pack/plugins/reporting/public/components/__snapshots__/report_info_button.test.tsx.snap @@ -63,7 +63,15 @@ Array [ /> + > + + } + /> + + > + + } + /> + + - + `; diff --git a/x-pack/plugins/security/public/views/management/edit_role/components/__snapshots__/collapsible_panel.test.tsx.snap b/x-pack/plugins/security/public/views/management/edit_role/components/__snapshots__/collapsible_panel.test.tsx.snap index a940a55b3754b..52bde6ec75879 100644 --- a/x-pack/plugins/security/public/views/management/edit_role/components/__snapshots__/collapsible_panel.test.tsx.snap +++ b/x-pack/plugins/security/public/views/management/edit_role/components/__snapshots__/collapsible_panel.test.tsx.snap @@ -51,13 +51,11 @@ exports[`it renders without blowing up 1`] = ` - - -

- child -

-
+ +

+ child +

`; diff --git a/x-pack/plugins/security/public/views/management/edit_role/components/privileges/es/__snapshots__/elasticsearch_privileges.test.tsx.snap b/x-pack/plugins/security/public/views/management/edit_role/components/privileges/es/__snapshots__/elasticsearch_privileges.test.tsx.snap index b5040fd5e9756..31f2adabe766a 100644 --- a/x-pack/plugins/security/public/views/management/edit_role/components/privileges/es/__snapshots__/elasticsearch_privileges.test.tsx.snap +++ b/x-pack/plugins/security/public/views/management/edit_role/components/privileges/es/__snapshots__/elasticsearch_privileges.test.tsx.snap @@ -6,157 +6,81 @@ exports[`it renders without crashing 1`] = ` iconType="logoElasticsearch" title="Elasticsearch" > - - - - - - -

- } - fullWidth={false} - gutterSize="l" - title={ -

- -

- } - titleSize="xs" - > - - + - -
- - - - - - -

- } - fullWidth={false} - gutterSize="l" - title={ -

+ -

- } - titleSize="xs" - > - - - -
- - + +

+ } + fullWidth={false} + gutterSize="l" + title={

-
- - + + + + + + @@ -167,54 +91,128 @@ exports[`it renders without crashing 1`] = ` />

-
- - - + + + } + titleSize="xs" + > + + + + + + +

+ +

+
+ + +

- - + + + +

+
+ + + + + `; diff --git a/x-pack/plugins/security/public/views/management/edit_role/components/privileges/es/__snapshots__/index_privilege_form.test.tsx.snap b/x-pack/plugins/security/public/views/management/edit_role/components/privileges/es/__snapshots__/index_privilege_form.test.tsx.snap index 6f5b137c318b6..15820ba7ddb94 100644 --- a/x-pack/plugins/security/public/views/management/edit_role/components/privileges/es/__snapshots__/index_privilege_form.test.tsx.snap +++ b/x-pack/plugins/security/public/views/management/edit_role/components/privileges/es/__snapshots__/index_privilege_form.test.tsx.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`it renders without crashing 1`] = ` - + - - + - - - } - > - - - - - - } - > - + + + + - - - - - } - label={ - + - - - - - - - - +
+ + - + } + label={ + + } > - - } + - - - + + + + + + + + } + onChange={[Function]} + /> + + - + `; diff --git a/x-pack/plugins/security/public/views/management/edit_role/components/privileges/es/__snapshots__/index_privileges.test.tsx.snap b/x-pack/plugins/security/public/views/management/edit_role/components/privileges/es/__snapshots__/index_privileges.test.tsx.snap index 189c4766c29f9..943c3e1518cab 100644 --- a/x-pack/plugins/security/public/views/management/edit_role/components/privileges/es/__snapshots__/index_privileges.test.tsx.snap +++ b/x-pack/plugins/security/public/views/management/edit_role/components/privileges/es/__snapshots__/index_privileges.test.tsx.snap @@ -1,3 +1,3 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`it renders without crashing 1`] = `Array []`; +exports[`it renders without crashing 1`] = `null`; diff --git a/x-pack/plugins/security/public/views/management/edit_role/components/privileges/kibana/__snapshots__/impacted_spaces_flyout.test.tsx.snap b/x-pack/plugins/security/public/views/management/edit_role/components/privileges/kibana/__snapshots__/impacted_spaces_flyout.test.tsx.snap index c749a49bce110..059ca0f1c0db6 100644 --- a/x-pack/plugins/security/public/views/management/edit_role/components/privileges/kibana/__snapshots__/impacted_spaces_flyout.test.tsx.snap +++ b/x-pack/plugins/security/public/views/management/edit_role/components/privileges/kibana/__snapshots__/impacted_spaces_flyout.test.tsx.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[` renders without crashing 1`] = ` - +
@@ -17,5 +17,5 @@ exports[` renders without crashing 1`] = ` />
-
+ `; diff --git a/x-pack/plugins/security/public/views/management/edit_role/components/privileges/kibana/__snapshots__/simple_privilege_form.test.tsx.snap b/x-pack/plugins/security/public/views/management/edit_role/components/privileges/kibana/__snapshots__/simple_privilege_form.test.tsx.snap index bd7045f14a47a..d74ee2370caf5 100644 --- a/x-pack/plugins/security/public/views/management/edit_role/components/privileges/kibana/__snapshots__/simple_privilege_form.test.tsx.snap +++ b/x-pack/plugins/security/public/views/management/edit_role/components/privileges/kibana/__snapshots__/simple_privilege_form.test.tsx.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[` renders without crashing 1`] = ` - + @@ -45,5 +45,5 @@ exports[` renders without crashing 1`] = ` /> - + `; diff --git a/x-pack/plugins/security/public/views/management/edit_role/components/privileges/kibana/__snapshots__/space_aware_privilege_form.test.tsx.snap b/x-pack/plugins/security/public/views/management/edit_role/components/privileges/kibana/__snapshots__/space_aware_privilege_form.test.tsx.snap index 02b85cfc32545..819bcb4dcf4cd 100644 --- a/x-pack/plugins/security/public/views/management/edit_role/components/privileges/kibana/__snapshots__/space_aware_privilege_form.test.tsx.snap +++ b/x-pack/plugins/security/public/views/management/edit_role/components/privileges/kibana/__snapshots__/space_aware_privilege_form.test.tsx.snap @@ -185,7 +185,7 @@ exports[` hides the space table if there are no existin `; exports[` renders without crashing 1`] = ` - + @@ -233,66 +233,130 @@ exports[` renders without crashing 1`] = ` - - +

+ +

+
+ + +

+ + + , + "read": + + , + } + } + /> +

+
+ + + + -

+ -

- - - +
+ -

- - - , - "read": - - , - } - } - /> -

-
- - - renders without crashing 1`] = ` "name": "", } } - spacePrivileges={Object {}} spaces={ Array [ Object { @@ -323,82 +386,15 @@ exports[` renders without crashing 1`] = ` }, ] } - /> - - - - - - - - - - - - - + } + /> + + + `; exports[` with user profile disabling "manageSpaces" renders a warning message instead of the privilege form 1`] = ` diff --git a/x-pack/plugins/spaces/public/views/management/components/advanced_settings_subtitle/__snapshots__/advanced_settings_subtitle.test.tsx.snap b/x-pack/plugins/spaces/public/views/management/components/advanced_settings_subtitle/__snapshots__/advanced_settings_subtitle.test.tsx.snap index 1f91e57a3f37e..69d1011de3c55 100644 --- a/x-pack/plugins/spaces/public/views/management/components/advanced_settings_subtitle/__snapshots__/advanced_settings_subtitle.test.tsx.snap +++ b/x-pack/plugins/spaces/public/views/management/components/advanced_settings_subtitle/__snapshots__/advanced_settings_subtitle.test.tsx.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`AdvancedSettingsSubtitle renders as expected 1`] = ` - + @@ -25,5 +25,5 @@ exports[`AdvancedSettingsSubtitle renders as expected 1`] = `

} /> -
+ `; diff --git a/x-pack/plugins/spaces/public/views/management/components/secure_space_message/__snapshots__/secure_space_message.test.tsx.snap b/x-pack/plugins/spaces/public/views/management/components/secure_space_message/__snapshots__/secure_space_message.test.tsx.snap index a18d45e2d6518..7b46ee41053fd 100644 --- a/x-pack/plugins/spaces/public/views/management/components/secure_space_message/__snapshots__/secure_space_message.test.tsx.snap +++ b/x-pack/plugins/spaces/public/views/management/components/secure_space_message/__snapshots__/secure_space_message.test.tsx.snap @@ -3,7 +3,7 @@ exports[`SecureSpaceMessage doesn't render if user profile does not allow security to be managed 1`] = `""`; exports[`SecureSpaceMessage renders if user profile allows security to be managed 1`] = ` - + @@ -34,5 +34,5 @@ exports[`SecureSpaceMessage renders if user profile allows security to be manage />

-
+ `; diff --git a/x-pack/plugins/spaces/public/views/management/edit_space/__snapshots__/delete_spaces_button.test.tsx.snap b/x-pack/plugins/spaces/public/views/management/edit_space/__snapshots__/delete_spaces_button.test.tsx.snap index 93bb0363ed65a..554bf9a26ef91 100644 --- a/x-pack/plugins/spaces/public/views/management/edit_space/__snapshots__/delete_spaces_button.test.tsx.snap +++ b/x-pack/plugins/spaces/public/views/management/edit_space/__snapshots__/delete_spaces_button.test.tsx.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`DeleteSpacesButton renders as expected 1`] = ` - + - + `; diff --git a/x-pack/plugins/spaces/public/views/management/edit_space/__snapshots__/space_identifier.test.tsx.snap b/x-pack/plugins/spaces/public/views/management/edit_space/__snapshots__/space_identifier.test.tsx.snap index b22754203b92a..cae15537921b3 100644 --- a/x-pack/plugins/spaces/public/views/management/edit_space/__snapshots__/space_identifier.test.tsx.snap +++ b/x-pack/plugins/spaces/public/views/management/edit_space/__snapshots__/space_identifier.test.tsx.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`renders without crashing 1`] = ` - + - + `; diff --git a/x-pack/plugins/spaces/public/views/management/spaces_grid/__snapshots__/spaces_grid_pages.test.tsx.snap b/x-pack/plugins/spaces/public/views/management/spaces_grid/__snapshots__/spaces_grid_pages.test.tsx.snap index 1fb27b544fc9b..a95d29b96155a 100644 --- a/x-pack/plugins/spaces/public/views/management/spaces_grid/__snapshots__/spaces_grid_pages.test.tsx.snap +++ b/x-pack/plugins/spaces/public/views/management/spaces_grid/__snapshots__/spaces_grid_pages.test.tsx.snap @@ -8,128 +8,126 @@ exports[`SpacesGridPage renders as expected 1`] = ` horizontalPosition="center" panelPaddingSize="l" > - - + - - -

- -

-
- -

- Organize your dashboards and other saved objects into meaningful categories. -

-
-
- - +

- - - - - + + +

+ Organize your dashboards and other saved objects into meaningful categories. +

+
+ + + - } - pagination={true} - responsive={true} - search={ + + + + + + } + pagination={true} + responsive={true} + search={ + Object { + "box": Object { + "placeholder": "Search", + }, } - sorting={false} - /> - + } + sorting={false} + /> - - + + - - - - + diff --git a/x-pack/plugins/upgrade_assistant/public/components/tabs/checkup/__snapshots__/checkup_tab.test.tsx.snap b/x-pack/plugins/upgrade_assistant/public/components/tabs/checkup/__snapshots__/checkup_tab.test.tsx.snap index 9bf3c3836b5ad..1bc2f1ea095d3 100644 --- a/x-pack/plugins/upgrade_assistant/public/components/tabs/checkup/__snapshots__/checkup_tab.test.tsx.snap +++ b/x-pack/plugins/upgrade_assistant/public/components/tabs/checkup/__snapshots__/checkup_tab.test.tsx.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`CheckupTab render with deprecations 1`] = ` - + @@ -27,281 +27,277 @@ exports[`CheckupTab render with deprecations 1`] = ` - - - } - > -

- - - , - } + + } + > +

+ + + , } - /> -

-
- -
+ } + /> +

+ + - - - - - + + + -
+ `; exports[`CheckupTab render with error 1`] = ` - + @@ -327,46 +323,44 @@ exports[`CheckupTab render with error 1`] = ` - - - } - > -

- - - , - } + + } + > +

+ + + , } - /> -

-
- -
+ } + /> +

+ + @@ -385,11 +379,11 @@ exports[`CheckupTab render with error 1`] = ` /> -
+ `; exports[`CheckupTab render without deprecations 1`] = ` - + @@ -415,46 +409,44 @@ exports[`CheckupTab render without deprecations 1`] = ` - - - } - > -

- - - , - } + + } + > +

+ + + , } - /> -

-
- -
+ } + /> +

+ + @@ -514,5 +506,5 @@ exports[`CheckupTab render without deprecations 1`] = ` /> -
+ `; diff --git a/x-pack/plugins/xpack_main/public/components/telemetry/__snapshots__/telemetry_form.test.js.snap b/x-pack/plugins/xpack_main/public/components/telemetry/__snapshots__/telemetry_form.test.js.snap index b7c8519b8f640..799aef28eeea3 100644 --- a/x-pack/plugins/xpack_main/public/components/telemetry/__snapshots__/telemetry_form.test.js.snap +++ b/x-pack/plugins/xpack_main/public/components/telemetry/__snapshots__/telemetry_form.test.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`TelemetryForm renders as expected 1`] = ` - + - + `; diff --git a/yarn.lock b/yarn.lock index d55df4dd541d0..a1d1f2f09667d 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2838,6 +2838,15 @@ array-unique@^0.3.2: resolved "https://registry.yarnpkg.com/array-unique/-/array-unique-0.3.2.tgz#a894b75d4bc4f6cd679ef3244a9fd8f46ae2d428" integrity sha1-qJS3XUvE9s1nnvMkSp/Y9Gri1Cg= +array.prototype.flat@^1.2.1: + version "1.2.1" + resolved "https://registry.yarnpkg.com/array.prototype.flat/-/array.prototype.flat-1.2.1.tgz#812db8f02cad24d3fab65dd67eabe3b8903494a4" + integrity sha512-rVqIs330nLJvfC7JqYvEWwqVr5QjYF1ib02i3YJtR/fICO6527Tjpc/e4Mvmxh3GIePPreRXMdaGyC99YphWEw== + dependencies: + define-properties "^1.1.2" + es-abstract "^1.10.0" + function-bind "^1.1.1" + arraybuffer.slice@~0.0.7: version "0.0.7" resolved "https://registry.yarnpkg.com/arraybuffer.slice/-/arraybuffer.slice-0.0.7.tgz#3bbc4275dd584cc1b10809b89d4e8b63a69e7675" @@ -7604,51 +7613,59 @@ env-variable@0.0.x: resolved "https://registry.yarnpkg.com/env-variable/-/env-variable-0.0.5.tgz#913dd830bef11e96a039c038d4130604eba37f88" integrity sha512-zoB603vQReOFvTg5xMl9I1P2PnHsHQQKTEowsKKD7nseUfJq6UWzK+4YtlWUO1nhiQUxe6XMkk+JleSZD1NZFA== -enzyme-adapter-react-16@^1.1.1: - version "1.1.1" - resolved "https://registry.yarnpkg.com/enzyme-adapter-react-16/-/enzyme-adapter-react-16-1.1.1.tgz#a8f4278b47e082fbca14f5bfb1ee50ee650717b4" - integrity sha512-kC8pAtU2Jk3OJ0EG8Y2813dg9Ol0TXi7UNxHzHiWs30Jo/hj7alc//G1YpKUsPP1oKl9X+Lkx+WlGJpPYA+nvw== +enzyme-adapter-react-16@^1.6.0: + version "1.6.0" + resolved "https://registry.yarnpkg.com/enzyme-adapter-react-16/-/enzyme-adapter-react-16-1.6.0.tgz#3fca28d3c32f3ff427495380fe2dd51494689073" + integrity sha512-ay9eGFpChyUDnjTFMMJHzrb681LF3hPWJLEA7RoLFG9jSWAdAm2V50pGmFV9dYGJgh5HfdiqM+MNvle41Yf/PA== dependencies: - enzyme-adapter-utils "^1.3.0" - lodash "^4.17.4" - object.assign "^4.0.4" + enzyme-adapter-utils "^1.8.0" + function.prototype.name "^1.1.0" + object.assign "^4.1.0" object.values "^1.0.4" - prop-types "^15.6.0" - react-reconciler "^0.7.0" + prop-types "^15.6.2" + react-is "^16.5.2" react-test-renderer "^16.0.0-0" -enzyme-adapter-utils@^1.3.0: - version "1.3.0" - resolved "https://registry.yarnpkg.com/enzyme-adapter-utils/-/enzyme-adapter-utils-1.3.0.tgz#d6c85756826c257a8544d362cc7a67e97ea698c7" - integrity sha512-vVXSt6uDv230DIv+ebCG66T1Pm36Kv+m74L1TrF4kaE7e1V7Q/LcxO0QRkajk5cA6R3uu9wJf5h13wOTezTbjA== +enzyme-adapter-utils@^1.8.0, enzyme-adapter-utils@^1.8.1: + version "1.8.1" + resolved "https://registry.yarnpkg.com/enzyme-adapter-utils/-/enzyme-adapter-utils-1.8.1.tgz#a927d840ce2c14b42892a533aec836809d4e022b" + integrity sha512-s3QB3xQAowaDS2sHhmEqrT13GJC4+n5bG015ZkLv60n9k5vhxxHTQRIneZmQ4hmdCZEBrvUJ89PG6fRI5OEeuQ== dependencies: - lodash "^4.17.4" - object.assign "^4.0.4" - prop-types "^15.6.0" + function.prototype.name "^1.1.0" + object.assign "^4.1.0" + prop-types "^15.6.2" -enzyme-to-json@3.3.1: - version "3.3.1" - resolved "https://registry.yarnpkg.com/enzyme-to-json/-/enzyme-to-json-3.3.1.tgz#64239dcd417e2fb552f4baa6632de4744b9b5b93" - integrity sha512-PrgRyZAgEwOrh5/8BtBWrwGcv1mC7yNohytIciAX6SUqDaXg1BlU8CepYQ9BgnDP1i1jTB65qJJITMMCph+T6A== +enzyme-to-json@^3.3.4: + version "3.3.4" + resolved "https://registry.yarnpkg.com/enzyme-to-json/-/enzyme-to-json-3.3.4.tgz#67c6040e931182f183418af2eb9f4323258aa77f" + integrity sha1-Z8YEDpMRgvGDQYry659DIyWKp38= dependencies: lodash "^4.17.4" -enzyme@3.2.0: - version "3.2.0" - resolved "https://registry.yarnpkg.com/enzyme/-/enzyme-3.2.0.tgz#998bdcda0fc71b8764a0017f7cc692c943f54a7a" - integrity sha512-l0HcjycivXjB4IXkwuRc1K5z8hzWIVZB2b/Y/H2bao9eFTpBz4ACOwAQf44SgG5Nu3d1jF41LasxDgFWZeeysA== +enzyme@^3.7.0: + version "3.7.0" + resolved "https://registry.yarnpkg.com/enzyme/-/enzyme-3.7.0.tgz#9b499e8ca155df44fef64d9f1558961ba1385a46" + integrity sha512-QLWx+krGK6iDNyR1KlH5YPZqxZCQaVF6ike1eDJAOg0HvSkSCVImPsdWaNw6v+VrnK92Kg8jIOYhuOSS9sBpyg== dependencies: + array.prototype.flat "^1.2.1" cheerio "^1.0.0-rc.2" - function.prototype.name "^1.0.3" - has "^1.0.1" + function.prototype.name "^1.1.0" + has "^1.0.3" + is-boolean-object "^1.0.0" + is-callable "^1.1.4" + is-number-object "^1.0.3" + is-string "^1.0.4" is-subset "^0.1.1" - lodash "^4.17.4" + lodash.escape "^4.0.1" + lodash.isequal "^4.5.0" + object-inspect "^1.6.0" object-is "^1.0.1" - object.assign "^4.0.4" + object.assign "^4.1.0" object.entries "^1.0.4" object.values "^1.0.4" raf "^3.4.0" rst-selector-parser "^2.2.3" + string.prototype.trim "^1.1.2" err-code@^0.1.0: version "0.1.2" @@ -7677,6 +7694,17 @@ error@^7.0.0, error@^7.0.2: string-template "~0.2.1" xtend "~4.0.0" +es-abstract@^1.10.0, es-abstract@^1.5.0: + version "1.12.0" + resolved "https://registry.yarnpkg.com/es-abstract/-/es-abstract-1.12.0.tgz#9dbbdd27c6856f0001421ca18782d786bf8a6165" + integrity sha512-C8Fx/0jFmV5IPoMOFPA9P9G5NtqW+4cOPit3MIuvR2t7Ag2K15EJTpxnHAYTzL+aYQJIESYeXZmDBfOBE1HcpA== + dependencies: + es-to-primitive "^1.1.1" + function-bind "^1.1.1" + has "^1.0.1" + is-callable "^1.1.3" + is-regex "^1.0.4" + es-abstract@^1.5.1, es-abstract@^1.6.1, es-abstract@^1.7.0: version "1.10.0" resolved "https://registry.yarnpkg.com/es-abstract/-/es-abstract-1.10.0.tgz#1ecb36c197842a00d8ee4c2dfd8646bb97d60864" @@ -9374,7 +9402,7 @@ function-bind@^1.0.2, function-bind@^1.1.0, function-bind@^1.1.1: resolved "https://registry.yarnpkg.com/function-bind/-/function-bind-1.1.1.tgz#a56899d3ea3c9bab874bb9773b7c5ede92f4895d" integrity sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A== -function.prototype.name@^1.0.3: +function.prototype.name@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/function.prototype.name/-/function.prototype.name-1.1.0.tgz#8bd763cc0af860a859cc5d49384d74b932cd2327" integrity sha512-Bs0VRrTz4ghD8pTmbJQD1mZ8A/mN0ur/jGz+A6FBxPDUPkm1tNfF6bhTYPA7i7aF4lZJVr+OXTNNrnnIl58Wfg== @@ -11642,6 +11670,11 @@ is-binary-path@^2.0.0: dependencies: binary-extensions "^1.0.0" +is-boolean-object@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/is-boolean-object/-/is-boolean-object-1.0.0.tgz#98f8b28030684219a95f375cfbd88ce3405dff93" + integrity sha1-mPiygDBoQhmpXzdc+9iM40Bd/5M= + is-buffer@^1.1.4, is-buffer@^1.1.5: version "1.1.6" resolved "https://registry.yarnpkg.com/is-buffer/-/is-buffer-1.1.6.tgz#efaa2ea9daa0d7ab2ea13a97b2b8ad51fefbe8be" @@ -11659,6 +11692,11 @@ is-callable@^1.1.1, is-callable@^1.1.3: resolved "https://registry.yarnpkg.com/is-callable/-/is-callable-1.1.3.tgz#86eb75392805ddc33af71c92a0eedf74ee7604b2" integrity sha1-hut1OSgF3cM69xySoO7fdO52BLI= +is-callable@^1.1.4: + version "1.1.4" + resolved "https://registry.yarnpkg.com/is-callable/-/is-callable-1.1.4.tgz#1e1adf219e1eeb684d691f9d6a05ff0d30a24d75" + integrity sha512-r5p9sxJjYnArLjObpjA4xu5EKI3CuKHkJXMhT7kwbpUyIFD1n5PMAsoPvWnvtZiNz7LjkYDRZhd7FlI0eMijEA== + is-ci@^1.0.10: version "1.1.0" resolved "https://registry.yarnpkg.com/is-ci/-/is-ci-1.1.0.tgz#247e4162e7860cebbdaf30b774d6b0ac7dcfe7a5" @@ -11868,6 +11906,11 @@ is-npm@^1.0.0: resolved "https://registry.yarnpkg.com/is-npm/-/is-npm-1.0.0.tgz#f2fb63a65e4905b406c86072765a1a4dc793b9f4" integrity sha1-8vtjpl5JBbQGyGBydloaTceTufQ= +is-number-object@^1.0.3: + version "1.0.3" + resolved "https://registry.yarnpkg.com/is-number-object/-/is-number-object-1.0.3.tgz#f265ab89a9f445034ef6aff15a8f00b00f551799" + integrity sha1-8mWrian0RQNO9q/xWo8AsA9VF5k= + is-number@^0.1.1: version "0.1.1" resolved "https://registry.yarnpkg.com/is-number/-/is-number-0.1.1.tgz#69a7af116963d47206ec9bd9b48a14216f1e3806" @@ -12025,6 +12068,11 @@ is-stream@1.1.0, is-stream@^1.0.0, is-stream@^1.0.1, is-stream@^1.1.0: resolved "https://registry.yarnpkg.com/is-stream/-/is-stream-1.1.0.tgz#12d4a3dd4e68e0b79ceb8dbc84173ae80d91ca44" integrity sha1-EtSj3U5o4Lec6428hBc66A2RykQ= +is-string@^1.0.4: + version "1.0.4" + resolved "https://registry.yarnpkg.com/is-string/-/is-string-1.0.4.tgz#cc3a9b69857d621e963725a24caeec873b826e64" + integrity sha1-zDqbaYV9Yh6WNyWiTK7shzuCbmQ= + is-subset@^0.1.1: version "0.1.1" resolved "https://registry.yarnpkg.com/is-subset/-/is-subset-0.1.1.tgz#8a59117d932de1de00f245fcdd39ce43f1e939a6" @@ -13749,6 +13797,11 @@ lodash.escape@^3.0.0: dependencies: lodash._root "^3.0.0" +lodash.escape@^4.0.1: + version "4.0.1" + resolved "https://registry.yarnpkg.com/lodash.escape/-/lodash.escape-4.0.1.tgz#c9044690c21e04294beaa517712fded1fa88de98" + integrity sha1-yQRGkMIeBClL6qUXcS/e0fqI3pg= + lodash.filter@^4.4.0: version "4.6.0" resolved "https://registry.yarnpkg.com/lodash.filter/-/lodash.filter-4.6.0.tgz#668b1d4981603ae1cc5a6fa760143e480b4c4ace" @@ -15574,6 +15627,11 @@ object-copy@^0.1.0: define-property "^0.2.5" kind-of "^3.0.3" +object-inspect@^1.6.0: + version "1.6.0" + resolved "https://registry.yarnpkg.com/object-inspect/-/object-inspect-1.6.0.tgz#c70b6cbf72f274aab4c34c0c82f5167bf82cf15b" + integrity sha512-GJzfBZ6DgDAmnuaM3104jR4s1Myxr3Y3zfIyN4z3UdqN69oSRacNK8UhnobDdC+7J2AHCjGwxQubNJfE70SXXQ== + object-inspect@~0.4.0: version "0.4.0" resolved "https://registry.yarnpkg.com/object-inspect/-/object-inspect-0.4.0.tgz#f5157c116c1455b243b06ee97703392c5ad89fec" @@ -15616,7 +15674,7 @@ object-visit@^1.0.0: dependencies: isobject "^3.0.0" -object.assign@^4.0.4: +object.assign@^4.0.4, object.assign@^4.1.0: version "4.1.0" resolved "https://registry.yarnpkg.com/object.assign/-/object.assign-4.1.0.tgz#968bf1100d7956bb3ca086f006f846b3bc4008da" integrity sha512-exHJeq6kBKj58mqGyTQ9DFvrZC/eR6OwxzoM9YRoGBqrXYonaFyGiFMuc9VZrXf7DarreEwMpurG3dd+CNyW5w== @@ -17470,14 +17528,24 @@ react-dom@^16.0.0, react-dom@^16.2.0: prop-types "^15.6.0" react-dom@^16.3.0: - version "16.3.1" - resolved "https://registry.yarnpkg.com/react-dom/-/react-dom-16.3.1.tgz#6a3c90a4fb62f915bdbcf6204422d93a7d4ca573" - integrity sha512-2Infg89vzahq8nfVi1GkjPqq0vrBvf0f3T0+dTtyjq4f6HKOqKixAK25Vr593O3QTx4kw/vmUtAJwerlevNWOA== + version "16.7.0" + resolved "https://registry.yarnpkg.com/react-dom/-/react-dom-16.7.0.tgz#a17b2a7ca89ee7390bc1ed5eb81783c7461748b8" + integrity sha512-D0Ufv1ExCAmF38P2Uh1lwpminZFRXEINJe53zRAbm4KPwSyd6DY/uDoS0Blj9jvPpn1+wivKpZYc8aAAN/nAkg== dependencies: - fbjs "^0.8.16" loose-envify "^1.1.0" object-assign "^4.1.1" - prop-types "^15.6.0" + prop-types "^15.6.2" + scheduler "^0.12.0" + +react-dom@^16.6.0: + version "16.6.0" + resolved "https://registry.yarnpkg.com/react-dom/-/react-dom-16.6.0.tgz#6375b8391e019a632a89a0988bce85f0cc87a92f" + integrity sha512-Stm2D9dXEUUAQdvpvhvFj/DEXwC2PAL/RwEMhoN4dvvD2ikTlJegEXf97xryg88VIAU22ZAP7n842l+9BTz6+w== + dependencies: + loose-envify "^1.1.0" + object-assign "^4.1.1" + prop-types "^15.6.2" + scheduler "^0.10.0" react-draggable@3.x, "react-draggable@^2.2.6 || ^3.0.3": version "3.0.5" @@ -17537,7 +17605,7 @@ react-is@^16.3.1: resolved "https://registry.yarnpkg.com/react-is/-/react-is-16.4.1.tgz#d624c4650d2c65dbd52c72622bbf389435d9776e" integrity sha512-xpb0PpALlFWNw/q13A+1aHeyJyLYCg0/cCHPUA43zYluZuIPHaHL3k8OBsTgQtxqW0FhyDEMvi8fZ/+7+r4OSQ== -react-is@^16.4.0: +react-is@^16.4.0, react-is@^16.5.2: version "16.6.0" resolved "https://registry.yarnpkg.com/react-is/-/react-is-16.6.0.tgz#456645144581a6e99f6816ae2bd24ee94bdd0c01" integrity sha512-q8U7k0Fi7oxF1HvQgyBjPwDXeMplEsArnKt2iYhuIF86+GBbgLHdAmokL3XUFjTd7Q363OSNG55FOGUdONVn1g== @@ -17610,16 +17678,6 @@ react-portal@^3.2.0: dependencies: prop-types "^15.5.8" -react-reconciler@^0.7.0: - version "0.7.0" - resolved "https://registry.yarnpkg.com/react-reconciler/-/react-reconciler-0.7.0.tgz#9614894103e5f138deeeb5eabaf3ee80eb1d026d" - integrity sha512-50JwZ3yNyMS8fchN+jjWEJOH3Oze7UmhxeoJLn2j6f3NjpfCRbcmih83XTWmzqtar/ivd5f7tvQhvvhism2fgg== - dependencies: - fbjs "^0.8.16" - loose-envify "^1.1.0" - object-assign "^4.1.1" - prop-types "^15.6.0" - react-redux-request@^1.5.6: version "1.5.6" resolved "https://registry.yarnpkg.com/react-redux-request/-/react-redux-request-1.5.6.tgz#8c514dc88264d225e113b4b54a265064e8020651" @@ -17863,6 +17921,16 @@ react@^16.3.0: object-assign "^4.1.1" prop-types "^15.6.0" +react@^16.6.0: + version "16.6.0" + resolved "https://registry.yarnpkg.com/react/-/react-16.6.0.tgz#b34761cfaf3e30f5508bc732fb4736730b7da246" + integrity sha512-zJPnx/jKtuOEXCbQ9BKaxDMxR0001/hzxXwYxG8septeyYGfsgAei6NgfbVgOhbY1WOP2o3VPs/E9HaN+9hV3Q== + dependencies: + loose-envify "^1.1.0" + object-assign "^4.1.1" + prop-types "^15.6.2" + scheduler "^0.10.0" + reactcss@1.2.3, reactcss@^1.2.0: version "1.2.3" resolved "https://registry.yarnpkg.com/reactcss/-/reactcss-1.2.3.tgz#c00013875e557b1cf0dfd9a368a1c3dab3b548dd" @@ -19028,6 +19096,22 @@ sax@>=0.6.0, sax@^1.2.1, sax@^1.2.4, sax@~1.2.1: resolved "https://registry.yarnpkg.com/sax/-/sax-1.2.4.tgz#2816234e2378bddc4e5354fab5caa895df7100d9" integrity sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw== +scheduler@^0.10.0: + version "0.10.0" + resolved "https://registry.yarnpkg.com/scheduler/-/scheduler-0.10.0.tgz#7988de90fe7edccc774ea175a783e69c40c521e1" + integrity sha512-+TSTVTCBAA3h8Anei3haDc1IRwMeDmtI/y/o3iBe3Mjl2vwYF9DtPDt929HyRmV/e7au7CLu8sc4C4W0VOs29w== + dependencies: + loose-envify "^1.1.0" + object-assign "^4.1.1" + +scheduler@^0.12.0: + version "0.12.0" + resolved "https://registry.yarnpkg.com/scheduler/-/scheduler-0.12.0.tgz#8ab17699939c0aedc5a196a657743c496538647b" + integrity sha512-t7MBR28Akcp4Jm+QoR63XgAi9YgCUmgvDHqf5otgAj4QvdoBE4ImCX0ffehefePPG+aitiYHp0g/mW6s4Tp+dw== + dependencies: + loose-envify "^1.1.0" + object-assign "^4.1.1" + schema-utils@^0.3.0: version "0.3.0" resolved "https://registry.yarnpkg.com/schema-utils/-/schema-utils-0.3.0.tgz#f5877222ce3e931edae039f17eb3716e7137f8cf" @@ -20099,6 +20183,15 @@ string-width@^2.0.0, string-width@^2.1.0, string-width@^2.1.1: is-fullwidth-code-point "^2.0.0" strip-ansi "^4.0.0" +string.prototype.trim@^1.1.2: + version "1.1.2" + resolved "https://registry.yarnpkg.com/string.prototype.trim/-/string.prototype.trim-1.1.2.tgz#d04de2c89e137f4d7d206f086b5ed2fae6be8cea" + integrity sha1-0E3iyJ4Tf019IG8Ia17S+ua+jOo= + dependencies: + define-properties "^1.1.2" + es-abstract "^1.5.0" + function-bind "^1.0.2" + string_decoder@0.10, string_decoder@~0.10.x: version "0.10.31" resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-0.10.31.tgz#62e203bc41766c6c28c9fc84301dab1c5310fa94" From 476a88e309320d0b35aa50cb86ab503e956cf9a0 Mon Sep 17 00:00:00 2001 From: Justin Kambic Date: Wed, 23 Jan 2019 14:00:38 -0500 Subject: [PATCH 09/29] [Uptime] Add crosshair sync for monitor page charts (#28631) * Add crosshair sync for monitor page charts. * Fix errant prop in chart component. * Fix checks domain. --- .../queries/monitor_charts/monitor_charts.tsx | 343 +++++++++++------- 1 file changed, 217 insertions(+), 126 deletions(-) diff --git a/x-pack/plugins/uptime/public/components/queries/monitor_charts/monitor_charts.tsx b/x-pack/plugins/uptime/public/components/queries/monitor_charts/monitor_charts.tsx index b7957f578b20c..b209b92ad5b3a 100644 --- a/x-pack/plugins/uptime/public/components/queries/monitor_charts/monitor_charts.tsx +++ b/x-pack/plugins/uptime/public/components/queries/monitor_charts/monitor_charts.tsx @@ -32,130 +32,217 @@ interface MonitorChartsProps { monitorId: string; } +interface MonitorChartsState { + crosshairLocation: number; +} + type Props = MonitorChartsProps & UptimeCommonProps; -export const MonitorCharts = ({ - dateRangeStart, - dateRangeEnd, - monitorId, - autorefreshIsPaused, - autorefreshInterval, -}: Props) => ( - - {({ loading, error, data }) => { - if (loading) { - return i18n.translate('xpack.uptime.monitorCharts.loadingMessage', { - defaultMessage: 'Loading…', - }); - } - if (error) { - return i18n.translate('xpack.uptime.monitorCharts.errorMessage', { - values: { message: error.message }, - defaultMessage: 'Error {message}', - }); - } +export class MonitorCharts extends React.Component { + constructor(props: Props) { + super(props); + this.state = { crosshairLocation: 0 }; + } - // TODO: this should not exist in the UI, update the GQL resolver/schema to return - // an object that contains these series already shaped in the way required by the visualizations. - const { monitorChartsData } = data; - const rttWriteRequestSeries: any[] = []; - const rttValidateSeries: any[] = []; - const rttContentSeries: any[] = []; - const rttResponseSeries: any[] = []; - const rttTcpSeries: any[] = []; - const avgDurationSeries: any[] = []; - const areaRttSeries: any[] = []; - const downSeries: any[] = []; - const upSeries: any[] = []; - const checksSeries: any[] = []; - const maxRtt: any[] = []; - monitorChartsData.forEach( - ({ - maxWriteRequest, - maxValidate, - maxContent, - maxResponse, - maxTcpRtt, - avgDuration, - maxDuration, - minDuration, - status, - }: any) => { - // We're summing these values because we need to know what the max value of the RTT - // fields are in order to provide an accurate domain size for the RTT combination series. - maxRtt.push({ - x: maxWriteRequest.x, - y: maxWriteRequest.y + maxValidate.y + maxContent.y + maxResponse.y + maxTcpRtt.y, - }); - // TODO: these types of computations should take place on the server and be reflected in the GQL schema - rttWriteRequestSeries.push(maxWriteRequest); - rttValidateSeries.push(maxValidate); - rttContentSeries.push(maxContent); - rttResponseSeries.push(maxResponse); - rttTcpSeries.push(maxTcpRtt); - avgDurationSeries.push(avgDuration); - areaRttSeries.push({ x: minDuration.x, y0: minDuration.y, y: maxDuration.y }); - downSeries.push({ x: status.x, y: status.down }); - upSeries.push({ x: status.x, y: status.up }); - checksSeries.push({ x: status.x, y: status.total }); - } - ); + public render() { + const { + dateRangeStart, + dateRangeEnd, + monitorId, + autorefreshIsPaused, + autorefreshInterval, + } = this.props; + return ( + + {({ loading, error, data }) => { + if (loading) { + return i18n.translate('xpack.uptime.monitorCharts.loadingMessage', { + defaultMessage: 'Loading…', + }); + } + if (error) { + return i18n.translate('xpack.uptime.monitorCharts.errorMessage', { + values: { message: error.message }, + defaultMessage: 'Error {message}', + }); + } - // As above, we are building a domain size for the chart to use. - // Without this code the chart could render data outside of the field. - const checksDomain = upSeries.concat(downSeries).map(({ y }) => y); - const domainLimits = [Math.min(...checksDomain), Math.max(...checksDomain)]; - const durationDomain = avgDurationSeries.concat(areaRttSeries); - const durationLimits = [0, Math.max(...durationDomain.map(({ y }) => y))]; + // TODO: this should not exist in the UI, update the GQL resolver/schema to return + // an object that contains these series already shaped in the way required by the visualizations. + const { monitorChartsData } = data; + const rttWriteRequestSeries: any[] = []; + const rttValidateSeries: any[] = []; + const rttContentSeries: any[] = []; + const rttResponseSeries: any[] = []; + const rttTcpSeries: any[] = []; + const avgDurationSeries: any[] = []; + const areaRttSeries: any[] = []; + const downSeries: any[] = []; + const upSeries: any[] = []; + const checksSeries: any[] = []; + const maxRtt: any[] = []; + monitorChartsData.forEach( + ({ + maxWriteRequest, + maxValidate, + maxContent, + maxResponse, + maxTcpRtt, + avgDuration, + maxDuration, + minDuration, + status, + }: any) => { + // We're summing these values because we need to know what the max value of the RTT + // fields are in order to provide an accurate domain size for the RTT combination series. + maxRtt.push({ + x: maxWriteRequest.x, + y: maxWriteRequest.y + maxValidate.y + maxContent.y + maxResponse.y + maxTcpRtt.y, + }); + // TODO: these types of computations should take place on the server and be reflected in the GQL schema + rttWriteRequestSeries.push(maxWriteRequest); + rttValidateSeries.push(maxValidate); + rttContentSeries.push(maxContent); + rttResponseSeries.push(maxResponse); + rttTcpSeries.push(maxTcpRtt); + avgDurationSeries.push(avgDuration); + areaRttSeries.push({ x: minDuration.x, y0: minDuration.y, y: maxDuration.y }); + downSeries.push({ x: status.x, y: status.down }); + upSeries.push({ x: status.x, y: status.up }); + checksSeries.push({ x: status.x, y: status.total }); + } + ); - return ( - - - - -

- -

-
- - - - - - -
- + // As above, we are building a domain size for the chart to use. + // Without this code the chart could render data outside of the field. + const checksDomain = upSeries.concat(downSeries).map(({ y }) => y); + const domainLimits = [0, Math.max(...checksDomain)]; + const durationDomain = avgDurationSeries.concat(areaRttSeries); + const durationLimits = [0, Math.max(...durationDomain.map(({ y }) => y))]; + + // find the greatest y-value for rtt chart + const rttLimits = [0, Math.max(...maxRtt.map(({ y }) => y))]; + + return ( + + + + +

+ +

+
+ + + + + + + + + +
+ + +

+ +

+
+ + + + + + + +
+
+

- - - - ); - }} - -); + + ); + }} + + ); + } + private updateCrosshairLocation = (crosshairLocation: number) => + this.setState({ crosshairLocation }); +} From b21ee115e9933b0cb874f8421ec5010eb8dcd414 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20St=C3=BCrmer?= Date: Wed, 23 Jan 2019 21:07:10 +0100 Subject: [PATCH 10/29] Fix index presence detection to work in ccs-only setups (#28926) --- .../lib/adapters/framework/adapter_types.ts | 6 ++++++ .../elasticsearch_source_status_adapter.ts | 16 +++++++++++++++- 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/x-pack/plugins/infra/server/lib/adapters/framework/adapter_types.ts b/x-pack/plugins/infra/server/lib/adapters/framework/adapter_types.ts index fca78f8f6fbab..031ab62c4a46f 100644 --- a/x-pack/plugins/infra/server/lib/adapters/framework/adapter_types.ts +++ b/x-pack/plugins/infra/server/lib/adapters/framework/adapter_types.ts @@ -104,6 +104,12 @@ export interface InfraDatabaseResponse { export interface InfraDatabaseSearchResponse extends InfraDatabaseResponse { + _shards: { + total: number; + successful: number; + skipped: number; + failed: number; + }; aggregations?: Aggregations; hits: { total: number; diff --git a/x-pack/plugins/infra/server/lib/adapters/source_status/elasticsearch_source_status_adapter.ts b/x-pack/plugins/infra/server/lib/adapters/source_status/elasticsearch_source_status_adapter.ts index 5b5af97880659..a87499697ddcc 100644 --- a/x-pack/plugins/infra/server/lib/adapters/source_status/elasticsearch_source_status_adapter.ts +++ b/x-pack/plugins/infra/server/lib/adapters/source_status/elasticsearch_source_status_adapter.ts @@ -43,7 +43,21 @@ export class InfraElasticsearchSourceStatusAdapter implements InfraSourceStatusA } public async hasIndices(request: InfraFrameworkRequest, indexNames: string) { - return (await this.getIndexNames(request, indexNames)).length > 0; + return await this.framework + .callWithRequest(request, 'search', { + index: indexNames, + size: 0, + terminate_after: 1, + }) + .then( + response => response._shards.total > 0, + err => { + if (err.status === 404) { + return false; + } + throw err; + } + ); } } From c96068c4ab077f5eba6b1b9d79989a50abb8a255 Mon Sep 17 00:00:00 2001 From: Justin Kambic Date: Wed, 23 Jan 2019 15:10:36 -0500 Subject: [PATCH 11/29] [Uptime] Fix "last updated" field (#28720) * Update MonitorStatusBar to not reference undefined value. * Add sort to top_hits aggregation. * Add default and loading state for status bar. * Change bool check. * Add aria-labels for monitor status bar. --- .../functional/empty_status_bar.tsx | 23 ++++ .../public/components/functional/index.ts | 9 ++ .../components/functional/status_bar.tsx | 77 +++++++++++++ .../__tests__/format_duration.test.ts | 24 ++++ .../monitor_status_bar/format_duration.ts | 13 +++ .../get_monitor_status_bar.ts | 1 + .../monitor_status_bar/monitor_status_bar.tsx | 108 +++++------------- .../components/queries/snapshot/snapshot.tsx | 2 +- .../uptime/server/graphql/pings/schema.gql.ts | 2 + .../elasticsearch_pings_adapter.test.ts | 3 + .../pings/elasticsearch_pings_adapter.ts | 18 ++- 11 files changed, 195 insertions(+), 85 deletions(-) create mode 100644 x-pack/plugins/uptime/public/components/functional/empty_status_bar.tsx create mode 100644 x-pack/plugins/uptime/public/components/functional/index.ts create mode 100644 x-pack/plugins/uptime/public/components/functional/status_bar.tsx create mode 100644 x-pack/plugins/uptime/public/components/queries/monitor_status_bar/__tests__/format_duration.test.ts create mode 100644 x-pack/plugins/uptime/public/components/queries/monitor_status_bar/format_duration.ts diff --git a/x-pack/plugins/uptime/public/components/functional/empty_status_bar.tsx b/x-pack/plugins/uptime/public/components/functional/empty_status_bar.tsx new file mode 100644 index 0000000000000..46bb9ca560a2a --- /dev/null +++ b/x-pack/plugins/uptime/public/components/functional/empty_status_bar.tsx @@ -0,0 +1,23 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import { EuiFlexGroup, EuiFlexItem, EuiPanel } from '@elastic/eui'; +import React from 'react'; + +interface Props { + monitorId: string; + message?: string; +} + +export const EmptyStatusBar = ({ message, monitorId }: Props) => ( + + + + {!message ? `No data found for monitor id ${monitorId}` : message} + + + +); diff --git a/x-pack/plugins/uptime/public/components/functional/index.ts b/x-pack/plugins/uptime/public/components/functional/index.ts new file mode 100644 index 0000000000000..913f35d34c982 --- /dev/null +++ b/x-pack/plugins/uptime/public/components/functional/index.ts @@ -0,0 +1,9 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +export { EmptyStatusBar } from './empty_status_bar'; +export { SnapshotHistogram } from './snapshot_histogram'; +export { StatusBar } from './status_bar'; diff --git a/x-pack/plugins/uptime/public/components/functional/status_bar.tsx b/x-pack/plugins/uptime/public/components/functional/status_bar.tsx new file mode 100644 index 0000000000000..e5ff275a19e1c --- /dev/null +++ b/x-pack/plugins/uptime/public/components/functional/status_bar.tsx @@ -0,0 +1,77 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import { EuiFlexGroup, EuiFlexItem, EuiHealth, EuiLink, EuiPanel } from '@elastic/eui'; +import { i18n } from '@kbn/i18n'; +import { FormattedMessage } from '@kbn/i18n/react'; +import moment from 'moment'; +import React from 'react'; + +interface Props { + duration?: number; + url?: string; + status?: string; + timestamp?: string; +} + +export const StatusBar = ({ timestamp, url, duration, status }: Props) => ( + + + + + {status === 'up' + ? i18n.translate('xpack.uptime.monitorStatusBar.healthStatusMessage.upLabel', { + defaultMessage: 'Up', + }) + : i18n.translate('xpack.uptime.monitorStatusBar.healthStatusMessage.downLabel', { + defaultMessage: 'Down', + })} + + + + + + {url} + + + + + + + + {moment(timestamp).fromNow()} + + + +); diff --git a/x-pack/plugins/uptime/public/components/queries/monitor_status_bar/__tests__/format_duration.test.ts b/x-pack/plugins/uptime/public/components/queries/monitor_status_bar/__tests__/format_duration.test.ts new file mode 100644 index 0000000000000..4889909d98b75 --- /dev/null +++ b/x-pack/plugins/uptime/public/components/queries/monitor_status_bar/__tests__/format_duration.test.ts @@ -0,0 +1,24 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import { formatDuration } from '../format_duration'; + +describe('formatDuration', () => { + it('returns 0 for undefined', () => { + const result = formatDuration(undefined); + expect(result).toEqual(0); + }); + + it('returns 0 for NaN', () => { + const result = formatDuration(NaN); + expect(result).toEqual(0); + }); + + it('returns duration value in ms', () => { + const duration = 320000; // microseconds + expect(formatDuration(duration)).toEqual(320); + }); +}); diff --git a/x-pack/plugins/uptime/public/components/queries/monitor_status_bar/format_duration.ts b/x-pack/plugins/uptime/public/components/queries/monitor_status_bar/format_duration.ts new file mode 100644 index 0000000000000..955eb81f9a77a --- /dev/null +++ b/x-pack/plugins/uptime/public/components/queries/monitor_status_bar/format_duration.ts @@ -0,0 +1,13 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +export const formatDuration = (duration: number | undefined): number => { + if (duration === undefined) { + return 0; + } + // TODO: formatting should not be performed this way, remove bare number + return isNaN(duration) ? 0 : duration / 1000; +}; diff --git a/x-pack/plugins/uptime/public/components/queries/monitor_status_bar/get_monitor_status_bar.ts b/x-pack/plugins/uptime/public/components/queries/monitor_status_bar/get_monitor_status_bar.ts index 747e80b0413d3..ba497e668df8f 100644 --- a/x-pack/plugins/uptime/public/components/queries/monitor_status_bar/get_monitor_status_bar.ts +++ b/x-pack/plugins/uptime/public/components/queries/monitor_status_bar/get_monitor_status_bar.ts @@ -14,6 +14,7 @@ export const createGetMonitorStatusBarQuery = gql` monitorId: $monitorId ) { timestamp + millisFromNow monitor { status host diff --git a/x-pack/plugins/uptime/public/components/queries/monitor_status_bar/monitor_status_bar.tsx b/x-pack/plugins/uptime/public/components/queries/monitor_status_bar/monitor_status_bar.tsx index 4af44b72dceb3..4b287873bc62b 100644 --- a/x-pack/plugins/uptime/public/components/queries/monitor_status_bar/monitor_status_bar.tsx +++ b/x-pack/plugins/uptime/public/components/queries/monitor_status_bar/monitor_status_bar.tsx @@ -4,19 +4,28 @@ * you may not use this file except in compliance with the Elastic License. */ -import { EuiFlexGroup, EuiFlexItem, EuiHealth, EuiLink, EuiPanel } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; -import { FormattedMessage } from '@kbn/i18n/react'; -import moment from 'moment'; +import { ApolloError } from 'apollo-client'; +import { get } from 'lodash'; import React from 'react'; import { Query } from 'react-apollo'; +import { Ping } from 'x-pack/plugins/uptime/common/graphql/types'; import { UptimeCommonProps } from '../../../uptime_app'; +import { StatusBar } from '../../functional'; +import { EmptyStatusBar } from '../../functional/empty_status_bar'; +import { formatDuration } from './format_duration'; import { createGetMonitorStatusBarQuery } from './get_monitor_status_bar'; interface MonitorStatusBarProps { monitorId: string; } +interface MonitorStatusBarQueryParams { + loading: boolean; + error?: ApolloError | any; + data?: { monitorStatus: Ping[] }; +} + type Props = MonitorStatusBarProps & UptimeCommonProps; export const MonitorStatusBar = ({ @@ -31,11 +40,9 @@ export const MonitorStatusBar = ({ query={createGetMonitorStatusBarQuery} variables={{ dateRangeStart, dateRangeEnd, monitorId }} > - {({ loading, error, data }) => { + {({ loading, error, data }: MonitorStatusBarQueryParams) => { if (loading) { - return i18n.translate('xpack.uptime.monitorStatusBar.loadingMessage', { - defaultMessage: 'Loading…', - }); + return ; } if (error) { return i18n.translate('xpack.uptime.monitorStatusBar.errorMessage', { @@ -43,82 +50,23 @@ export const MonitorStatusBar = ({ defaultMessage: 'Error {message}', }); } - const { monitorStatus } = data; - if (!monitorStatus.length) { - return i18n.translate('xpack.uptime.monitorStatusBar.noDataMessage', { - values: { monitorId }, - defaultMessage: 'No data found for monitor id {monitorId}', - }); + + const monitorStatus: Ping[] = get(data, 'monitorStatus'); + if (!monitorStatus || !monitorStatus.length) { + return ; } - const { - monitor: { - status, - timestamp, - ip, - duration: { us }, - }, - url: { full: fullURL }, - } = monitorStatus[0]; + const { monitor, timestamp, url } = monitorStatus[0]; + const status = get(monitor, 'status', undefined); + const duration = parseInt(get(monitor, 'duration.us'), 10); + const full = get(url, 'full', undefined); return ( - - - - - - - - - - {status === 'up' - ? i18n.translate( - 'xpack.uptime.monitorStatusBar.healthStatusMessage.upLabel', - { defaultMessage: 'Up' } - ) - : i18n.translate( - 'xpack.uptime.monitorStatusBar.healthStatusMessage.downLabel', - { defaultMessage: 'Down' } - )} - - - - - - - - - - {fullURL} - - - - - - - - - - + ); }} diff --git a/x-pack/plugins/uptime/public/components/queries/snapshot/snapshot.tsx b/x-pack/plugins/uptime/public/components/queries/snapshot/snapshot.tsx index 4b74d5a2e62ff..cdcad14817bcc 100644 --- a/x-pack/plugins/uptime/public/components/queries/snapshot/snapshot.tsx +++ b/x-pack/plugins/uptime/public/components/queries/snapshot/snapshot.tsx @@ -27,7 +27,7 @@ import { FormattedMessage } from '@kbn/i18n/react'; import React from 'react'; import { Query } from 'react-apollo'; import { UptimeCommonProps } from '../../../uptime_app'; -import { SnapshotHistogram } from '../../functional/snapshot_histogram'; +import { SnapshotHistogram } from '../../functional'; import { getSnapshotQuery } from './get_snapshot'; interface SnapshotProps { diff --git a/x-pack/plugins/uptime/server/graphql/pings/schema.gql.ts b/x-pack/plugins/uptime/server/graphql/pings/schema.gql.ts index f4811986299f3..1a2b2482b11f3 100644 --- a/x-pack/plugins/uptime/server/graphql/pings/schema.gql.ts +++ b/x-pack/plugins/uptime/server/graphql/pings/schema.gql.ts @@ -193,6 +193,8 @@ export const pingsSchema = gql` type Ping { "The timestamp of the ping's creation" timestamp: String! + "Milliseconds from the timestamp to the current time" + millisFromNow: Int "The agent that recorded the ping" beat: Beat docker: Docker diff --git a/x-pack/plugins/uptime/server/lib/adapters/pings/__tests__/elasticsearch_pings_adapter.test.ts b/x-pack/plugins/uptime/server/lib/adapters/pings/__tests__/elasticsearch_pings_adapter.test.ts index 39f34aec53cf8..595f87565e161 100644 --- a/x-pack/plugins/uptime/server/lib/adapters/pings/__tests__/elasticsearch_pings_adapter.test.ts +++ b/x-pack/plugins/uptime/server/lib/adapters/pings/__tests__/elasticsearch_pings_adapter.test.ts @@ -182,6 +182,9 @@ describe('ElasticsearchPingsAdapter class', () => { latest: { top_hits: { size: 1, + sort: { + '@timestamp': { order: 'desc' }, + }, }, }, }, diff --git a/x-pack/plugins/uptime/server/lib/adapters/pings/elasticsearch_pings_adapter.ts b/x-pack/plugins/uptime/server/lib/adapters/pings/elasticsearch_pings_adapter.ts index bb502bfc39d5a..c8c31a41173c2 100644 --- a/x-pack/plugins/uptime/server/lib/adapters/pings/elasticsearch_pings_adapter.ts +++ b/x-pack/plugins/uptime/server/lib/adapters/pings/elasticsearch_pings_adapter.ts @@ -5,6 +5,7 @@ */ import { get } from 'lodash'; +import moment from 'moment'; import { INDEX_NAMES } from '../../../../common/constants'; import { DocCount, HistogramSeries, Ping, PingResults } from '../../../../common/graphql/types'; import { DatabaseAdapter } from '../database'; @@ -128,6 +129,9 @@ export class ElasticsearchPingsAdapter implements UMPingsAdapter { latest: { top_hits: { size: 1, + sort: { + '@timestamp': { order: 'desc' }, + }, }, }, }, @@ -142,10 +146,16 @@ export class ElasticsearchPingsAdapter implements UMPingsAdapter { } = await this.database.search(request, params); // @ts-ignore TODO fix destructuring implicit any - return buckets.map(({ latest: { hits: { hits } } }) => ({ - ...hits[0]._source, - timestamp: hits[0]._source[`@timestamp`], - })); + return buckets.map(({ latest: { hits: { hits } } }) => { + const timestamp = hits[0]._source[`@timestamp`]; + const momentTs = moment(timestamp); + const millisFromNow = moment().diff(momentTs); + return { + ...hits[0]._source, + timestamp, + millisFromNow, + }; + }); } public async getPingHistogram( From bc86c52ef11396f97d8d7d8d46047d04fe085fb4 Mon Sep 17 00:00:00 2001 From: Joel Griffith Date: Wed, 23 Jan 2019 12:20:28 -0800 Subject: [PATCH 12/29] Record failed ES queue jobs when saving the result fails (don't retry) (#28629) --- .../server/lib/esqueue/__tests__/worker.js | 27 +++++++++++++++++++ .../reporting/server/lib/esqueue/worker.js | 1 + 2 files changed, 28 insertions(+) diff --git a/x-pack/plugins/reporting/server/lib/esqueue/__tests__/worker.js b/x-pack/plugins/reporting/server/lib/esqueue/__tests__/worker.js index d86125d6c4c94..15fa81954d7dd 100644 --- a/x-pack/plugins/reporting/server/lib/esqueue/__tests__/worker.js +++ b/x-pack/plugins/reporting/server/lib/esqueue/__tests__/worker.js @@ -867,6 +867,33 @@ describe('Worker class', function () { return sinon.stub(workerWithFailure, '_failJob').returns(Promise.resolve()); } + describe('saving output failure', () => { + it('should mark the job as failed if saving to ES fails', async () => { + const job = { + _id: 'shouldSucced', + _source: { + timeout: 1000, + payload: 'test' + } + }; + + sinon.stub(mockQueue.client, 'update').returns(Promise.reject({ statusCode: 413 })); + + const workerFn = function (jobPayload) { + return new Promise(function (resolve) { + setTimeout(() => resolve(jobPayload), 10); + }); + }; + const worker = new Worker(mockQueue, 'test', workerFn, defaultWorkerOptions); + const failStub = getFailStub(worker); + + await worker._performJob(job); + worker.destroy(); + + sinon.assert.called(failStub); + }); + }); + describe('search failure', function () { it('causes _processPendingJobs to reject the Promise', function () { sinon.stub(mockQueue.client, 'search').returns(Promise.reject(new Error('test error'))); diff --git a/x-pack/plugins/reporting/server/lib/esqueue/worker.js b/x-pack/plugins/reporting/server/lib/esqueue/worker.js index 8c6bd5125e676..c5fa020fb76c6 100644 --- a/x-pack/plugins/reporting/server/lib/esqueue/worker.js +++ b/x-pack/plugins/reporting/server/lib/esqueue/worker.js @@ -259,6 +259,7 @@ export class Worker extends events.EventEmitter { if (err.statusCode === 409) return false; this.warn(`Failure saving job output ${job._id}`, err); this.emit(constants.EVENT_WORKER_JOB_UPDATE_ERROR, this._formatErrorParams(err, job)); + return this._failJob(job, (err.message) ? err.message : false); }); }, (jobErr) => { if (!jobErr) { From adbe6bb592a6f411bffe25574daef4b35ad9ca94 Mon Sep 17 00:00:00 2001 From: James Gowdy Date: Wed, 23 Jan 2019 21:04:08 +0000 Subject: [PATCH 13/29] [ML] Fixing job cloning when it has an unknown created_by value (#29175) --- .../ml/public/jobs/new_job/wizard/preconfigured_job_redirect.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/x-pack/plugins/ml/public/jobs/new_job/wizard/preconfigured_job_redirect.js b/x-pack/plugins/ml/public/jobs/new_job/wizard/preconfigured_job_redirect.js index 4a9ed00e5c423..65e1e196b2d84 100644 --- a/x-pack/plugins/ml/public/jobs/new_job/wizard/preconfigured_job_redirect.js +++ b/x-pack/plugins/ml/public/jobs/new_job/wizard/preconfigured_job_redirect.js @@ -88,6 +88,8 @@ function getWizardUrlFromCloningJob(job) { page = 'multi_metric'; } else if (created === WIZARD_TYPE.POPULATION) { page = 'population'; + } else { + return null; } const indexPatternId = getIndexPatternIdFromName(job.datafeed_config.indices[0]); From e0992aa4334520283e1acff943cfe76abbd0c59b Mon Sep 17 00:00:00 2001 From: Ahmad Bamieh Date: Wed, 23 Jan 2019 14:07:13 -0800 Subject: [PATCH 14/29] [i18n] Translate partials (#28653) localize partials --- .../directives/paginated_selectable_list.js | 8 ++- src/ui/public/partials/paginate_controls.html | 11 ++-- .../partials/paginated_selectable_list.html | 43 ++++++++++---- .../public/partials/saved_object_finder.html | 58 ++++++++++++++----- 4 files changed, 88 insertions(+), 32 deletions(-) diff --git a/src/ui/public/directives/paginated_selectable_list.js b/src/ui/public/directives/paginated_selectable_list.js index e71c6dc67e286..417273668dae7 100644 --- a/src/ui/public/directives/paginated_selectable_list.js +++ b/src/ui/public/directives/paginated_selectable_list.js @@ -40,7 +40,11 @@ module.directive('paginatedSelectableList', function () { disableAutoFocus: '=' }, template: paginatedSelectableListTemplate, - controller: function ($scope) { + controller: function ($scope, $filter) { + function calculateHitsByQuery() { + $scope.hitsByQuery = $filter('filter')($scope.hits, $scope.query); + } + // Should specify either user-make-url or user-on-select if (!$scope.userMakeUrl && !$scope.userOnSelect) { throwError('paginatedSelectableList directive expects a makeUrl or onSelect function'); @@ -53,6 +57,8 @@ module.directive('paginatedSelectableList', function () { $scope.perPage = $scope.perPage || 10; $scope.hits = $scope.list = _.sortBy($scope.list, $scope.accessor); + $scope.$watchGroup(['hits', 'query'], calculateHitsByQuery); + calculateHitsByQuery(); $scope.hitCount = $scope.hits.length; /** diff --git a/src/ui/public/partials/paginate_controls.html b/src/ui/public/partials/paginate_controls.html index 727c7e63624c1..c40021507c233 100644 --- a/src/ui/public/partials/paginate_controls.html +++ b/src/ui/public/partials/paginate_controls.html @@ -3,9 +3,9 @@ ng-if="linkToTop" ng-click="paginate.goToTop()" data-test-subj="paginateControlsLinkToTop" -> - Scroll to top - + i18n-id="common.ui.paginateControls.scrollTopButtonLabel" + i18n-default-message="Scroll to top" +>
- +