diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS
index eff8c58a48b0d..2e2b20a46baed 100644
--- a/.github/CODEOWNERS
+++ b/.github/CODEOWNERS
@@ -12,7 +12,6 @@
/src/legacy/core_plugins/kibana/public/discover/ @elastic/kibana-app
/src/legacy/core_plugins/kibana/public/visualize/ @elastic/kibana-app
/src/legacy/core_plugins/kibana/public/local_application_service/ @elastic/kibana-app
-/src/legacy/core_plugins/kibana/public/home/ @elastic/kibana-app
/src/legacy/core_plugins/kibana/public/dev_tools/ @elastic/kibana-app
/src/legacy/core_plugins/metrics/ @elastic/kibana-app
/src/legacy/core_plugins/vis_type_vislib/ @elastic/kibana-app
@@ -20,6 +19,10 @@
/src/plugins/home/public @elastic/kibana-app
/src/plugins/home/server/*.ts @elastic/kibana-app
/src/plugins/home/server/services/ @elastic/kibana-app
+# Exclude tutorial resources folder for now because they are not owned by Kibana app and most will move out soon
+/src/legacy/core_plugins/kibana/public/home/*.ts @elastic/kibana-app
+/src/legacy/core_plugins/kibana/public/home/*.scss @elastic/kibana-app
+/src/legacy/core_plugins/kibana/public/home/np_ready/ @elastic/kibana-app
/src/plugins/kibana_legacy/ @elastic/kibana-app
/src/plugins/timelion/ @elastic/kibana-app
/src/plugins/dev_tools/ @elastic/kibana-app
@@ -150,9 +153,9 @@
**/*.scss @elastic/kibana-design
# Elasticsearch UI
-/src/legacy/core_plugins/console/ @elastic/es-ui
+/src/plugins/console/ @elastic/es-ui
/src/plugins/es_ui_shared/ @elastic/es-ui
-/x-pack/legacy/plugins/console_extensions/ @elastic/es-ui
+/x-pack/plugins/console_extensions/ @elastic/es-ui
/x-pack/legacy/plugins/cross_cluster_replication/ @elastic/es-ui
/x-pack/legacy/plugins/index_lifecycle_management/ @elastic/es-ui
/x-pack/legacy/plugins/index_management/ @elastic/es-ui
diff --git a/.i18nrc.json b/.i18nrc.json
index af21f3426d75e..1230151212f57 100644
--- a/.i18nrc.json
+++ b/.i18nrc.json
@@ -1,7 +1,7 @@
{
"paths": {
"common.ui": "src/legacy/ui",
- "console": "src/legacy/core_plugins/console",
+ "console": "src/plugins/console",
"core": "src/core",
"dashboardEmbeddableContainer": "src/plugins/dashboard_embeddable_container",
"data": [
@@ -40,7 +40,7 @@
"visTypeMetric": "src/legacy/core_plugins/vis_type_metric",
"visTypeTable": "src/legacy/core_plugins/vis_type_table",
"visTypeTagCloud": "src/legacy/core_plugins/vis_type_tagcloud",
- "visTypeTimeseries": "src/legacy/core_plugins/vis_type_timeseries",
+ "visTypeTimeseries": ["src/legacy/core_plugins/vis_type_timeseries", "src/plugins/vis_type_timeseries"],
"visTypeVega": "src/legacy/core_plugins/vis_type_vega",
"visTypeVislib": "src/legacy/core_plugins/vis_type_vislib",
"visualizations": [
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 906010aee2fe6..59e3bd9232d8b 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -174,6 +174,16 @@ yarn kbn bootstrap
(You can also run `yarn kbn` to see the other available commands. For more info about this tool, see https://github.com/elastic/kibana/tree/master/packages/kbn-pm.)
+When switching branches which use different versions of npm packages you may need to run;
+```bash
+yarn kbn clean
+```
+
+If you have failures during `yarn kbn bootstrap` you may have some corrupted packages in your yarn cache which you can clean with;
+```bash
+yarn cache clean
+```
+
#### Increase node.js heap size
Kibana is a big project and for some commands it can happen that the process hits the default heap limit and crashes with an out-of-memory error. If you run into this problem, you can increase maximum heap size by setting the `--max_old_space_size` option on the command line. To set the limit for all commands, simply add the following line to your shell config: `export NODE_OPTIONS="--max_old_space_size=2048"`.
diff --git a/docs/settings/monitoring-settings.asciidoc b/docs/settings/monitoring-settings.asciidoc
index 8f445ff25218b..8586d26e9a07a 100644
--- a/docs/settings/monitoring-settings.asciidoc
+++ b/docs/settings/monitoring-settings.asciidoc
@@ -14,7 +14,7 @@ built-in `elastic` user has this role.
You can adjust how monitoring data is
collected from {kib} and displayed in {kib} by configuring settings in the
-`kibana.yml` file. There are also `xpack.monitoring.elasticsearch.*` settings,
+`kibana.yml` file. There are also `monitoring.ui.elasticsearch.*` settings,
which support the same values as <>.
To control how data is collected from your {es} nodes, you configure
@@ -31,20 +31,20 @@ For more information, see
[[monitoring-general-settings]]
==== General monitoring settings
-`xpack.monitoring.enabled`::
+`monitoring.enabled`::
Set to `true` (default) to enable the {monitor-features} in {kib}. Unlike the
-`xpack.monitoring.ui.enabled` setting, when this setting is `false`, the
+`monitoring.ui.enabled` setting, when this setting is `false`, the
monitoring back-end does not run and {kib} stats are not sent to the monitoring
cluster.
-`xpack.monitoring.elasticsearch.hosts`::
+`monitoring.ui.elasticsearch.hosts`::
Specifies the location of the {es} cluster where your monitoring data is stored.
By default, this is the same as `elasticsearch.hosts`. This setting enables
you to use a single {kib} instance to search and visualize data in your
production cluster as well as monitor data sent to a dedicated monitoring
cluster.
-`xpack.monitoring.elasticsearch.username`::
+`monitoring.ui.elasticsearch.username`::
Specifies the username used by {kib} monitoring to establish a persistent connection
in {kib} to the {es} monitoring cluster and to verify licensing status on the {es}
monitoring cluster.
@@ -55,7 +55,7 @@ both the {es} monitoring cluster and the {es} production cluster.
If not set, {kib} uses the value of the `elasticsearch.username` setting.
-`xpack.monitoring.elasticsearch.password`::
+`monitoring.ui.elasticsearch.password`::
Specifies the password used by {kib} monitoring to establish a persistent connection
in {kib} to the {es} monitoring cluster and to verify licensing status on the {es}
monitoring cluster.
@@ -66,7 +66,7 @@ both the {es} monitoring cluster and the {es} production cluster.
If not set, {kib} uses the value of the `elasticsearch.password` setting.
-`xpack.monitoring.elasticsearch.pingTimeout`::
+`monitoring.ui.elasticsearch.pingTimeout`::
Specifies the time in milliseconds to wait for {es} to respond to internal
health checks. By default, it matches the `elasticsearch.pingTimeout` setting,
which has a default value of `30000`.
@@ -77,11 +77,11 @@ which has a default value of `30000`.
These settings control how data is collected from {kib}.
-`xpack.monitoring.kibana.collection.enabled`::
+`monitoring.kibana.collection.enabled`::
Set to `true` (default) to enable data collection from the {kib} NodeJS server
for {kib} Dashboards to be featured in the Monitoring.
-`xpack.monitoring.kibana.collection.interval`::
+`monitoring.kibana.collection.interval`::
Specifies the number of milliseconds to wait in between data sampling on the
{kib} NodeJS server for the metrics that are displayed in the {kib} dashboards.
Defaults to `10000` (10 seconds).
@@ -96,24 +96,24 @@ However, the defaults work best in most circumstances. For more information
about configuring {kib}, see
{kibana-ref}/settings.html[Setting Kibana Server Properties].
-`xpack.monitoring.elasticsearch.logFetchCount`::
+`monitoring.ui.elasticsearch.logFetchCount`::
Specifies the number of log entries to display in the Monitoring UI. Defaults to
`10`. The maximum value is `50`.
-`xpack.monitoring.max_bucket_size`::
+`monitoring.ui.max_bucket_size`::
Specifies the number of term buckets to return out of the overall terms list when
performing terms aggregations to retrieve index and node metrics. For more
information about the `size` parameter, see
{ref}/search-aggregations-bucket-terms-aggregation.html#search-aggregations-bucket-terms-aggregation-size[Terms Aggregation].
Defaults to `10000`.
-`xpack.monitoring.min_interval_seconds`::
+`monitoring.ui.min_interval_seconds`::
Specifies the minimum number of seconds that a time bucket in a chart can
represent. Defaults to 10. If you modify the
-`xpack.monitoring.collection.interval` in `elasticsearch.yml`, use the same
+`monitoring.ui.collection.interval` in `elasticsearch.yml`, use the same
value in this setting.
-`xpack.monitoring.ui.enabled`::
+`monitoring.ui.enabled`::
Set to `false` to hide the Monitoring UI in {kib}. The monitoring back-end
continues to run as an agent for sending {kib} stats to the monitoring
cluster. Defaults to `true`.
@@ -127,7 +127,7 @@ better decisions about your container performance, rather than guessing based on
the overall machine performance. If you are not running your applications in a
container, then Cgroup statistics are not useful.
-`xpack.monitoring.ui.container.elasticsearch.enabled`::
+`monitoring.ui.container.elasticsearch.enabled`::
For {es} clusters that are running in containers, this setting changes the
*Node Listing* to display the CPU utilization based on the reported Cgroup
@@ -135,7 +135,7 @@ statistics. It also adds the calculated Cgroup CPU utilization to the
*Node Overview* page instead of the overall operating system's CPU
utilization. Defaults to `false`.
-`xpack.monitoring.ui.container.logstash.enabled`::
+`monitoring.ui.container.logstash.enabled`::
For {ls} nodes that are running in containers, this setting
changes the {ls} *Node Listing* to display the CPU utilization
diff --git a/docs/user/security/authentication/index.asciidoc b/docs/user/security/authentication/index.asciidoc
index 05aabfc343be9..a36b7b9c6d5f5 100644
--- a/docs/user/security/authentication/index.asciidoc
+++ b/docs/user/security/authentication/index.asciidoc
@@ -1,6 +1,6 @@
[role="xpack"]
[[kibana-authentication]]
-=== Authentication in Kibana
+=== Authentication in {kib}
++++
Authentication
++++
@@ -16,9 +16,9 @@
[[basic-authentication]]
==== Basic authentication
-Basic authentication requires a username and password to successfully log in to {kib}. It is enabled by default and based on the Native security realm provided by {es}. The basic authentication provider uses a Kibana provided login form, and supports authentication using the `Authorization` request header's `Basic` scheme.
+To successfully log in to {kib}, basic authentication requires a username and password. Basic authentication is enabled by default, and is based on the Native security realm or LDAP security realm that is provided by {es}. The basic authentication provider uses a {kib} provided login form, and supports authentication using the `Authorization` request header `Basic` scheme.
-The session cookies that are issued by the basic authentication provider are stateless. Therefore, logging out of Kibana when using the basic authentication provider clears the session cookies from the browser but does not invalidate the session cookie for reuse.
+The session cookies that are issued by the basic authentication provider are stateless. Therefore, logging out of {kib} when using the basic authentication provider clears the session cookies from the browser, but does not invalidate the session cookie for reuse.
For more information about basic authentication and built-in users, see
{ref}/setting-up-authentication.html[User authentication].
@@ -26,13 +26,13 @@ For more information about basic authentication and built-in users, see
[[token-authentication]]
==== Token authentication
-Token authentication allows users to login using the same Kibana provided login form as basic authentication. The token authentication provider is built on {es}'s token APIs. The bearer tokens returned by {es}'s {ref}/security-api-get-token.html[get token API] can be used directly with Kibana using the `Authorization` request header with the `Bearer` scheme.
+Token authentication allows users to login using the same {kib} provided login form as basic authentication, and is based on the Native security realm or LDAP security realm that is provided by {es}. The token authentication provider is built on {es} token APIs. The bearer tokens returned by {es}'s {ref}/security-api-get-token.html[get token API] can be used directly with {kib} using the `Authorization` request header with the `Bearer` scheme.
-The session cookies that are issued by the token authentication provider are stateful, and logging out of Kibana invalidates the session cookies for reuse.
+The session cookies that are issued by the token authentication provider are stateful, and logging out of {kib} invalidates the session cookies for reuse.
-Prior to configuring Kibana, ensure token support is enabled in Elasticsearch. See the {ref}/security-api-get-token.html[Elasticsearch token API] documentation for more information.
+Prior to configuring {kib}, ensure token support is enabled in {es}. See the {ref}/security-api-get-token.html[{es} token API] documentation for more information.
-To enable the token authentication provider in Kibana, set the following value in your `kibana.yml`:
+To enable the token authentication provider in {kib}, set the following value in your `kibana.yml`:
[source,yaml]
--------------------------------------------------------------------------------
@@ -67,7 +67,7 @@ server.ssl.clientAuthentication: required
xpack.security.authc.providers: [pki]
--------------------------------------------------------------------------------
-NOTE: Trusted CAs can also be specified in a PKCS #12 keystore bundled with your Kibana server certificate/key using
+NOTE: Trusted CAs can also be specified in a PKCS #12 keystore bundled with your {kib} server certificate/key using
`server.ssl.keystore.path` or in a separate trust store using `server.ssl.truststore.path`.
PKI support in {kib} is designed to be the primary (or sole) authentication method for users of that {kib} instance. However, you can configure both PKI and Basic authentication for the same {kib} instance:
@@ -128,7 +128,7 @@ Basic authentication is supported _only_ if `basic` authentication provider is e
At the beginning of the SAML handshake, {kib} stores the initial URL in the session cookie, so it can redirect the user back to that URL after successful SAML authentication.
If the URL is long, the session cookie might exceed the maximum size supported by the browser--typically 4KB for all cookies per domain. When this happens, the session cookie is truncated,
-or dropped completely, and you might experience sporadic failures during SAML authentication.
+or dropped completely, and you might experience sporadic failures during SAML authentication.
To remedy this issue, you can decrease the maximum
size of the URL that {kib} is allowed to store during the SAML handshake. The default value is 2KB.
@@ -185,7 +185,7 @@ Users will be able to access the login page and use Basic authentication by navi
[float]
==== Single sign-on provider details
-The following sections apply both to <> and <>
+The following sections apply both to <> and <>
[float]
===== Access and refresh tokens
diff --git a/renovate.json5 b/renovate.json5
index 6764ed38ba4cf..1fbe83476d4a8 100644
--- a/renovate.json5
+++ b/renovate.json5
@@ -25,7 +25,7 @@
'Team:Operations',
'renovate',
'v8.0.0',
- 'v7.6.0',
+ 'v7.7.0',
],
major: {
labels: [
@@ -33,7 +33,7 @@
'Team:Operations',
'renovate',
'v8.0.0',
- 'v7.6.0',
+ 'v7.7.0',
'renovate:major',
],
},
@@ -238,7 +238,7 @@
'Team:Operations',
'renovate',
'v8.0.0',
- 'v7.6.0',
+ 'v7.7.0',
':ml',
],
},
diff --git a/src/core/server/config/deprecation/core_deprecations.ts b/src/core/server/config/deprecation/core_deprecations.ts
index c63c9384da9d8..3aa7f9e2aa8ad 100644
--- a/src/core/server/config/deprecation/core_deprecations.ts
+++ b/src/core/server/config/deprecation/core_deprecations.ts
@@ -119,6 +119,56 @@ export const coreDeprecationProvider: ConfigDeprecationProvider = ({
renameFromRoot('xpack.telemetry.config', 'telemetry.config'),
renameFromRoot('xpack.telemetry.banner', 'telemetry.banner'),
renameFromRoot('xpack.telemetry.url', 'telemetry.url'),
+ // Monitoring renames
+ // TODO: Remove these from here once the monitoring plugin is migrated to NP
+ renameFromRoot('xpack.monitoring.enabled', 'monitoring.enabled'),
+ renameFromRoot('xpack.monitoring.ui.enabled', 'monitoring.ui.enabled'),
+ renameFromRoot(
+ 'xpack.monitoring.kibana.collection.enabled',
+ 'monitoring.kibana.collection.enabled'
+ ),
+ renameFromRoot('xpack.monitoring.max_bucket_size', 'monitoring.ui.max_bucket_size'),
+ renameFromRoot('xpack.monitoring.min_interval_seconds', 'monitoring.ui.min_interval_seconds'),
+ renameFromRoot(
+ 'xpack.monitoring.show_license_expiration',
+ 'monitoring.ui.show_license_expiration'
+ ),
+ renameFromRoot(
+ 'xpack.monitoring.ui.container.elasticsearch.enabled',
+ 'monitoring.ui.container.elasticsearch.enabled'
+ ),
+ renameFromRoot(
+ 'xpack.monitoring.ui.container.logstash.enabled',
+ 'monitoring.ui.container.logstash.enabled'
+ ),
+ renameFromRoot(
+ 'xpack.monitoring.tests.cloud_detector.enabled',
+ 'monitoring.tests.cloud_detector.enabled'
+ ),
+ renameFromRoot(
+ 'xpack.monitoring.kibana.collection.interval',
+ 'monitoring.kibana.collection.interval'
+ ),
+ renameFromRoot('xpack.monitoring.elasticsearch.hosts', 'monitoring.ui.elasticsearch.hosts'),
+ renameFromRoot('xpack.monitoring.elasticsearch.username', 'monitoring.ui.elasticsearch.username'),
+ renameFromRoot('xpack.monitoring.elasticsearch.password', 'monitoring.ui.elasticsearch.password'),
+ renameFromRoot(
+ 'xpack.monitoring.xpack_api_polling_frequency_millis',
+ 'monitoring.xpack_api_polling_frequency_millis'
+ ),
+ renameFromRoot(
+ 'xpack.monitoring.cluster_alerts.email_notifications.enabled',
+ 'monitoring.cluster_alerts.email_notifications.enabled'
+ ),
+ renameFromRoot(
+ 'xpack.monitoring.cluster_alerts.email_notifications.email_address',
+ 'monitoring.cluster_alerts.email_notifications.email_address'
+ ),
+ renameFromRoot('xpack.monitoring.ccs.enabled', 'monitoring.ui.ccs.enabled'),
+ renameFromRoot(
+ 'xpack.monitoring.elasticsearch.logFetchCount',
+ 'monitoring.ui.elasticsearch.logFetchCount'
+ ),
configPathDeprecation,
dataPathDeprecation,
rewriteBasePathDeprecation,
diff --git a/src/core/server/http/router/response_adapter.ts b/src/core/server/http/router/response_adapter.ts
index e5dabc99f4442..948b4596e2658 100644
--- a/src/core/server/http/router/response_adapter.ts
+++ b/src/core/server/http/router/response_adapter.ts
@@ -19,6 +19,7 @@
import { ResponseObject as HapiResponseObject, ResponseToolkit as HapiResponseToolkit } from 'hapi';
import typeDetect from 'type-detect';
import Boom from 'boom';
+import * as stream from 'stream';
import {
HttpResponsePayload,
@@ -112,8 +113,18 @@ export class HapiResponseAdapter {
return response;
}
- private toError(kibanaResponse: KibanaResponse) {
+ private toError(kibanaResponse: KibanaResponse) {
const { payload } = kibanaResponse;
+
+ // Special case for when we are proxying requests and want to enable streaming back error responses opaquely.
+ if (Buffer.isBuffer(payload) || payload instanceof stream.Readable) {
+ const response = this.responseToolkit
+ .response(kibanaResponse.payload)
+ .code(kibanaResponse.status);
+ setHeaders(response, kibanaResponse.options.headers);
+ return response;
+ }
+
// we use for BWC with Boom payload for error responses - {error: string, message: string, statusCode: string}
const error = new Boom('', {
statusCode: kibanaResponse.status,
diff --git a/src/dev/renovate/config.ts b/src/dev/renovate/config.ts
index c7056ba69449a..fae424982c930 100644
--- a/src/dev/renovate/config.ts
+++ b/src/dev/renovate/config.ts
@@ -21,7 +21,7 @@ import { RENOVATE_PACKAGE_GROUPS } from './package_groups';
import { PACKAGE_GLOBS } from './package_globs';
import { wordRegExp, maybeFlatMap, maybeMap, getTypePackageName } from './utils';
-const DEFAULT_LABELS = ['release_note:skip', 'Team:Operations', 'renovate', 'v8.0.0', 'v7.6.0'];
+const DEFAULT_LABELS = ['release_note:skip', 'Team:Operations', 'renovate', 'v8.0.0', 'v7.7.0'];
export const RENOVATE_CONFIG = {
extends: ['config:base'],
diff --git a/src/legacy/core_plugins/console/__tests__/index.js b/src/legacy/core_plugins/console/__tests__/index.js
deleted file mode 100644
index c811bb3f89bba..0000000000000
--- a/src/legacy/core_plugins/console/__tests__/index.js
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Licensed to Elasticsearch B.V. under one or more contributor
- * license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright
- * ownership. Elasticsearch B.V. licenses this file to you under
- * the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import { Deprecations } from '../../../deprecation';
-import expect from '@kbn/expect';
-import index from '../index';
-import { noop } from 'lodash';
-import sinon from 'sinon';
-
-describe('plugins/console', function() {
- describe('#deprecate()', function() {
- let transformDeprecations;
-
- before(function() {
- const Plugin = function(options) {
- this.deprecations = options.deprecations;
- };
-
- const plugin = index({ Plugin });
-
- const deprecations = plugin.deprecations(Deprecations);
- transformDeprecations = (settings, log = noop) => {
- deprecations.forEach(deprecation => deprecation(settings, log));
- };
- });
-
- describe('proxyConfig', function() {
- it('leaves the proxyConfig settings', function() {
- const proxyConfigOne = {};
- const proxyConfigTwo = {};
- const settings = {
- proxyConfig: [proxyConfigOne, proxyConfigTwo],
- };
-
- transformDeprecations(settings);
- expect(settings.proxyConfig[0]).to.be(proxyConfigOne);
- expect(settings.proxyConfig[1]).to.be(proxyConfigTwo);
- });
-
- it('logs a warning when proxyConfig is specified', function() {
- const settings = {
- proxyConfig: [],
- };
-
- const log = sinon.spy();
- transformDeprecations(settings, log);
- expect(log.calledOnce).to.be(true);
- });
-
- it(`doesn't log a warning when proxyConfig isn't specified`, function() {
- const settings = {};
-
- const log = sinon.spy();
- transformDeprecations(settings, log);
- expect(log.called).to.be(false);
- });
- });
- });
-});
diff --git a/src/legacy/core_plugins/console/index.ts b/src/legacy/core_plugins/console/index.ts
deleted file mode 100644
index cec6d0a4219ae..0000000000000
--- a/src/legacy/core_plugins/console/index.ts
+++ /dev/null
@@ -1,187 +0,0 @@
-/*
- * Licensed to Elasticsearch B.V. under one or more contributor
- * license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright
- * ownership. Elasticsearch B.V. licenses this file to you under
- * the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import Boom from 'boom';
-import { first } from 'rxjs/operators';
-import { resolve, join } from 'path';
-import url from 'url';
-import { has, isEmpty, head, pick } from 'lodash';
-
-// @ts-ignore
-import { addProcessorDefinition } from './server/api_server/es_6_0/ingest';
-// @ts-ignore
-import { resolveApi } from './server/api_server/server';
-// @ts-ignore
-import { addExtensionSpecFilePath } from './server/api_server/spec';
-// @ts-ignore
-import { setHeaders } from './server/set_headers';
-// @ts-ignore
-import { ProxyConfigCollection, getElasticsearchProxyConfig, createProxyRoute } from './server';
-
-function filterHeaders(originalHeaders: any, headersToKeep: any) {
- const normalizeHeader = function(header: any) {
- if (!header) {
- return '';
- }
- header = header.toString();
- return header.trim().toLowerCase();
- };
-
- // Normalize list of headers we want to allow in upstream request
- const headersToKeepNormalized = headersToKeep.map(normalizeHeader);
-
- return pick(originalHeaders, headersToKeepNormalized);
-}
-
-// eslint-disable-next-line
-export default function(kibana: any) {
- const npSrc = resolve(__dirname, 'public/np_ready');
-
- let defaultVars: any;
- return new kibana.Plugin({
- id: 'console',
- require: ['elasticsearch'],
-
- config(Joi: any) {
- return Joi.object({
- enabled: Joi.boolean().default(true),
- proxyFilter: Joi.array()
- .items(Joi.string())
- .single()
- .default(['.*']),
- ssl: Joi.object({
- verify: Joi.boolean(),
- }).default(),
- proxyConfig: Joi.array()
- .items(
- Joi.object().keys({
- match: Joi.object().keys({
- protocol: Joi.string().default('*'),
- host: Joi.string().default('*'),
- port: Joi.string().default('*'),
- path: Joi.string().default('*'),
- }),
-
- timeout: Joi.number(),
- ssl: Joi.object()
- .keys({
- verify: Joi.boolean(),
- ca: Joi.array()
- .single()
- .items(Joi.string()),
- cert: Joi.string(),
- key: Joi.string(),
- })
- .default(),
- })
- )
- .default(),
- }).default();
- },
-
- deprecations() {
- return [
- (settings: any, log: any) => {
- if (has(settings, 'proxyConfig')) {
- log(
- 'Config key "proxyConfig" is deprecated. Configuration can be inferred from the "elasticsearch" settings'
- );
- }
- },
- ];
- },
-
- uiCapabilities() {
- return {
- dev_tools: {
- show: true,
- save: true,
- },
- };
- },
-
- async init(server: any, options: any) {
- server.expose('addExtensionSpecFilePath', addExtensionSpecFilePath);
- server.expose('addProcessorDefinition', addProcessorDefinition);
-
- if (options.ssl && options.ssl.verify) {
- throw new Error('sense.ssl.verify is no longer supported.');
- }
-
- const config = server.config();
- const legacyEsConfig = await server.newPlatform.__internals.elasticsearch.legacy.config$
- .pipe(first())
- .toPromise();
- const proxyConfigCollection = new ProxyConfigCollection(options.proxyConfig);
- const proxyPathFilters = options.proxyFilter.map((str: string) => new RegExp(str));
-
- defaultVars = {
- elasticsearchUrl: url.format(
- Object.assign(url.parse(head(legacyEsConfig.hosts)), { auth: false })
- ),
- };
-
- server.route(
- createProxyRoute({
- hosts: legacyEsConfig.hosts,
- pathFilters: proxyPathFilters,
- getConfigForReq(req: any, uri: any) {
- const filteredHeaders = filterHeaders(
- req.headers,
- legacyEsConfig.requestHeadersWhitelist
- );
- const headers = setHeaders(filteredHeaders, legacyEsConfig.customHeaders);
-
- if (!isEmpty(config.get('console.proxyConfig'))) {
- return {
- ...proxyConfigCollection.configForUri(uri),
- headers,
- };
- }
-
- return {
- ...getElasticsearchProxyConfig(legacyEsConfig),
- headers,
- };
- },
- })
- );
-
- server.route({
- path: '/api/console/api_server',
- method: ['GET', 'POST'],
- handler(req: any, h: any) {
- const { sense_version: version, apis } = req.query;
- if (!apis) {
- throw Boom.badRequest('"apis" is a required param.');
- }
-
- return resolveApi(version, apis.split(','), h);
- },
- });
- },
-
- uiExports: {
- devTools: [resolve(__dirname, 'public/legacy')],
- styleSheetPaths: resolve(npSrc, 'application/styles/index.scss'),
- injectDefaultVars: () => defaultVars,
- noParse: [join(npSrc, 'application/models/legacy_core_editor/mode/worker/worker.js')],
- },
- } as any);
-}
diff --git a/src/legacy/core_plugins/console/package.json b/src/legacy/core_plugins/console/package.json
deleted file mode 100644
index 84ebcb95889c7..0000000000000
--- a/src/legacy/core_plugins/console/package.json
+++ /dev/null
@@ -1,8 +0,0 @@
-{
- "author": "Boaz Leskes ",
- "contributors": [
- "Spencer Alger "
- ],
- "name": "console",
- "version": "kibana"
-}
diff --git a/src/legacy/core_plugins/console/public/legacy.ts b/src/legacy/core_plugins/console/public/legacy.ts
deleted file mode 100644
index d151a27d27e5c..0000000000000
--- a/src/legacy/core_plugins/console/public/legacy.ts
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Licensed to Elasticsearch B.V. under one or more contributor
- * license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright
- * ownership. Elasticsearch B.V. licenses this file to you under
- * the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import { npSetup, npStart } from 'ui/new_platform';
-import { I18nContext } from 'ui/i18n';
-import chrome from 'ui/chrome';
-import { FeatureCatalogueCategory } from 'ui/registry/feature_catalogue';
-
-import { plugin } from './np_ready';
-import { DevToolsSetup } from '../../../../plugins/dev_tools/public';
-import { HomePublicPluginSetup } from '../../../../plugins/home/public';
-import { UsageCollectionSetup } from '../../../../plugins/usage_collection/public';
-
-export interface XPluginSet {
- usageCollection: UsageCollectionSetup;
- dev_tools: DevToolsSetup;
- home: HomePublicPluginSetup;
- __LEGACY: {
- I18nContext: any;
- elasticsearchUrl: string;
- category: FeatureCatalogueCategory;
- };
-}
-
-const pluginInstance = plugin({} as any);
-
-(async () => {
- await pluginInstance.setup(npSetup.core, {
- ...npSetup.plugins,
- __LEGACY: {
- elasticsearchUrl: chrome.getInjected('elasticsearchUrl'),
- I18nContext,
- category: FeatureCatalogueCategory.ADMIN,
- },
- });
- await pluginInstance.start(npStart.core);
-})();
diff --git a/src/legacy/core_plugins/console/server/__tests__/proxy_route/headers.js b/src/legacy/core_plugins/console/server/__tests__/proxy_route/headers.js
deleted file mode 100644
index 3a8233775f9b7..0000000000000
--- a/src/legacy/core_plugins/console/server/__tests__/proxy_route/headers.js
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- * Licensed to Elasticsearch B.V. under one or more contributor
- * license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright
- * ownership. Elasticsearch B.V. licenses this file to you under
- * the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import { request } from 'http';
-
-import sinon from 'sinon';
-import expect from '@kbn/expect';
-import { Server } from 'hapi';
-import * as requestModule from '../../request';
-
-import { createProxyRoute } from '../../';
-
-import { createResponseStub } from './stubs';
-
-describe('Console Proxy Route', () => {
- const sandbox = sinon.createSandbox();
- const teardowns = [];
- let setup;
-
- beforeEach(() => {
- sandbox.stub(requestModule, 'sendRequest').callsFake(createResponseStub());
-
- setup = () => {
- const server = new Server();
- server.route(
- createProxyRoute({
- hosts: ['http://localhost:9200'],
- })
- );
-
- teardowns.push(() => server.stop());
-
- return { server };
- };
- });
-
- afterEach(async () => {
- sandbox.restore();
- await Promise.all(teardowns.splice(0).map(fn => fn()));
- });
-
- describe('headers', function() {
- this.timeout(Infinity);
-
- it('forwards the remote header info', async () => {
- const { server } = setup();
- await server.start();
-
- const resp = await new Promise(resolve => {
- request(
- {
- protocol: server.info.protocol + ':',
- host: server.info.address,
- port: server.info.port,
- method: 'POST',
- path: '/api/console/proxy?method=GET&path=/',
- },
- resolve
- ).end();
- });
-
- resp.destroy();
-
- sinon.assert.calledOnce(requestModule.sendRequest);
- const { headers } = requestModule.sendRequest.getCall(0).args[0];
- expect(headers)
- .to.have.property('x-forwarded-for')
- .and.not.be('');
- expect(headers)
- .to.have.property('x-forwarded-port')
- .and.not.be('');
- expect(headers)
- .to.have.property('x-forwarded-proto')
- .and.not.be('');
- expect(headers)
- .to.have.property('x-forwarded-host')
- .and.not.be('');
- });
- });
-});
diff --git a/src/legacy/core_plugins/console/server/__tests__/proxy_route/params.js b/src/legacy/core_plugins/console/server/__tests__/proxy_route/params.js
deleted file mode 100644
index 2cf09f96e7b72..0000000000000
--- a/src/legacy/core_plugins/console/server/__tests__/proxy_route/params.js
+++ /dev/null
@@ -1,170 +0,0 @@
-/*
- * Licensed to Elasticsearch B.V. under one or more contributor
- * license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright
- * ownership. Elasticsearch B.V. licenses this file to you under
- * the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import { Agent } from 'http';
-
-import sinon from 'sinon';
-import * as requestModule from '../../request';
-import expect from '@kbn/expect';
-import { Server } from 'hapi';
-
-import { createProxyRoute } from '../../';
-
-import { createResponseStub } from './stubs';
-
-describe('Console Proxy Route', () => {
- const sandbox = sinon.createSandbox();
- const teardowns = [];
- let setup;
-
- beforeEach(() => {
- sandbox.stub(requestModule, 'sendRequest').callsFake(createResponseStub());
-
- setup = () => {
- const server = new Server();
- teardowns.push(() => server.stop());
- return { server };
- };
- });
-
- afterEach(async () => {
- sandbox.restore();
- await Promise.all(teardowns.splice(0).map(fn => fn()));
- });
-
- describe('params', () => {
- describe('pathFilters', () => {
- describe('no matches', () => {
- it('rejects with 403', async () => {
- const { server } = setup();
- server.route(
- createProxyRoute({
- pathFilters: [/^\/foo\//, /^\/bar\//],
- })
- );
-
- const { statusCode } = await server.inject({
- method: 'POST',
- url: '/api/console/proxy?method=GET&path=/baz/id',
- });
-
- expect(statusCode).to.be(403);
- });
- });
- describe('one match', () => {
- it('allows the request', async () => {
- const { server } = setup();
- server.route(
- createProxyRoute({
- hosts: ['http://localhost:9200'],
- pathFilters: [/^\/foo\//, /^\/bar\//],
- })
- );
-
- const { statusCode } = await server.inject({
- method: 'POST',
- url: '/api/console/proxy?method=GET&path=/foo/id',
- });
-
- expect(statusCode).to.be(200);
- sinon.assert.calledOnce(requestModule.sendRequest);
- });
- });
- describe('all match', () => {
- it('allows the request', async () => {
- const { server } = setup();
- server.route(
- createProxyRoute({
- hosts: ['http://localhost:9200'],
- pathFilters: [/^\/foo\//, /^\/bar\//],
- })
- );
-
- const { statusCode } = await server.inject({
- method: 'POST',
- url: '/api/console/proxy?method=GET&path=/foo/id',
- });
-
- expect(statusCode).to.be(200);
- sinon.assert.calledOnce(requestModule.sendRequest);
- });
- });
- });
-
- describe('getConfigForReq()', () => {
- it('passes the request and targeted uri', async () => {
- const { server } = setup();
-
- const getConfigForReq = sinon.stub().returns({});
-
- server.route(createProxyRoute({ hosts: ['http://localhost:9200'], getConfigForReq }));
- await server.inject({
- method: 'POST',
- url: '/api/console/proxy?method=HEAD&path=/index/id',
- });
-
- sinon.assert.calledOnce(getConfigForReq);
- const args = getConfigForReq.getCall(0).args;
- expect(args[0]).to.have.property('path', '/api/console/proxy');
- expect(args[0]).to.have.property('method', 'post');
- expect(args[0])
- .to.have.property('query')
- .eql({ method: 'HEAD', path: '/index/id' });
- expect(args[1]).to.be('http://localhost:9200/index/id?pretty=true');
- });
-
- it('sends the returned timeout, agent, and base headers to request', async () => {
- const { server } = setup();
-
- const timeout = Math.round(Math.random() * 10000);
- const agent = new Agent();
- const rejectUnauthorized = !!Math.round(Math.random());
- const headers = {
- foo: 'bar',
- baz: 'bop',
- };
-
- server.route(
- createProxyRoute({
- hosts: ['http://localhost:9200'],
- getConfigForReq: () => ({
- timeout,
- agent,
- headers,
- rejectUnauthorized,
- }),
- })
- );
-
- await server.inject({
- method: 'POST',
- url: '/api/console/proxy?method=HEAD&path=/index/id',
- });
-
- sinon.assert.calledOnce(requestModule.sendRequest);
- const opts = requestModule.sendRequest.getCall(0).args[0];
- expect(opts).to.have.property('timeout', timeout);
- expect(opts).to.have.property('agent', agent);
- expect(opts).to.have.property('rejectUnauthorized', rejectUnauthorized);
- expect(opts.headers).to.have.property('foo', 'bar');
- expect(opts.headers).to.have.property('baz', 'bop');
- });
- });
- });
-});
diff --git a/src/legacy/core_plugins/console/server/__tests__/proxy_route/query_string.js b/src/legacy/core_plugins/console/server/__tests__/proxy_route/query_string.js
deleted file mode 100644
index 6b98702131d91..0000000000000
--- a/src/legacy/core_plugins/console/server/__tests__/proxy_route/query_string.js
+++ /dev/null
@@ -1,137 +0,0 @@
-/*
- * Licensed to Elasticsearch B.V. under one or more contributor
- * license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright
- * ownership. Elasticsearch B.V. licenses this file to you under
- * the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import sinon from 'sinon';
-import * as requestModule from '../../request';
-import expect from '@kbn/expect';
-import { Server } from 'hapi';
-
-import { createProxyRoute } from '../../';
-
-import { createResponseStub } from './stubs';
-
-describe('Console Proxy Route', () => {
- const sandbox = sinon.createSandbox();
- const teardowns = [];
- let request;
-
- beforeEach(() => {
- sandbox.stub(requestModule, 'sendRequest').callsFake(createResponseStub());
-
- request = async (method, path) => {
- const server = new Server();
- server.route(
- createProxyRoute({
- hosts: ['http://localhost:9200'],
- })
- );
-
- teardowns.push(() => server.stop());
-
- const params = [];
- if (path != null) params.push(`path=${path}`);
- if (method != null) params.push(`method=${method}`);
- return await server.inject({
- method: 'POST',
- url: `/api/console/proxy${params.length ? `?${params.join('&')}` : ''}`,
- });
- };
- });
-
- afterEach(async () => {
- sandbox.restore();
- await Promise.all(teardowns.splice(0).map(fn => fn()));
- });
-
- describe('query string', () => {
- describe('path', () => {
- describe('contains full url', () => {
- it('treats the url as a path', async () => {
- await request('GET', 'http://evil.com/test');
- sinon.assert.calledOnce(requestModule.sendRequest);
- const args = requestModule.sendRequest.getCall(0).args;
- expect(args[0].uri.href).to.be('http://localhost:9200/http://evil.com/test?pretty=true');
- });
- });
- describe('is missing', () => {
- it('returns a 400 error', async () => {
- const { statusCode } = await request('GET', undefined);
- expect(statusCode).to.be(400);
- sinon.assert.notCalled(requestModule.sendRequest);
- });
- });
- describe('is empty', () => {
- it('returns a 400 error', async () => {
- const { statusCode } = await request('GET', '');
- expect(statusCode).to.be(400);
- sinon.assert.notCalled(requestModule.sendRequest);
- });
- });
- describe('starts with a slash', () => {
- it('combines well with the base url', async () => {
- await request('GET', '/index/id');
- sinon.assert.calledOnce(requestModule.sendRequest);
- expect(requestModule.sendRequest.getCall(0).args[0].uri.href).to.be(
- 'http://localhost:9200/index/id?pretty=true'
- );
- });
- });
- describe(`doesn't start with a slash`, () => {
- it('combines well with the base url', async () => {
- await request('GET', 'index/id');
- sinon.assert.calledOnce(requestModule.sendRequest);
- expect(requestModule.sendRequest.getCall(0).args[0].uri.href).to.be(
- 'http://localhost:9200/index/id?pretty=true'
- );
- });
- });
- });
- describe('method', () => {
- describe('is missing', () => {
- it('returns a 400 error', async () => {
- const { statusCode } = await request(null, '/');
- expect(statusCode).to.be(400);
- sinon.assert.notCalled(requestModule.sendRequest);
- });
- });
- describe('is empty', () => {
- it('returns a 400 error', async () => {
- const { statusCode } = await request('', '/');
- expect(statusCode).to.be(400);
- sinon.assert.notCalled(requestModule.sendRequest);
- });
- });
- describe('is an invalid http method', () => {
- it('returns a 400 error', async () => {
- const { statusCode } = await request('foo', '/');
- expect(statusCode).to.be(400);
- sinon.assert.notCalled(requestModule.sendRequest);
- });
- });
- describe('is mixed case', () => {
- it('sends a request with the exact method', async () => {
- const { statusCode } = await request('HeAd', '/');
- expect(statusCode).to.be(200);
- sinon.assert.calledOnce(requestModule.sendRequest);
- expect(requestModule.sendRequest.getCall(0).args[0].method).to.be('HeAd');
- });
- });
- });
- });
-});
diff --git a/src/legacy/core_plugins/console/server/proxy_route.ts b/src/legacy/core_plugins/console/server/proxy_route.ts
deleted file mode 100644
index f67c97443ba07..0000000000000
--- a/src/legacy/core_plugins/console/server/proxy_route.ts
+++ /dev/null
@@ -1,171 +0,0 @@
-/*
- * Licensed to Elasticsearch B.V. under one or more contributor
- * license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright
- * ownership. Elasticsearch B.V. licenses this file to you under
- * the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import Joi from 'joi';
-import * as url from 'url';
-import { IncomingMessage } from 'http';
-import Boom from 'boom';
-import { trimLeft, trimRight } from 'lodash';
-import { sendRequest } from './request';
-
-function toURL(base: string, path: string) {
- const urlResult = new url.URL(`${trimRight(base, '/')}/${trimLeft(path, '/')}`);
- // Appending pretty here to have Elasticsearch do the JSON formatting, as doing
- // in JS can lead to data loss (7.0 will get munged into 7, thus losing indication of
- // measurement precision)
- if (!urlResult.searchParams.get('pretty')) {
- urlResult.searchParams.append('pretty', 'true');
- }
- return urlResult;
-}
-
-function getProxyHeaders(req: any) {
- const headers = Object.create(null);
-
- // Scope this proto-unsafe functionality to where it is being used.
- function extendCommaList(obj: Record, property: string, value: any) {
- obj[property] = (obj[property] ? obj[property] + ',' : '') + value;
- }
-
- if (req.info.remotePort && req.info.remoteAddress) {
- // see https://git.io/vytQ7
- extendCommaList(headers, 'x-forwarded-for', req.info.remoteAddress);
- extendCommaList(headers, 'x-forwarded-port', req.info.remotePort);
- extendCommaList(headers, 'x-forwarded-proto', req.server.info.protocol);
- extendCommaList(headers, 'x-forwarded-host', req.info.host);
- }
-
- const contentType = req.headers['content-type'];
- if (contentType) {
- headers['content-type'] = contentType;
- }
- return headers;
-}
-
-export const createProxyRoute = ({
- hosts,
- pathFilters = [/.*/],
- getConfigForReq = () => ({}),
-}: {
- hosts: string[];
- pathFilters: RegExp[];
- getConfigForReq: (...args: any[]) => any;
-}) => ({
- path: '/api/console/proxy',
- method: 'POST',
- config: {
- tags: ['access:console'],
- payload: {
- output: 'stream',
- parse: false,
- },
- validate: {
- payload: true,
- query: Joi.object()
- .keys({
- method: Joi.string()
- .valid('HEAD', 'GET', 'POST', 'PUT', 'DELETE')
- .insensitive()
- .required(),
- path: Joi.string().required(),
- })
- .unknown(true),
- },
-
- pre: [
- function filterPath(req: any) {
- const { path } = req.query;
-
- if (pathFilters.some(re => re.test(path))) {
- return null;
- }
-
- const err = Boom.forbidden();
- err.output.payload = `Error connecting to '${path}':\n\nUnable to send requests to that path.` as any;
- err.output.headers['content-type'] = 'text/plain';
- throw err;
- },
- ],
-
- handler: async (req: any, h: any) => {
- const { payload, query } = req;
- const { path, method } = query;
-
- let esIncomingMessage: IncomingMessage;
-
- for (let idx = 0; idx < hosts.length; ++idx) {
- const host = hosts[idx];
- try {
- const uri = toURL(host, path);
-
- // Because this can technically be provided by a settings-defined proxy config, we need to
- // preserve these property names to maintain BWC.
- const { timeout, agent, headers, rejectUnauthorized } = getConfigForReq(
- req,
- uri.toString()
- );
-
- const requestHeaders = {
- ...headers,
- ...getProxyHeaders(req),
- };
-
- esIncomingMessage = await sendRequest({
- method,
- headers: requestHeaders,
- uri,
- timeout,
- payload,
- rejectUnauthorized,
- agent,
- });
-
- break;
- } catch (e) {
- if (e.code !== 'ECONNREFUSED') {
- throw Boom.boomify(e);
- }
- if (idx === hosts.length - 1) {
- throw Boom.badGateway('Could not reach any configured nodes.');
- }
- // Otherwise, try the next host...
- }
- }
-
- const {
- statusCode,
- statusMessage,
- headers: { warning },
- } = esIncomingMessage!;
-
- if (method.toUpperCase() !== 'HEAD') {
- return h
- .response(esIncomingMessage!)
- .code(statusCode)
- .header('warning', warning!);
- } else {
- return h
- .response(`${statusCode} - ${statusMessage}`)
- .code(statusCode)
- .type('text/plain')
- .header('warning', warning!);
- }
- },
- },
-});
diff --git a/src/legacy/core_plugins/console_legacy/index.ts b/src/legacy/core_plugins/console_legacy/index.ts
new file mode 100644
index 0000000000000..65547e1ee5406
--- /dev/null
+++ b/src/legacy/core_plugins/console_legacy/index.ts
@@ -0,0 +1,51 @@
+/*
+ * Licensed to Elasticsearch B.V. under one or more contributor
+ * license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright
+ * ownership. Elasticsearch B.V. licenses this file to you under
+ * the Apache License, Version 2.0 (the "License"); you may
+ * not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import { first } from 'rxjs/operators';
+import { head } from 'lodash';
+import { resolve } from 'path';
+import url from 'url';
+
+// TODO: Remove this hack once we can get the ES config we need for Console proxy a better way.
+let _legacyEsConfig: any;
+export const readLegacyEsConfig = () => {
+ return _legacyEsConfig;
+};
+
+// eslint-disable-next-line import/no-default-export
+export default function(kibana: any) {
+ return new kibana.Plugin({
+ id: 'console_legacy',
+
+ async init(server: any) {
+ _legacyEsConfig = await server.newPlatform.__internals.elasticsearch.legacy.config$
+ .pipe(first())
+ .toPromise();
+ },
+
+ uiExports: {
+ styleSheetPaths: resolve(__dirname, 'public/styles/index.scss'),
+ injectDefaultVars: () => ({
+ elasticsearchUrl: url.format(
+ Object.assign(url.parse(head(_legacyEsConfig.hosts)), { auth: false })
+ ),
+ }),
+ },
+ } as any);
+}
diff --git a/src/legacy/core_plugins/console_legacy/package.json b/src/legacy/core_plugins/console_legacy/package.json
new file mode 100644
index 0000000000000..b78807daed959
--- /dev/null
+++ b/src/legacy/core_plugins/console_legacy/package.json
@@ -0,0 +1,4 @@
+{
+ "name": "console_legacy",
+ "version": "kibana"
+}
diff --git a/src/legacy/core_plugins/console/public/np_ready/application/styles/_app.scss b/src/legacy/core_plugins/console_legacy/public/styles/_app.scss
similarity index 100%
rename from src/legacy/core_plugins/console/public/np_ready/application/styles/_app.scss
rename to src/legacy/core_plugins/console_legacy/public/styles/_app.scss
diff --git a/src/legacy/core_plugins/console/public/np_ready/application/styles/components/_help.scss b/src/legacy/core_plugins/console_legacy/public/styles/components/_help.scss
similarity index 100%
rename from src/legacy/core_plugins/console/public/np_ready/application/styles/components/_help.scss
rename to src/legacy/core_plugins/console_legacy/public/styles/components/_help.scss
diff --git a/src/legacy/core_plugins/console/public/np_ready/application/styles/components/_history.scss b/src/legacy/core_plugins/console_legacy/public/styles/components/_history.scss
similarity index 100%
rename from src/legacy/core_plugins/console/public/np_ready/application/styles/components/_history.scss
rename to src/legacy/core_plugins/console_legacy/public/styles/components/_history.scss
diff --git a/src/legacy/core_plugins/console/public/np_ready/application/styles/components/_index.scss b/src/legacy/core_plugins/console_legacy/public/styles/components/_index.scss
similarity index 100%
rename from src/legacy/core_plugins/console/public/np_ready/application/styles/components/_index.scss
rename to src/legacy/core_plugins/console_legacy/public/styles/components/_index.scss
diff --git a/src/legacy/core_plugins/console/public/np_ready/application/styles/index.scss b/src/legacy/core_plugins/console_legacy/public/styles/index.scss
similarity index 100%
rename from src/legacy/core_plugins/console/public/np_ready/application/styles/index.scss
rename to src/legacy/core_plugins/console_legacy/public/styles/index.scss
diff --git a/src/legacy/core_plugins/kibana/public/dashboard/np_ready/application.ts b/src/legacy/core_plugins/kibana/public/dashboard/np_ready/application.ts
index d9c0579638047..1a0a99311d06b 100644
--- a/src/legacy/core_plugins/kibana/public/dashboard/np_ready/application.ts
+++ b/src/legacy/core_plugins/kibana/public/dashboard/np_ready/application.ts
@@ -19,7 +19,6 @@
import { EuiConfirmModal, EuiIcon } from '@elastic/eui';
import angular, { IModule } from 'angular';
-import { History } from 'history';
import { i18nDirective, i18nFilter, I18nProvider } from '@kbn/i18n/angular';
import {
AppMountContext,
@@ -28,7 +27,7 @@ import {
LegacyCoreStart,
SavedObjectsClientContract,
} from 'kibana/public';
-import { IKbnUrlStateStorage, Storage } from '../../../../../../plugins/kibana_utils/public';
+import { Storage } from '../../../../../../plugins/kibana_utils/public';
import {
configureAppAngularModule,
confirmModalFactory,
@@ -66,8 +65,6 @@ export interface RenderDeps {
embeddables: IEmbeddableStart;
localStorage: Storage;
share: SharePluginStart;
- history: History;
- kbnUrlStateStorage: IKbnUrlStateStorage;
}
let angularModuleInstance: IModule | null = null;
diff --git a/src/legacy/core_plugins/kibana/public/dashboard/np_ready/dashboard_app.tsx b/src/legacy/core_plugins/kibana/public/dashboard/np_ready/dashboard_app.tsx
index 367db6644ff57..a48c165116304 100644
--- a/src/legacy/core_plugins/kibana/public/dashboard/np_ready/dashboard_app.tsx
+++ b/src/legacy/core_plugins/kibana/public/dashboard/np_ready/dashboard_app.tsx
@@ -19,6 +19,7 @@
import moment from 'moment';
import { Subscription } from 'rxjs';
+import { History } from 'history';
import { IInjector } from '../legacy_imports';
@@ -35,6 +36,7 @@ import {
import { DashboardAppController } from './dashboard_app_controller';
import { RenderDeps } from './application';
+import { IKbnUrlStateStorage } from '../../../../../../plugins/kibana_utils/public/';
export interface DashboardAppScope extends ng.IScope {
dash: SavedObjectDashboard;
@@ -96,7 +98,9 @@ export function initDashboardAppDirective(app: any, deps: RenderDeps) {
$route: any,
$routeParams: {
id?: string;
- }
+ },
+ kbnUrlStateStorage: IKbnUrlStateStorage,
+ history: History
) =>
new DashboardAppController({
$route,
@@ -105,6 +109,8 @@ export function initDashboardAppDirective(app: any, deps: RenderDeps) {
config,
confirmModal,
indexPatterns: deps.npDataStart.indexPatterns,
+ kbnUrlStateStorage,
+ history,
...deps,
}),
};
diff --git a/src/legacy/core_plugins/kibana/public/dashboard/np_ready/dashboard_app_controller.tsx b/src/legacy/core_plugins/kibana/public/dashboard/np_ready/dashboard_app_controller.tsx
index e85054cd7fb34..a8eec9c2504a7 100644
--- a/src/legacy/core_plugins/kibana/public/dashboard/np_ready/dashboard_app_controller.tsx
+++ b/src/legacy/core_plugins/kibana/public/dashboard/np_ready/dashboard_app_controller.tsx
@@ -24,6 +24,7 @@ import angular from 'angular';
import { Subscription } from 'rxjs';
import { map } from 'rxjs/operators';
+import { History } from 'history';
import { DashboardEmptyScreen, DashboardEmptyScreenProps } from './dashboard_empty_screen';
import {
@@ -77,7 +78,11 @@ import {
SavedObjectFinderProps,
SavedObjectFinderUi,
} from '../../../../../../plugins/kibana_react/public';
-import { removeQueryParam, unhashUrl } from '../../../../../../plugins/kibana_utils/public';
+import {
+ IKbnUrlStateStorage,
+ removeQueryParam,
+ unhashUrl,
+} from '../../../../../../plugins/kibana_utils/public';
export interface DashboardAppControllerDependencies extends RenderDeps {
$scope: DashboardAppScope;
@@ -87,6 +92,8 @@ export interface DashboardAppControllerDependencies extends RenderDeps {
dashboardConfig: any;
config: any;
confirmModal: ConfirmModalFn;
+ history: History;
+ kbnUrlStateStorage: IKbnUrlStateStorage;
}
export class DashboardAppController {
diff --git a/src/legacy/core_plugins/kibana/public/dashboard/np_ready/legacy_app.js b/src/legacy/core_plugins/kibana/public/dashboard/np_ready/legacy_app.js
index 7ba404d52d9a6..2121b51ea78d8 100644
--- a/src/legacy/core_plugins/kibana/public/dashboard/np_ready/legacy_app.js
+++ b/src/legacy/core_plugins/kibana/public/dashboard/np_ready/legacy_app.js
@@ -21,11 +21,13 @@ import { i18n } from '@kbn/i18n';
import dashboardTemplate from './dashboard_app.html';
import dashboardListingTemplate from './listing/dashboard_listing_ng_wrapper.html';
+import { createHashHistory } from 'history';
import { ensureDefaultIndexPattern } from '../legacy_imports';
import { initDashboardAppDirective } from './dashboard_app';
import { createDashboardEditUrl, DashboardConstants } from './dashboard_constants';
import {
+ createKbnUrlStateStorage,
InvalidJSONProperty,
SavedObjectNotFound,
} from '../../../../../../plugins/kibana_utils/public';
@@ -62,6 +64,14 @@ export function initDashboardApp(app, deps) {
stateManagementConfigProvider.disable();
});
+ app.factory('history', () => createHashHistory());
+ app.factory('kbnUrlStateStorage', history =>
+ createKbnUrlStateStorage({
+ history,
+ useHash: deps.uiSettings.get('state:storeInSessionStorage'),
+ })
+ );
+
app.config(function($routeProvider) {
const defaults = {
reloadOnSearch: false,
@@ -87,7 +97,7 @@ export function initDashboardApp(app, deps) {
.when(DashboardConstants.LANDING_PAGE_PATH, {
...defaults,
template: dashboardListingTemplate,
- controller($injector, $location, $scope) {
+ controller($injector, $location, $scope, kbnUrlStateStorage) {
const service = deps.savedDashboards;
const kbnUrl = $injector.get('kbnUrl');
const dashboardConfig = deps.dashboardConfig;
@@ -95,7 +105,7 @@ export function initDashboardApp(app, deps) {
// syncs `_g` portion of url with query services
const { stop: stopSyncingGlobalStateWithUrl } = syncQuery(
deps.npDataStart.query,
- deps.kbnUrlStateStorage
+ kbnUrlStateStorage
);
$scope.listingLimit = deps.uiSettings.get('savedObjects:listingLimit');
@@ -189,7 +199,7 @@ export function initDashboardApp(app, deps) {
template: dashboardTemplate,
controller: createNewDashboardCtrl,
resolve: {
- dash: function($rootScope, $route, redirectWhenMissing, kbnUrl) {
+ dash: function($rootScope, $route, redirectWhenMissing, kbnUrl, history) {
const id = $route.current.params.id;
return ensureDefaultIndexPattern(deps.core, deps.npDataStart, $rootScope, kbnUrl)
@@ -216,7 +226,6 @@ export function initDashboardApp(app, deps) {
// See https://github.com/elastic/kibana/issues/10951 for more context.
if (error instanceof SavedObjectNotFound && id === 'create') {
// Note preserve querystring part is necessary so the state is preserved through the redirect.
- const history = deps.history;
history.replace({
...history.location, // preserve query,
pathname: DashboardConstants.CREATE_NEW_DASHBOARD_URL,
diff --git a/src/legacy/core_plugins/kibana/public/dashboard/plugin.ts b/src/legacy/core_plugins/kibana/public/dashboard/plugin.ts
index 732fbd525ae37..ca4b18a37504c 100644
--- a/src/legacy/core_plugins/kibana/public/dashboard/plugin.ts
+++ b/src/legacy/core_plugins/kibana/public/dashboard/plugin.ts
@@ -25,13 +25,12 @@ import {
Plugin,
SavedObjectsClientContract,
} from 'kibana/public';
-import { createHashHistory } from 'history';
import { i18n } from '@kbn/i18n';
import { RenderDeps } from './np_ready/application';
import { DataStart } from '../../../data/public';
import { DataPublicPluginStart as NpDataStart } from '../../../../../plugins/data/public';
import { IEmbeddableStart } from '../../../../../plugins/embeddable/public';
-import { createKbnUrlStateStorage, Storage } from '../../../../../plugins/kibana_utils/public';
+import { Storage } from '../../../../../plugins/kibana_utils/public';
import { NavigationPublicPluginStart as NavigationStart } from '../../../../../plugins/navigation/public';
import { DashboardConstants } from './np_ready/dashboard_constants';
import {
@@ -97,12 +96,6 @@ export class DashboardPlugin implements Plugin {
overlays: contextCore.overlays,
});
- const history = createHashHistory();
- const kbnUrlStateStorage = createKbnUrlStateStorage({
- history,
- useHash: core.uiSettings.get('state:storeInSessionStorage'),
- });
-
const deps: RenderDeps = {
core: contextCore as LegacyCoreStart,
...angularDependencies,
@@ -118,8 +111,6 @@ export class DashboardPlugin implements Plugin {
embeddables,
dashboardCapabilities: contextCore.application.capabilities.dashboard,
localStorage: new Storage(localStorage),
- history,
- kbnUrlStateStorage,
};
const { renderApp } = await import('./np_ready/application');
return renderApp(params.element, params.appBasePath, deps);
diff --git a/src/legacy/core_plugins/kibana/public/home/assets/illo_dashboard.png b/src/legacy/core_plugins/kibana/public/home/assets/illo_dashboard.png
deleted file mode 100644
index ef2dac5ca4144..0000000000000
Binary files a/src/legacy/core_plugins/kibana/public/home/assets/illo_dashboard.png and /dev/null differ
diff --git a/src/legacy/core_plugins/kibana/public/home/assets/illo_telemetry.png b/src/legacy/core_plugins/kibana/public/home/assets/illo_telemetry.png
deleted file mode 100644
index d0d6dac59ab24..0000000000000
Binary files a/src/legacy/core_plugins/kibana/public/home/assets/illo_telemetry.png and /dev/null differ
diff --git a/src/legacy/core_plugins/kibana/public/home/assets/illustration_elastic_heart.png b/src/legacy/core_plugins/kibana/public/home/assets/illustration_elastic_heart.png
new file mode 100644
index 0000000000000..f4bf5b09ed7af
Binary files /dev/null and b/src/legacy/core_plugins/kibana/public/home/assets/illustration_elastic_heart.png differ
diff --git a/src/legacy/core_plugins/kibana/public/home/np_ready/components/__snapshots__/welcome.test.tsx.snap b/src/legacy/core_plugins/kibana/public/home/np_ready/components/__snapshots__/welcome.test.tsx.snap
index e36a6e0a5a9fb..6f76ceecbba13 100644
--- a/src/legacy/core_plugins/kibana/public/home/np_ready/components/__snapshots__/welcome.test.tsx.snap
+++ b/src/legacy/core_plugins/kibana/public/home/np_ready/components/__snapshots__/welcome.test.tsx.snap
@@ -424,7 +424,7 @@ exports[`should render a Welcome screen with the telemetry disclaimer when optIn
/>
diff --git a/src/legacy/core_plugins/kibana/public/home/np_ready/components/sample_data/index.tsx b/src/legacy/core_plugins/kibana/public/home/np_ready/components/sample_data/index.tsx
index faded18f7c12c..868885417a9f9 100644
--- a/src/legacy/core_plugins/kibana/public/home/np_ready/components/sample_data/index.tsx
+++ b/src/legacy/core_plugins/kibana/public/home/np_ready/components/sample_data/index.tsx
@@ -42,7 +42,7 @@ interface Props {
export function SampleDataCard({ urlBasePath, onDecline, onConfirm }: Props) {
return (
}
description={
diff --git a/src/legacy/core_plugins/kibana/public/home/np_ready/components/welcome.tsx b/src/legacy/core_plugins/kibana/public/home/np_ready/components/welcome.tsx
index 1b7761d068d2f..6983aabc4c7b1 100644
--- a/src/legacy/core_plugins/kibana/public/home/np_ready/components/welcome.tsx
+++ b/src/legacy/core_plugins/kibana/public/home/np_ready/components/welcome.tsx
@@ -90,7 +90,7 @@ export class Welcome extends React.Component {
-
+
-
-
-
+
-
-
+ }
+ formIsTouched={false}
+ key="jsonundefined"
+ onChangeParamsState={[Function]}
+ setAggParamValue={[MockFunction]}
+ showValidation={false}
+ />
+
`;
diff --git a/src/legacy/core_plugins/vis_default_editor/public/components/agg_params.tsx b/src/legacy/core_plugins/vis_default_editor/public/components/agg_params.tsx
index 0d83860a1475a..47e98f175ab73 100644
--- a/src/legacy/core_plugins/vis_default_editor/public/components/agg_params.tsx
+++ b/src/legacy/core_plugins/vis_default_editor/public/components/agg_params.tsx
@@ -18,7 +18,7 @@
*/
import React, { useCallback, useReducer, useEffect, useMemo } from 'react';
-import { EuiForm, EuiAccordion, EuiSpacer, EuiFormRow } from '@elastic/eui';
+import { EuiForm, EuiAccordion, EuiSpacer } from '@elastic/eui';
import { i18n } from '@kbn/i18n';
import useUnmount from 'react-use/lib/useUnmount';
@@ -219,7 +219,8 @@ function DefaultEditorAggParams({
})}
{params.advanced.length ? (
-
+ <>
+
-
+ >
) : null}
);
diff --git a/src/legacy/core_plugins/vis_type_timeseries/index.ts b/src/legacy/core_plugins/vis_type_timeseries/index.ts
index a502bb174bc99..3ad8ba3a31c17 100644
--- a/src/legacy/core_plugins/vis_type_timeseries/index.ts
+++ b/src/legacy/core_plugins/vis_type_timeseries/index.ts
@@ -21,7 +21,6 @@ import { resolve } from 'path';
import { Legacy } from 'kibana';
import { LegacyPluginApi, LegacyPluginInitializer } from '../../../../src/legacy/types';
-import { VisTypeTimeseriesSetup } from '../../../plugins/vis_type_timeseries/server';
const metricsPluginInitializer: LegacyPluginInitializer = ({ Plugin }: LegacyPluginApi) =>
new Plugin({
@@ -47,11 +46,6 @@ const metricsPluginInitializer: LegacyPluginInitializer = ({ Plugin }: LegacyPlu
},
},
},
- init: (server: Legacy.Server) => {
- const visTypeTimeSeriesPlugin = server.newPlatform.setup.plugins
- .metrics as VisTypeTimeseriesSetup;
- visTypeTimeSeriesPlugin.__legacy.registerLegacyAPI({ server });
- },
config(Joi: any) {
return Joi.object({
enabled: Joi.boolean().default(true),
diff --git a/src/legacy/core_plugins/vis_type_timeseries/public/components/aggs/filter_ratio.js b/src/legacy/core_plugins/vis_type_timeseries/public/components/aggs/filter_ratio.js
index 355c4723587d6..5bd7f6557e887 100644
--- a/src/legacy/core_plugins/vis_type_timeseries/public/components/aggs/filter_ratio.js
+++ b/src/legacy/core_plugins/vis_type_timeseries/public/components/aggs/filter_ratio.js
@@ -36,7 +36,7 @@ import {
} from '@elastic/eui';
import { FormattedMessage } from '@kbn/i18n/react';
import { KBN_FIELD_TYPES } from '../../../../../../plugins/data/public';
-import { METRIC_TYPES } from '../../../common/metric_types';
+import { METRIC_TYPES } from '../../../../../../plugins/vis_type_timeseries/common/metric_types';
export const FilterRatioAgg = props => {
const { series, fields, panel } = props;
diff --git a/src/legacy/core_plugins/vis_type_timeseries/public/components/aggs/metric_select.js b/src/legacy/core_plugins/vis_type_timeseries/public/components/aggs/metric_select.js
index 5e2f148ab5a6e..18daecd699903 100644
--- a/src/legacy/core_plugins/vis_type_timeseries/public/components/aggs/metric_select.js
+++ b/src/legacy/core_plugins/vis_type_timeseries/public/components/aggs/metric_select.js
@@ -23,10 +23,10 @@ import { includes } from 'lodash';
import { injectI18n } from '@kbn/i18n/react';
import { EuiComboBox } from '@elastic/eui';
import { calculateSiblings } from '../lib/calculate_siblings';
-import { calculateLabel } from '../../../common/calculate_label';
-import { basicAggs } from '../../../common/basic_aggs';
-import { toPercentileNumber } from '../../../common/to_percentile_number';
-import { METRIC_TYPES } from '../../../common/metric_types';
+import { calculateLabel } from '../../../../../../plugins/vis_type_timeseries/common/calculate_label';
+import { basicAggs } from '../../../../../../plugins/vis_type_timeseries/common/basic_aggs';
+import { toPercentileNumber } from '../../../../../../plugins/vis_type_timeseries/common/to_percentile_number';
+import { METRIC_TYPES } from '../../../../../../plugins/vis_type_timeseries/common/metric_types';
function createTypeFilter(restrict, exclude) {
return metric => {
diff --git a/src/legacy/core_plugins/vis_type_timeseries/public/components/aggs/moving_average.js b/src/legacy/core_plugins/vis_type_timeseries/public/components/aggs/moving_average.js
index 3b9d0ab282682..5843eab3f4707 100644
--- a/src/legacy/core_plugins/vis_type_timeseries/public/components/aggs/moving_average.js
+++ b/src/legacy/core_plugins/vis_type_timeseries/public/components/aggs/moving_average.js
@@ -36,7 +36,7 @@ import {
EuiFieldNumber,
} from '@elastic/eui';
import { i18n } from '@kbn/i18n';
-import { MODEL_TYPES } from '../../../common/model_options';
+import { MODEL_TYPES } from '../../../../../../plugins/vis_type_timeseries/common/model_options';
const DEFAULTS = {
model_type: MODEL_TYPES.UNWEIGHTED,
diff --git a/src/legacy/core_plugins/vis_type_timeseries/public/components/aggs/std_agg.js b/src/legacy/core_plugins/vis_type_timeseries/public/components/aggs/std_agg.js
index 67fe9403e402b..61e5c60cbd72a 100644
--- a/src/legacy/core_plugins/vis_type_timeseries/public/components/aggs/std_agg.js
+++ b/src/legacy/core_plugins/vis_type_timeseries/public/components/aggs/std_agg.js
@@ -34,7 +34,7 @@ import {
} from '@elastic/eui';
import { FormattedMessage } from '@kbn/i18n/react';
import { KBN_FIELD_TYPES } from '../../../../../../plugins/data/public';
-import { METRIC_TYPES } from '../../../common/metric_types';
+import { METRIC_TYPES } from '../../../../../../plugins/vis_type_timeseries/common/metric_types';
export function StandardAgg(props) {
const { model, panel, series, fields, uiRestrictions } = props;
diff --git a/src/legacy/core_plugins/vis_type_timeseries/public/components/aggs/top_hit.js b/src/legacy/core_plugins/vis_type_timeseries/public/components/aggs/top_hit.js
index fa92713046aca..df13b94394061 100644
--- a/src/legacy/core_plugins/vis_type_timeseries/public/components/aggs/top_hit.js
+++ b/src/legacy/core_plugins/vis_type_timeseries/public/components/aggs/top_hit.js
@@ -36,7 +36,7 @@ import {
} from '@elastic/eui';
import { injectI18n, FormattedMessage } from '@kbn/i18n/react';
import { KBN_FIELD_TYPES } from '../../../../../../plugins/data/public';
-import { PANEL_TYPES } from '../../../common/panel_types';
+import { PANEL_TYPES } from '../../../../../../plugins/vis_type_timeseries/common/panel_types';
const isFieldTypeEnabled = (fieldRestrictions, fieldType) =>
fieldRestrictions.length ? fieldRestrictions.includes(fieldType) : true;
diff --git a/src/legacy/core_plugins/vis_type_timeseries/public/components/index_pattern.js b/src/legacy/core_plugins/vis_type_timeseries/public/components/index_pattern.js
index 352747013fe29..de8469adfb8a7 100644
--- a/src/legacy/core_plugins/vis_type_timeseries/public/components/index_pattern.js
+++ b/src/legacy/core_plugins/vis_type_timeseries/public/components/index_pattern.js
@@ -42,8 +42,11 @@ import {
AUTO_INTERVAL,
} from './lib/get_interval';
import { i18n } from '@kbn/i18n';
-import { TIME_RANGE_DATA_MODES, TIME_RANGE_MODE_KEY } from '../../common/timerange_data_modes';
-import { PANEL_TYPES } from '../../common/panel_types';
+import {
+ TIME_RANGE_DATA_MODES,
+ TIME_RANGE_MODE_KEY,
+} from '../../../../../plugins/vis_type_timeseries/common/timerange_data_modes';
+import { PANEL_TYPES } from '../../../../../plugins/vis_type_timeseries/common/panel_types';
import { isTimerangeModeEnabled } from '../lib/check_ui_restrictions';
import { VisDataContext } from '../contexts/vis_data_context';
@@ -138,8 +141,8 @@ export const IndexPattern = ({ fields, prefix, onChange, disabled, model: _model
{i18n.translate('visTypeTimeseries.indexPattern.timeRange.hint', {
- defaultMessage: `This setting controls the timespan used for matching documents.
- "Entire timerange" will match all the documents selected in the timepicker.
+ defaultMessage: `This setting controls the timespan used for matching documents.
+ "Entire timerange" will match all the documents selected in the timepicker.
"Last value" will match only the documents for the specified interval from the end of the timerange.`,
})}
diff --git a/src/legacy/core_plugins/vis_type_timeseries/public/components/lib/convert_series_to_vars.js b/src/legacy/core_plugins/vis_type_timeseries/public/components/lib/convert_series_to_vars.js
index bcab9ec026d9a..73fc8dac2b564 100644
--- a/src/legacy/core_plugins/vis_type_timeseries/public/components/lib/convert_series_to_vars.js
+++ b/src/legacy/core_plugins/vis_type_timeseries/public/components/lib/convert_series_to_vars.js
@@ -18,7 +18,7 @@
*/
import _ from 'lodash';
-import { getLastValue } from '../../../common/get_last_value';
+import { getLastValue } from '../../../../../../plugins/vis_type_timeseries/common/get_last_value';
import { createTickFormatter } from './tick_formatter';
import moment from 'moment';
diff --git a/src/legacy/core_plugins/vis_type_timeseries/public/components/lib/get_interval.js b/src/legacy/core_plugins/vis_type_timeseries/public/components/lib/get_interval.js
index 05d00f6bede1a..a6aefe067dd62 100644
--- a/src/legacy/core_plugins/vis_type_timeseries/public/components/lib/get_interval.js
+++ b/src/legacy/core_plugins/vis_type_timeseries/public/components/lib/get_interval.js
@@ -20,7 +20,7 @@ import moment from 'moment';
import { i18n } from '@kbn/i18n';
import { get } from 'lodash';
import { parseEsInterval } from '../../../../data/public';
-import { GTE_INTERVAL_RE } from '../../../common/interval_regexp';
+import { GTE_INTERVAL_RE } from '../../../../../../plugins/vis_type_timeseries/common/interval_regexp';
export const AUTO_INTERVAL = 'auto';
diff --git a/src/legacy/core_plugins/vis_type_timeseries/public/components/lib/series_change_handler.js b/src/legacy/core_plugins/vis_type_timeseries/public/components/lib/series_change_handler.js
index b13f89c204292..e773782969d16 100644
--- a/src/legacy/core_plugins/vis_type_timeseries/public/components/lib/series_change_handler.js
+++ b/src/legacy/core_plugins/vis_type_timeseries/public/components/lib/series_change_handler.js
@@ -19,7 +19,7 @@
import _ from 'lodash';
import { newMetricAggFn } from './new_metric_agg_fn';
-import { isBasicAgg } from '../../../common/agg_lookup';
+import { isBasicAgg } from '../../../../../../plugins/vis_type_timeseries/common/agg_lookup';
import { handleAdd, handleChange } from './collection_actions';
export const seriesChangeHandler = (props, items) => doc => {
diff --git a/src/legacy/core_plugins/vis_type_timeseries/public/components/splits/terms.js b/src/legacy/core_plugins/vis_type_timeseries/public/components/splits/terms.js
index 111da86d71ecb..0fddc4f8c1d87 100644
--- a/src/legacy/core_plugins/vis_type_timeseries/public/components/splits/terms.js
+++ b/src/legacy/core_plugins/vis_type_timeseries/public/components/splits/terms.js
@@ -36,7 +36,7 @@ import {
EuiFieldText,
} from '@elastic/eui';
import { injectI18n, FormattedMessage } from '@kbn/i18n/react';
-import { FIELD_TYPES } from '../../../common/field_types';
+import { FIELD_TYPES } from '../../../../../../plugins/vis_type_timeseries/common/field_types';
import { STACKED_OPTIONS } from '../../visualizations/constants';
const DEFAULTS = { terms_direction: 'desc', terms_size: 10, terms_order_by: '_count' };
diff --git a/src/legacy/core_plugins/vis_type_timeseries/public/components/vis_editor.js b/src/legacy/core_plugins/vis_type_timeseries/public/components/vis_editor.js
index ae39d75c7a2d1..3dedb67bd1d99 100644
--- a/src/legacy/core_plugins/vis_type_timeseries/public/components/vis_editor.js
+++ b/src/legacy/core_plugins/vis_type_timeseries/public/components/vis_editor.js
@@ -28,7 +28,7 @@ import { VisPicker } from './vis_picker';
import { PanelConfig } from './panel_config';
import { createBrushHandler } from '../lib/create_brush_handler';
import { fetchFields } from '../lib/fetch_fields';
-import { extractIndexPatterns } from '../../common/extract_index_patterns';
+import { extractIndexPatterns } from '../../../../../plugins/vis_type_timeseries/common/extract_index_patterns';
import { esKuery } from '../../../../../plugins/data/public';
import { npStart } from 'ui/new_platform';
diff --git a/src/legacy/core_plugins/vis_type_timeseries/public/components/vis_editor_visualization.js b/src/legacy/core_plugins/vis_type_timeseries/public/components/vis_editor_visualization.js
index a376905495c52..c45a4d68e8aad 100644
--- a/src/legacy/core_plugins/vis_type_timeseries/public/components/vis_editor_visualization.js
+++ b/src/legacy/core_plugins/vis_type_timeseries/public/components/vis_editor_visualization.js
@@ -28,7 +28,7 @@ import {
isGteInterval,
AUTO_INTERVAL,
} from './lib/get_interval';
-import { PANEL_TYPES } from '../../common/panel_types';
+import { PANEL_TYPES } from '../../../../../plugins/vis_type_timeseries/common/panel_types';
import { start as embeddables } from '../../../embeddable_api/public/np_ready/public/legacy';
const MIN_CHART_HEIGHT = 300;
diff --git a/src/legacy/core_plugins/vis_type_timeseries/public/components/vis_picker.js b/src/legacy/core_plugins/vis_type_timeseries/public/components/vis_picker.js
index 8d2673ea24cb2..2c4a11f8880ff 100644
--- a/src/legacy/core_plugins/vis_type_timeseries/public/components/vis_picker.js
+++ b/src/legacy/core_plugins/vis_type_timeseries/public/components/vis_picker.js
@@ -21,7 +21,7 @@ import PropTypes from 'prop-types';
import React from 'react';
import { EuiTabs, EuiTab } from '@elastic/eui';
import { injectI18n } from '@kbn/i18n/react';
-import { PANEL_TYPES } from '../../common/panel_types';
+import { PANEL_TYPES } from '../../../../../plugins/vis_type_timeseries/common/panel_types';
function VisPickerItem(props) {
const { label, type, selected } = props;
diff --git a/src/legacy/core_plugins/vis_type_timeseries/public/components/vis_types/gauge/vis.js b/src/legacy/core_plugins/vis_type_timeseries/public/components/vis_types/gauge/vis.js
index 5d6bb55f33db6..7d30a1f0c8df5 100644
--- a/src/legacy/core_plugins/vis_type_timeseries/public/components/vis_types/gauge/vis.js
+++ b/src/legacy/core_plugins/vis_type_timeseries/public/components/vis_types/gauge/vis.js
@@ -23,7 +23,7 @@ import { visWithSplits } from '../../vis_with_splits';
import { createTickFormatter } from '../../lib/tick_formatter';
import _, { get, isUndefined, assign, includes } from 'lodash';
import { Gauge } from '../../../visualizations/views/gauge';
-import { getLastValue } from '../../../../common/get_last_value';
+import { getLastValue } from '../../../../../../../plugins/vis_type_timeseries/common/get_last_value';
function getColors(props) {
const { model, visData } = props;
diff --git a/src/legacy/core_plugins/vis_type_timeseries/public/components/vis_types/markdown/vis.js b/src/legacy/core_plugins/vis_type_timeseries/public/components/vis_types/markdown/vis.js
index e20f3d3fbaebc..a806339085450 100644
--- a/src/legacy/core_plugins/vis_type_timeseries/public/components/vis_types/markdown/vis.js
+++ b/src/legacy/core_plugins/vis_type_timeseries/public/components/vis_types/markdown/vis.js
@@ -26,7 +26,7 @@ import { Markdown } from '../../../../../kibana_react/public';
import { ErrorComponent } from '../../error';
import { replaceVars } from '../../lib/replace_vars';
import { convertSeriesToVars } from '../../lib/convert_series_to_vars';
-import { isBackgroundInverted } from '../../../../common/set_is_reversed';
+import { isBackgroundInverted } from '../../../lib/set_is_reversed';
const getMarkdownId = id => `markdown-${id}`;
diff --git a/src/legacy/core_plugins/vis_type_timeseries/public/components/vis_types/metric/vis.js b/src/legacy/core_plugins/vis_type_timeseries/public/components/vis_types/metric/vis.js
index f463a4494a189..4a907a7b2078d 100644
--- a/src/legacy/core_plugins/vis_type_timeseries/public/components/vis_types/metric/vis.js
+++ b/src/legacy/core_plugins/vis_type_timeseries/public/components/vis_types/metric/vis.js
@@ -23,8 +23,8 @@ import { visWithSplits } from '../../vis_with_splits';
import { createTickFormatter } from '../../lib/tick_formatter';
import _, { get, isUndefined, assign, includes, pick } from 'lodash';
import { Metric } from '../../../visualizations/views/metric';
-import { getLastValue } from '../../../../common/get_last_value';
-import { isBackgroundInverted } from '../../../../common/set_is_reversed';
+import { getLastValue } from '../../../../../../../plugins/vis_type_timeseries/common/get_last_value';
+import { isBackgroundInverted } from '../../../lib/set_is_reversed';
function getColors(props) {
const { model, visData } = props;
diff --git a/src/legacy/core_plugins/vis_type_timeseries/public/components/vis_types/table/is_sortable.js b/src/legacy/core_plugins/vis_type_timeseries/public/components/vis_types/table/is_sortable.js
index 887652a67f406..b44c94131348d 100644
--- a/src/legacy/core_plugins/vis_type_timeseries/public/components/vis_types/table/is_sortable.js
+++ b/src/legacy/core_plugins/vis_type_timeseries/public/components/vis_types/table/is_sortable.js
@@ -17,7 +17,7 @@
* under the License.
*/
-import { basicAggs } from '../../../../common/basic_aggs';
+import { basicAggs } from '../../../../../../../plugins/vis_type_timeseries/common/basic_aggs';
export function isSortable(metric) {
return basicAggs.includes(metric.type);
diff --git a/src/legacy/core_plugins/vis_type_timeseries/public/components/vis_types/table/vis.js b/src/legacy/core_plugins/vis_type_timeseries/public/components/vis_types/table/vis.js
index a82d5bdb1588c..94f4506cd0172 100644
--- a/src/legacy/core_plugins/vis_type_timeseries/public/components/vis_types/table/vis.js
+++ b/src/legacy/core_plugins/vis_type_timeseries/public/components/vis_types/table/vis.js
@@ -22,14 +22,14 @@ import React, { Component } from 'react';
import PropTypes from 'prop-types';
import { npStart } from 'ui/new_platform';
import { createTickFormatter } from '../../lib/tick_formatter';
-import { calculateLabel } from '../../../../common/calculate_label';
+import { calculateLabel } from '../../../../../../../plugins/vis_type_timeseries/common/calculate_label';
import { isSortable } from './is_sortable';
import { EuiToolTip, EuiIcon } from '@elastic/eui';
import { replaceVars } from '../../lib/replace_vars';
import { fieldFormats } from '../../../../../../../plugins/data/public';
import { FormattedMessage } from '@kbn/i18n/react';
-import { METRIC_TYPES } from '../../../../common/metric_types';
+import { METRIC_TYPES } from '../../../../../../../plugins/vis_type_timeseries/common/metric_types';
function getColor(rules, colorKey, value) {
let color;
diff --git a/src/legacy/core_plugins/vis_type_timeseries/public/components/vis_types/timeseries/series.js b/src/legacy/core_plugins/vis_type_timeseries/public/components/vis_types/timeseries/series.js
index 226aded390508..27a84d9ba40b9 100644
--- a/src/legacy/core_plugins/vis_type_timeseries/public/components/vis_types/timeseries/series.js
+++ b/src/legacy/core_plugins/vis_type_timeseries/public/components/vis_types/timeseries/series.js
@@ -35,7 +35,7 @@ import {
import { Split } from '../../split';
import { createTextHandler } from '../../lib/create_text_handler';
import { FormattedMessage, injectI18n } from '@kbn/i18n/react';
-import { PANEL_TYPES } from '../../../../common/panel_types';
+import { PANEL_TYPES } from '../../../../../../../plugins/vis_type_timeseries/common/panel_types';
const TimeseriesSeriesUI = injectI18n(function(props) {
const {
diff --git a/src/legacy/core_plugins/vis_type_timeseries/public/components/vis_types/timeseries/vis.js b/src/legacy/core_plugins/vis_type_timeseries/public/components/vis_types/timeseries/vis.js
index d269d7c3546ec..5243f5f92a621 100644
--- a/src/legacy/core_plugins/vis_type_timeseries/public/components/vis_types/timeseries/vis.js
+++ b/src/legacy/core_plugins/vis_type_timeseries/public/components/vis_types/timeseries/vis.js
@@ -34,7 +34,7 @@ import { getAxisLabelString } from '../../lib/get_axis_label_string';
import { getInterval } from '../../lib/get_interval';
import { areFieldsDifferent } from '../../lib/charts';
import { createXaxisFormatter } from '../../lib/create_xaxis_formatter';
-import { isBackgroundDark } from '../../../../common/set_is_reversed';
+import { isBackgroundDark } from '../../../lib/set_is_reversed';
import { STACKED_OPTIONS } from '../../../visualizations/constants';
export class TimeseriesVisualization extends Component {
diff --git a/src/legacy/core_plugins/vis_type_timeseries/public/components/vis_types/top_n/vis.js b/src/legacy/core_plugins/vis_type_timeseries/public/components/vis_types/top_n/vis.js
index 7d09f33acdecc..2ebc60325a425 100644
--- a/src/legacy/core_plugins/vis_type_timeseries/public/components/vis_types/top_n/vis.js
+++ b/src/legacy/core_plugins/vis_type_timeseries/public/components/vis_types/top_n/vis.js
@@ -19,8 +19,8 @@
import { createTickFormatter } from '../../lib/tick_formatter';
import { TopN } from '../../../visualizations/views/top_n';
-import { getLastValue } from '../../../../common/get_last_value';
-import { isBackgroundInverted } from '../../../../common/set_is_reversed';
+import { getLastValue } from '../../../../../../../plugins/vis_type_timeseries/common/get_last_value';
+import { isBackgroundInverted } from '../../../lib/set_is_reversed';
import { replaceVars } from '../../lib/replace_vars';
import PropTypes from 'prop-types';
import React from 'react';
diff --git a/src/legacy/core_plugins/vis_type_timeseries/public/components/vis_with_splits.js b/src/legacy/core_plugins/vis_type_timeseries/public/components/vis_with_splits.js
index 91d53b9c2e1db..e36910d9081b3 100644
--- a/src/legacy/core_plugins/vis_type_timeseries/public/components/vis_with_splits.js
+++ b/src/legacy/core_plugins/vis_type_timeseries/public/components/vis_with_splits.js
@@ -20,7 +20,7 @@
import React from 'react';
import { getDisplayName } from './lib/get_display_name';
import { last, findIndex, first } from 'lodash';
-import { calculateLabel } from '../../common/calculate_label';
+import { calculateLabel } from '../../../../../plugins/vis_type_timeseries/common/calculate_label';
export function visWithSplits(WrappedComponent) {
function SplitVisComponent(props) {
diff --git a/src/legacy/core_plugins/vis_type_timeseries/public/lib/check_ui_restrictions.js b/src/legacy/core_plugins/vis_type_timeseries/public/lib/check_ui_restrictions.js
index 1fade6ebe9849..5d18c0a2f09cd 100644
--- a/src/legacy/core_plugins/vis_type_timeseries/public/lib/check_ui_restrictions.js
+++ b/src/legacy/core_plugins/vis_type_timeseries/public/lib/check_ui_restrictions.js
@@ -18,7 +18,10 @@
*/
import { get } from 'lodash';
-import { RESTRICTIONS_KEYS, DEFAULT_UI_RESTRICTION } from '../../common/ui_restrictions';
+import {
+ RESTRICTIONS_KEYS,
+ DEFAULT_UI_RESTRICTION,
+} from '../../../../../plugins/vis_type_timeseries/common/ui_restrictions';
/**
* Generic method for checking all types of the UI Restrictions
diff --git a/src/legacy/core_plugins/vis_type_timeseries/public/lib/fetch_fields.js b/src/legacy/core_plugins/vis_type_timeseries/public/lib/fetch_fields.js
index 21c12b07ff47f..68e694f23fa7f 100644
--- a/src/legacy/core_plugins/vis_type_timeseries/public/lib/fetch_fields.js
+++ b/src/legacy/core_plugins/vis_type_timeseries/public/lib/fetch_fields.js
@@ -19,7 +19,7 @@
import { kfetch } from 'ui/kfetch';
import { toastNotifications } from 'ui/notify';
import { i18n } from '@kbn/i18n';
-import { extractIndexPatterns } from '../../common/extract_index_patterns';
+import { extractIndexPatterns } from '../../../../../plugins/vis_type_timeseries/common/extract_index_patterns';
export async function fetchFields(indexPatterns = ['*']) {
const patterns = Array.isArray(indexPatterns) ? indexPatterns : [indexPatterns];
diff --git a/src/legacy/core_plugins/vis_type_timeseries/common/set_is_reversed.js b/src/legacy/core_plugins/vis_type_timeseries/public/lib/set_is_reversed.js
similarity index 92%
rename from src/legacy/core_plugins/vis_type_timeseries/common/set_is_reversed.js
rename to src/legacy/core_plugins/vis_type_timeseries/public/lib/set_is_reversed.js
index b633d004b9705..9f66bcd161916 100644
--- a/src/legacy/core_plugins/vis_type_timeseries/common/set_is_reversed.js
+++ b/src/legacy/core_plugins/vis_type_timeseries/public/lib/set_is_reversed.js
@@ -18,9 +18,9 @@
*/
import color from 'color';
-import chrome from '../../../ui/public/chrome';
+import { getUISettings } from '../services';
-const IS_DARK_THEME = chrome.getUiSettingsClient().get('theme:darkMode');
+const isDarkTheme = () => getUISettings().get('theme:darkMode');
/**
* Returns true if the color that is passed has low luminosity
@@ -34,7 +34,7 @@ const isColorDark = c => {
* Defaults to checking `theme:darkMode`.
*/
export const isThemeDark = currentTheme => {
- let themeIsDark = currentTheme || IS_DARK_THEME;
+ let themeIsDark = currentTheme || isDarkTheme();
// If passing a string, check the luminosity
if (typeof currentTheme === 'string') {
diff --git a/src/legacy/core_plugins/vis_type_timeseries/public/lib/validate_interval.js b/src/legacy/core_plugins/vis_type_timeseries/public/lib/validate_interval.js
index 2dbcdc4749a66..2992549d38e30 100644
--- a/src/legacy/core_plugins/vis_type_timeseries/public/lib/validate_interval.js
+++ b/src/legacy/core_plugins/vis_type_timeseries/public/lib/validate_interval.js
@@ -17,7 +17,7 @@
* under the License.
*/
-import { GTE_INTERVAL_RE } from '../../common/interval_regexp';
+import { GTE_INTERVAL_RE } from '../../../../../plugins/vis_type_timeseries/common/interval_regexp';
import { i18n } from '@kbn/i18n';
import { parseInterval } from '../../../../../plugins/data/public';
diff --git a/src/legacy/core_plugins/vis_type_timeseries/public/metrics_type.ts b/src/legacy/core_plugins/vis_type_timeseries/public/metrics_type.ts
index e7684cd21b797..22d2b3b10e566 100644
--- a/src/legacy/core_plugins/vis_type_timeseries/public/metrics_type.ts
+++ b/src/legacy/core_plugins/vis_type_timeseries/public/metrics_type.ts
@@ -26,7 +26,7 @@ import { metricsRequestHandler } from './request_handler';
// @ts-ignore
import { EditorController } from './editor_controller';
// @ts-ignore
-import { PANEL_TYPES } from '../common/panel_types';
+import { PANEL_TYPES } from '../../../../plugins/vis_type_timeseries/common/panel_types';
export const metricsVisDefinition = {
name: 'metrics',
diff --git a/src/legacy/core_plugins/vis_type_timeseries/public/visualizations/views/gauge.js b/src/legacy/core_plugins/vis_type_timeseries/public/visualizations/views/gauge.js
index 3be2e9daed58c..b518665e5ece4 100644
--- a/src/legacy/core_plugins/vis_type_timeseries/public/visualizations/views/gauge.js
+++ b/src/legacy/core_plugins/vis_type_timeseries/public/visualizations/views/gauge.js
@@ -21,8 +21,8 @@ import _ from 'lodash';
import PropTypes from 'prop-types';
import React, { Component } from 'react';
import classNames from 'classnames';
-import { isBackgroundInverted, isBackgroundDark } from '../../../common/set_is_reversed';
-import { getLastValue } from '../../../common/get_last_value';
+import { isBackgroundInverted, isBackgroundDark } from '../../lib/set_is_reversed';
+import { getLastValue } from '../../../../../../plugins/vis_type_timeseries/common/get_last_value';
import { getValueBy } from '../lib/get_value_by';
import { GaugeVis } from './gauge_vis';
import reactcss from 'reactcss';
diff --git a/src/legacy/core_plugins/vis_type_timeseries/public/visualizations/views/metric.js b/src/legacy/core_plugins/vis_type_timeseries/public/visualizations/views/metric.js
index 004d59efca333..5524e17d106e4 100644
--- a/src/legacy/core_plugins/vis_type_timeseries/public/visualizations/views/metric.js
+++ b/src/legacy/core_plugins/vis_type_timeseries/public/visualizations/views/metric.js
@@ -20,7 +20,7 @@
import PropTypes from 'prop-types';
import React, { Component } from 'react';
import _ from 'lodash';
-import { getLastValue } from '../../../common/get_last_value';
+import { getLastValue } from '../../../../../../plugins/vis_type_timeseries/common/get_last_value';
import reactcss from 'reactcss';
import { calculateCoordinates } from '../lib/calculate_coordinates';
diff --git a/src/legacy/core_plugins/vis_type_timeseries/public/visualizations/views/top_n.js b/src/legacy/core_plugins/vis_type_timeseries/public/visualizations/views/top_n.js
index 5734d101a09d2..99e9cc0b1c218 100644
--- a/src/legacy/core_plugins/vis_type_timeseries/public/visualizations/views/top_n.js
+++ b/src/legacy/core_plugins/vis_type_timeseries/public/visualizations/views/top_n.js
@@ -19,7 +19,7 @@
import PropTypes from 'prop-types';
import React, { Component } from 'react';
-import { getLastValue } from '../../../common/get_last_value';
+import { getLastValue } from '../../../../../../plugins/vis_type_timeseries/common/get_last_value';
import reactcss from 'reactcss';
const RENDER_MODES = {
diff --git a/src/legacy/core_plugins/vis_type_timeseries/server/init.ts b/src/legacy/core_plugins/vis_type_timeseries/server/init.ts
deleted file mode 100644
index ae6eebc00fc1b..0000000000000
--- a/src/legacy/core_plugins/vis_type_timeseries/server/init.ts
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Licensed to Elasticsearch B.V. under one or more contributor
- * license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright
- * ownership. Elasticsearch B.V. licenses this file to you under
- * the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-// @ts-ignore
-import { fieldsRoutes } from './routes/fields';
-// @ts-ignore
-import { visDataRoutes } from './routes/vis';
-// @ts-ignore
-import { SearchStrategiesRegister } from './lib/search_strategies/search_strategies_register';
-// @ts-ignore
-import { getVisData } from './lib/get_vis_data';
-import { Framework } from '../../../../plugins/vis_type_timeseries/server';
-import { ValidationTelemetryServiceSetup } from '../../../../plugins/vis_type_timeseries/server';
-
-export const init = async (
- framework: Framework,
- __LEGACY: any,
- validationTelemetry: ValidationTelemetryServiceSetup
-) => {
- const { core } = framework;
- const router = core.http.createRouter();
-
- visDataRoutes(router, framework, validationTelemetry);
-
- // [LEGACY_TODO]
- fieldsRoutes(__LEGACY.server);
- SearchStrategiesRegister.init(__LEGACY.server);
-};
diff --git a/src/legacy/core_plugins/vis_type_timeseries/server/lib/get_fields.js b/src/legacy/core_plugins/vis_type_timeseries/server/lib/get_fields.js
deleted file mode 100644
index 361ce132f1735..0000000000000
--- a/src/legacy/core_plugins/vis_type_timeseries/server/lib/get_fields.js
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Licensed to Elasticsearch B.V. under one or more contributor
- * license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright
- * ownership. Elasticsearch B.V. licenses this file to you under
- * the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-import { SearchStrategiesRegister } from './search_strategies/search_strategies_register';
-import { uniq } from 'lodash';
-import { getIndexPatternObject } from './vis_data/helpers/get_index_pattern';
-import { isNestedField } from '../../../../../plugins/data/server';
-
-export async function getFields(req) {
- const indexPattern = req.query.index;
- const { indexPatternString } = await getIndexPatternObject(req, indexPattern);
- const { searchStrategy, capabilities } = await SearchStrategiesRegister.getViableStrategy(
- req,
- indexPatternString
- );
-
- const fields = (
- await searchStrategy.getFieldsForWildcard(req, indexPatternString, capabilities)
- ).filter(field => field.aggregatable && !isNestedField(field));
-
- return uniq(fields, field => field.name);
-}
diff --git a/src/legacy/ui/public/agg_types/filter/index.ts b/src/legacy/ui/public/agg_types/filter/index.ts
index 3fc577e7e9a23..35d06807d0ec2 100644
--- a/src/legacy/ui/public/agg_types/filter/index.ts
+++ b/src/legacy/ui/public/agg_types/filter/index.ts
@@ -17,5 +17,5 @@
* under the License.
*/
-export { aggTypeFilters } from './agg_type_filters';
+export { aggTypeFilters, AggTypeFilters } from './agg_type_filters';
export { propFilter } from './prop_filter';
diff --git a/src/legacy/ui/public/agg_types/param_types/filter/index.ts b/src/legacy/ui/public/agg_types/param_types/filter/index.ts
index ce5c7c4f9fea5..2e0039c96a192 100644
--- a/src/legacy/ui/public/agg_types/param_types/filter/index.ts
+++ b/src/legacy/ui/public/agg_types/param_types/filter/index.ts
@@ -17,4 +17,4 @@
* under the License.
*/
-export { aggTypeFieldFilters } from './field_filters';
+export { aggTypeFieldFilters, AggTypeFieldFilters } from './field_filters';
diff --git a/src/legacy/ui/public/assets/images/bg_bottom_branded.svg b/src/legacy/ui/public/assets/images/bg_bottom_branded.svg
index 8e5091f7b4cdc..67531eec434d7 100644
--- a/src/legacy/ui/public/assets/images/bg_bottom_branded.svg
+++ b/src/legacy/ui/public/assets/images/bg_bottom_branded.svg
@@ -1,66 +1,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
diff --git a/src/legacy/ui/public/assets/images/bg_bottom_branded_dark.svg b/src/legacy/ui/public/assets/images/bg_bottom_branded_dark.svg
index d9bc4fd934e66..c73123f2badd0 100644
--- a/src/legacy/ui/public/assets/images/bg_bottom_branded_dark.svg
+++ b/src/legacy/ui/public/assets/images/bg_bottom_branded_dark.svg
@@ -1,29 +1,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
-
-
-
-
-
-
-
-
-
-
+
+
diff --git a/src/legacy/ui/public/assets/images/bg_top_branded.svg b/src/legacy/ui/public/assets/images/bg_top_branded.svg
index 85e0a25d8071a..23104f50b302c 100644
--- a/src/legacy/ui/public/assets/images/bg_top_branded.svg
+++ b/src/legacy/ui/public/assets/images/bg_top_branded.svg
@@ -1,33 +1,8 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
-
-
-
-
-
-
-
-
-
+
+
+
+
diff --git a/src/legacy/ui/public/assets/images/bg_top_branded_dark.svg b/src/legacy/ui/public/assets/images/bg_top_branded_dark.svg
index ef8df6e9f783f..0fe929183bacb 100644
--- a/src/legacy/ui/public/assets/images/bg_top_branded_dark.svg
+++ b/src/legacy/ui/public/assets/images/bg_top_branded_dark.svg
@@ -1,6 +1,8 @@
-
-
-
-
+
+
+
+
+
+
diff --git a/src/legacy/ui/public/new_platform/new_platform.karma_mock.js b/src/legacy/ui/public/new_platform/new_platform.karma_mock.js
index 31dd00c37069f..f98b8801d5266 100644
--- a/src/legacy/ui/public/new_platform/new_platform.karma_mock.js
+++ b/src/legacy/ui/public/new_platform/new_platform.karma_mock.js
@@ -147,6 +147,13 @@ export const npSetup = {
useChartsTheme: sinon.fake(),
},
},
+ management: {
+ sections: {
+ getSection: () => ({
+ registerApp: sinon.fake(),
+ }),
+ },
+ },
},
};
@@ -167,6 +174,11 @@ export const npStart = {
hasItem: sinon.fake(),
}),
},
+ sections: {
+ getSection: () => ({
+ registerApp: sinon.fake(),
+ }),
+ },
},
embeddable: {
getEmbeddableFactory: sinon.fake(),
diff --git a/src/legacy/ui/public/new_platform/new_platform.ts b/src/legacy/ui/public/new_platform/new_platform.ts
index cb98e72591b03..2ade98ec54efd 100644
--- a/src/legacy/ui/public/new_platform/new_platform.ts
+++ b/src/legacy/ui/public/new_platform/new_platform.ts
@@ -32,7 +32,7 @@ import { DevToolsSetup, DevToolsStart } from '../../../../plugins/dev_tools/publ
import { KibanaLegacySetup, KibanaLegacyStart } from '../../../../plugins/kibana_legacy/public';
import { HomePublicPluginSetup, HomePublicPluginStart } from '../../../../plugins/home/public';
import { SharePluginSetup, SharePluginStart } from '../../../../plugins/share/public';
-import { ManagementStart } from '../../../../plugins/management/public';
+import { ManagementSetup, ManagementStart } from '../../../../plugins/management/public';
import { BfetchPublicSetup, BfetchPublicStart } from '../../../../plugins/bfetch/public';
import { UsageCollectionSetup } from '../../../../plugins/usage_collection/public';
import {
@@ -54,6 +54,7 @@ export interface PluginsSetup {
kibana_legacy: KibanaLegacySetup;
share: SharePluginSetup;
usageCollection: UsageCollectionSetup;
+ management: ManagementSetup;
}
export interface PluginsStart {
diff --git a/src/legacy/ui/public/styles/_mixins.scss b/src/legacy/ui/public/styles/_mixins.scss
index 2d78768684841..c0dc456000dcc 100644
--- a/src/legacy/ui/public/styles/_mixins.scss
+++ b/src/legacy/ui/public/styles/_mixins.scss
@@ -77,7 +77,7 @@
bottom: 0;
z-index: $euiZLevel + 1000;
background: inherit;
- background-image: linear-gradient(0deg, $euiColorLightestShade 0%, $euiColorEmptyShade 100%);
+ background-color: $euiPageBackgroundColor;
opacity: 0;
overflow: auto;
animation: kibanaFullScreenGraphics_FadeIn $euiAnimSpeedExtraSlow $euiAnimSlightResistance 0s forwards;
@@ -85,20 +85,20 @@
&::before {
position: absolute;
top: 0;
- right: 0;
+ left: 0;
z-index: 1;
- width: 400px;
- height: 370px;
+ width: 310px;
+ height: 477px;
content: url(lightOrDarkTheme('ui/assets/images/bg_top_branded.svg', 'ui/assets/images/bg_top_branded_dark.svg'));
}
&::after {
position: fixed;
bottom: 0;
- left: 0;
+ right: 0;
z-index: 1;
- width: 1170px;
- height: 880px;
+ width: 313px;
+ height: 461px;
content: url(lightOrDarkTheme('ui/assets/images/bg_bottom_branded.svg', 'ui/assets/images/bg_bottom_branded_dark.svg'));
}
diff --git a/src/legacy/ui/public/vis/config/index.ts b/src/legacy/ui/public/vis/config/index.ts
index 5e87ac17b98fb..ee7385518a85d 100644
--- a/src/legacy/ui/public/vis/config/index.ts
+++ b/src/legacy/ui/public/vis/config/index.ts
@@ -17,5 +17,5 @@
* under the License.
*/
-export { editorConfigProviders } from './editor_config_providers';
+export { editorConfigProviders, EditorConfigProviderRegistry } from './editor_config_providers';
export * from './types';
diff --git a/src/legacy/core_plugins/console/common/text_object.ts b/src/plugins/console/common/text_object.ts
similarity index 100%
rename from src/legacy/core_plugins/console/common/text_object.ts
rename to src/plugins/console/common/text_object.ts
diff --git a/src/legacy/core_plugins/vis_type_timeseries/server/lib/search_strategies/index.js b/src/plugins/console/common/types/index.ts
similarity index 91%
rename from src/legacy/core_plugins/vis_type_timeseries/server/lib/search_strategies/index.js
rename to src/plugins/console/common/types/index.ts
index 512894f30a619..65e02b859d1ac 100644
--- a/src/legacy/core_plugins/vis_type_timeseries/server/lib/search_strategies/index.js
+++ b/src/plugins/console/common/types/index.ts
@@ -17,4 +17,5 @@
* under the License.
*/
-export { SearchStrategiesRegister } from './search_strategies_register';
+export * from './models';
+export * from './plugin_config';
diff --git a/src/legacy/core_plugins/console/common/types.ts b/src/plugins/console/common/types/models.ts
similarity index 97%
rename from src/legacy/core_plugins/console/common/types.ts
rename to src/plugins/console/common/types/models.ts
index 33d6907ff60b8..de118761aea54 100644
--- a/src/legacy/core_plugins/console/common/types.ts
+++ b/src/plugins/console/common/types/models.ts
@@ -17,7 +17,7 @@
* under the License.
*/
-import { TextObject } from './text_object';
+import { TextObject } from '../text_object';
export interface IdObject {
id: string;
diff --git a/src/plugins/console/common/types/plugin_config.ts b/src/plugins/console/common/types/plugin_config.ts
new file mode 100644
index 0000000000000..965c301d8b086
--- /dev/null
+++ b/src/plugins/console/common/types/plugin_config.ts
@@ -0,0 +1,22 @@
+/*
+ * Licensed to Elasticsearch B.V. under one or more contributor
+ * license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright
+ * ownership. Elasticsearch B.V. licenses this file to you under
+ * the Apache License, Version 2.0 (the "License"); you may
+ * not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+export interface PluginServerConfig {
+ elasticsearchUrl: string;
+}
diff --git a/src/legacy/core_plugins/console/public/kibana.json b/src/plugins/console/kibana.json
similarity index 73%
rename from src/legacy/core_plugins/console/public/kibana.json
rename to src/plugins/console/kibana.json
index c58a5a90fb9f2..18f7eb06e98ed 100644
--- a/src/legacy/core_plugins/console/public/kibana.json
+++ b/src/plugins/console/kibana.json
@@ -3,6 +3,6 @@
"version": "kibana",
"server": true,
"ui": true,
- "requiredPlugins": ["home"],
+ "requiredPlugins": ["dev_tools", "home"],
"optionalPlugins": ["usageCollection"]
}
diff --git a/src/legacy/core_plugins/console/public/np_ready/application/components/console_menu.tsx b/src/plugins/console/public/application/components/console_menu.tsx
similarity index 100%
rename from src/legacy/core_plugins/console/public/np_ready/application/components/console_menu.tsx
rename to src/plugins/console/public/application/components/console_menu.tsx
diff --git a/src/legacy/core_plugins/console/public/np_ready/application/components/editor_content_spinner.tsx b/src/plugins/console/public/application/components/editor_content_spinner.tsx
similarity index 100%
rename from src/legacy/core_plugins/console/public/np_ready/application/components/editor_content_spinner.tsx
rename to src/plugins/console/public/application/components/editor_content_spinner.tsx
diff --git a/src/legacy/core_plugins/console/public/np_ready/application/components/editor_example.tsx b/src/plugins/console/public/application/components/editor_example.tsx
similarity index 100%
rename from src/legacy/core_plugins/console/public/np_ready/application/components/editor_example.tsx
rename to src/plugins/console/public/application/components/editor_example.tsx
diff --git a/src/legacy/core_plugins/console/public/np_ready/application/components/help_panel.tsx b/src/plugins/console/public/application/components/help_panel.tsx
similarity index 100%
rename from src/legacy/core_plugins/console/public/np_ready/application/components/help_panel.tsx
rename to src/plugins/console/public/application/components/help_panel.tsx
diff --git a/src/legacy/core_plugins/console/public/np_ready/application/components/index.ts b/src/plugins/console/public/application/components/index.ts
similarity index 100%
rename from src/legacy/core_plugins/console/public/np_ready/application/components/index.ts
rename to src/plugins/console/public/application/components/index.ts
diff --git a/src/legacy/core_plugins/console/public/np_ready/application/components/settings_modal.tsx b/src/plugins/console/public/application/components/settings_modal.tsx
similarity index 98%
rename from src/legacy/core_plugins/console/public/np_ready/application/components/settings_modal.tsx
rename to src/plugins/console/public/application/components/settings_modal.tsx
index 05afdc9b79e0f..3cd20bf1bc343 100644
--- a/src/legacy/core_plugins/console/public/np_ready/application/components/settings_modal.tsx
+++ b/src/plugins/console/public/application/components/settings_modal.tsx
@@ -248,7 +248,10 @@ export function DevToolsSettingsModal(props: Props) {
}
>
{
+ const { stateSetter, ...rest } = opts;
+ return rest;
+ })}
idToSelectedMap={checkboxIdToSelectedMap}
onChange={(e: any) => {
onAutocompleteChange(e as AutocompleteOptions);
diff --git a/src/legacy/core_plugins/console/public/np_ready/application/components/something_went_wrong_callout.tsx b/src/plugins/console/public/application/components/something_went_wrong_callout.tsx
similarity index 100%
rename from src/legacy/core_plugins/console/public/np_ready/application/components/something_went_wrong_callout.tsx
rename to src/plugins/console/public/application/components/something_went_wrong_callout.tsx
diff --git a/src/legacy/core_plugins/console/public/np_ready/application/components/top_nav_menu.tsx b/src/plugins/console/public/application/components/top_nav_menu.tsx
similarity index 100%
rename from src/legacy/core_plugins/console/public/np_ready/application/components/top_nav_menu.tsx
rename to src/plugins/console/public/application/components/top_nav_menu.tsx
diff --git a/src/legacy/core_plugins/console/public/np_ready/application/components/welcome_panel.tsx b/src/plugins/console/public/application/components/welcome_panel.tsx
similarity index 100%
rename from src/legacy/core_plugins/console/public/np_ready/application/components/welcome_panel.tsx
rename to src/plugins/console/public/application/components/welcome_panel.tsx
diff --git a/src/legacy/core_plugins/console/public/np_ready/application/constants/help_example.txt b/src/plugins/console/public/application/constants/help_example.txt
similarity index 100%
rename from src/legacy/core_plugins/console/public/np_ready/application/constants/help_example.txt
rename to src/plugins/console/public/application/constants/help_example.txt
diff --git a/src/legacy/core_plugins/console/public/np_ready/application/containers/console_history/console_history.tsx b/src/plugins/console/public/application/containers/console_history/console_history.tsx
similarity index 100%
rename from src/legacy/core_plugins/console/public/np_ready/application/containers/console_history/console_history.tsx
rename to src/plugins/console/public/application/containers/console_history/console_history.tsx
diff --git a/src/legacy/core_plugins/console/public/np_ready/application/containers/console_history/history_viewer.tsx b/src/plugins/console/public/application/containers/console_history/history_viewer.tsx
similarity index 100%
rename from src/legacy/core_plugins/console/public/np_ready/application/containers/console_history/history_viewer.tsx
rename to src/plugins/console/public/application/containers/console_history/history_viewer.tsx
diff --git a/src/legacy/core_plugins/console/public/np_ready/application/containers/console_history/index.ts b/src/plugins/console/public/application/containers/console_history/index.ts
similarity index 100%
rename from src/legacy/core_plugins/console/public/np_ready/application/containers/console_history/index.ts
rename to src/plugins/console/public/application/containers/console_history/index.ts
diff --git a/src/legacy/core_plugins/console/public/np_ready/application/containers/editor/editor.tsx b/src/plugins/console/public/application/containers/editor/editor.tsx
similarity index 96%
rename from src/legacy/core_plugins/console/public/np_ready/application/containers/editor/editor.tsx
rename to src/plugins/console/public/application/containers/editor/editor.tsx
index b42d791e5acd8..5c7fe293651fb 100644
--- a/src/legacy/core_plugins/console/public/np_ready/application/containers/editor/editor.tsx
+++ b/src/plugins/console/public/application/containers/editor/editor.tsx
@@ -21,7 +21,7 @@ import React, { useCallback } from 'react';
import { debounce } from 'lodash';
import { EditorContentSpinner } from '../../components';
-import { Panel, PanelsContainer } from '../../../../../../../../plugins/kibana_react/public';
+import { Panel, PanelsContainer } from '../../../../../kibana_react/public';
import { Editor as EditorUI, EditorOutput } from './legacy/console_editor';
import { StorageKeys } from '../../../services';
import { useEditorReadContext, useServicesContext } from '../../contexts';
diff --git a/src/legacy/core_plugins/console/public/np_ready/application/containers/editor/index.ts b/src/plugins/console/public/application/containers/editor/index.ts
similarity index 100%
rename from src/legacy/core_plugins/console/public/np_ready/application/containers/editor/index.ts
rename to src/plugins/console/public/application/containers/editor/index.ts
diff --git a/src/legacy/core_plugins/console/public/np_ready/application/containers/editor/legacy/console_editor/apply_editor_settings.ts b/src/plugins/console/public/application/containers/editor/legacy/console_editor/apply_editor_settings.ts
similarity index 100%
rename from src/legacy/core_plugins/console/public/np_ready/application/containers/editor/legacy/console_editor/apply_editor_settings.ts
rename to src/plugins/console/public/application/containers/editor/legacy/console_editor/apply_editor_settings.ts
diff --git a/src/legacy/core_plugins/console/public/np_ready/application/containers/editor/legacy/console_editor/editor.test.mock.tsx b/src/plugins/console/public/application/containers/editor/legacy/console_editor/editor.test.mock.tsx
similarity index 100%
rename from src/legacy/core_plugins/console/public/np_ready/application/containers/editor/legacy/console_editor/editor.test.mock.tsx
rename to src/plugins/console/public/application/containers/editor/legacy/console_editor/editor.test.mock.tsx
diff --git a/src/legacy/core_plugins/console/public/np_ready/application/containers/editor/legacy/console_editor/editor.test.tsx b/src/plugins/console/public/application/containers/editor/legacy/console_editor/editor.test.tsx
similarity index 99%
rename from src/legacy/core_plugins/console/public/np_ready/application/containers/editor/legacy/console_editor/editor.test.tsx
rename to src/plugins/console/public/application/containers/editor/legacy/console_editor/editor.test.tsx
index d4079fcea33f8..306cdd396f4f8 100644
--- a/src/legacy/core_plugins/console/public/np_ready/application/containers/editor/legacy/console_editor/editor.test.tsx
+++ b/src/plugins/console/public/application/containers/editor/legacy/console_editor/editor.test.tsx
@@ -25,7 +25,7 @@ import { I18nProvider } from '@kbn/i18n/react';
import { act } from 'react-dom/test-utils';
import * as sinon from 'sinon';
-import { notificationServiceMock } from '../../../../../../../../../../../src/core/public/mocks';
+import { notificationServiceMock } from '../../../../../../../../core/public/mocks';
import { nextTick } from 'test_utils/enzyme_helpers';
import {
diff --git a/src/legacy/core_plugins/console/public/np_ready/application/containers/editor/legacy/console_editor/editor.tsx b/src/plugins/console/public/application/containers/editor/legacy/console_editor/editor.tsx
similarity index 100%
rename from src/legacy/core_plugins/console/public/np_ready/application/containers/editor/legacy/console_editor/editor.tsx
rename to src/plugins/console/public/application/containers/editor/legacy/console_editor/editor.tsx
diff --git a/src/legacy/core_plugins/console/public/np_ready/application/containers/editor/legacy/console_editor/editor_output.tsx b/src/plugins/console/public/application/containers/editor/legacy/console_editor/editor_output.tsx
similarity index 100%
rename from src/legacy/core_plugins/console/public/np_ready/application/containers/editor/legacy/console_editor/editor_output.tsx
rename to src/plugins/console/public/application/containers/editor/legacy/console_editor/editor_output.tsx
diff --git a/src/legacy/core_plugins/console/public/np_ready/application/containers/editor/legacy/console_editor/index.ts b/src/plugins/console/public/application/containers/editor/legacy/console_editor/index.ts
similarity index 100%
rename from src/legacy/core_plugins/console/public/np_ready/application/containers/editor/legacy/console_editor/index.ts
rename to src/plugins/console/public/application/containers/editor/legacy/console_editor/index.ts
diff --git a/src/legacy/core_plugins/console/public/np_ready/application/containers/editor/legacy/console_editor/keyboard_shortcuts.ts b/src/plugins/console/public/application/containers/editor/legacy/console_editor/keyboard_shortcuts.ts
similarity index 100%
rename from src/legacy/core_plugins/console/public/np_ready/application/containers/editor/legacy/console_editor/keyboard_shortcuts.ts
rename to src/plugins/console/public/application/containers/editor/legacy/console_editor/keyboard_shortcuts.ts
diff --git a/src/legacy/core_plugins/console/public/np_ready/application/containers/editor/legacy/console_menu_actions.ts b/src/plugins/console/public/application/containers/editor/legacy/console_menu_actions.ts
similarity index 100%
rename from src/legacy/core_plugins/console/public/np_ready/application/containers/editor/legacy/console_menu_actions.ts
rename to src/plugins/console/public/application/containers/editor/legacy/console_menu_actions.ts
diff --git a/src/legacy/core_plugins/console/public/np_ready/application/containers/editor/legacy/index.ts b/src/plugins/console/public/application/containers/editor/legacy/index.ts
similarity index 100%
rename from src/legacy/core_plugins/console/public/np_ready/application/containers/editor/legacy/index.ts
rename to src/plugins/console/public/application/containers/editor/legacy/index.ts
diff --git a/src/legacy/core_plugins/console/public/np_ready/application/containers/editor/legacy/subscribe_console_resize_checker.ts b/src/plugins/console/public/application/containers/editor/legacy/subscribe_console_resize_checker.ts
similarity index 93%
rename from src/legacy/core_plugins/console/public/np_ready/application/containers/editor/legacy/subscribe_console_resize_checker.ts
rename to src/plugins/console/public/application/containers/editor/legacy/subscribe_console_resize_checker.ts
index 1adc56d47927b..2d992aadbf15a 100644
--- a/src/legacy/core_plugins/console/public/np_ready/application/containers/editor/legacy/subscribe_console_resize_checker.ts
+++ b/src/plugins/console/public/application/containers/editor/legacy/subscribe_console_resize_checker.ts
@@ -16,7 +16,8 @@
* specific language governing permissions and limitations
* under the License.
*/
-import { ResizeChecker } from '../../../../../../../../../plugins/kibana_utils/public';
+
+import { ResizeChecker } from '../../../../../../kibana_utils/public';
export function subscribeResizeChecker(el: HTMLElement, ...editors: any[]) {
const checker = new ResizeChecker(el);
diff --git a/src/legacy/core_plugins/console/public/np_ready/application/containers/editor/legacy/use_ui_ace_keyboard_mode.tsx b/src/plugins/console/public/application/containers/editor/legacy/use_ui_ace_keyboard_mode.tsx
similarity index 100%
rename from src/legacy/core_plugins/console/public/np_ready/application/containers/editor/legacy/use_ui_ace_keyboard_mode.tsx
rename to src/plugins/console/public/application/containers/editor/legacy/use_ui_ace_keyboard_mode.tsx
diff --git a/src/legacy/core_plugins/console/public/np_ready/application/containers/index.ts b/src/plugins/console/public/application/containers/index.ts
similarity index 100%
rename from src/legacy/core_plugins/console/public/np_ready/application/containers/index.ts
rename to src/plugins/console/public/application/containers/index.ts
diff --git a/src/legacy/core_plugins/console/public/np_ready/application/containers/main/get_top_nav.ts b/src/plugins/console/public/application/containers/main/get_top_nav.ts
similarity index 100%
rename from src/legacy/core_plugins/console/public/np_ready/application/containers/main/get_top_nav.ts
rename to src/plugins/console/public/application/containers/main/get_top_nav.ts
diff --git a/src/legacy/core_plugins/console/public/np_ready/application/containers/main/index.ts b/src/plugins/console/public/application/containers/main/index.ts
similarity index 100%
rename from src/legacy/core_plugins/console/public/np_ready/application/containers/main/index.ts
rename to src/plugins/console/public/application/containers/main/index.ts
diff --git a/src/legacy/core_plugins/console/public/np_ready/application/containers/main/main.tsx b/src/plugins/console/public/application/containers/main/main.tsx
similarity index 100%
rename from src/legacy/core_plugins/console/public/np_ready/application/containers/main/main.tsx
rename to src/plugins/console/public/application/containers/main/main.tsx
diff --git a/src/legacy/core_plugins/console/public/np_ready/application/containers/settings.tsx b/src/plugins/console/public/application/containers/settings.tsx
similarity index 100%
rename from src/legacy/core_plugins/console/public/np_ready/application/containers/settings.tsx
rename to src/plugins/console/public/application/containers/settings.tsx
diff --git a/src/legacy/core_plugins/console/public/np_ready/application/contexts/create_use_context.ts b/src/plugins/console/public/application/contexts/create_use_context.ts
similarity index 100%
rename from src/legacy/core_plugins/console/public/np_ready/application/contexts/create_use_context.ts
rename to src/plugins/console/public/application/contexts/create_use_context.ts
diff --git a/src/legacy/core_plugins/console/public/np_ready/application/contexts/editor_context/editor_context.tsx b/src/plugins/console/public/application/contexts/editor_context/editor_context.tsx
similarity index 100%
rename from src/legacy/core_plugins/console/public/np_ready/application/contexts/editor_context/editor_context.tsx
rename to src/plugins/console/public/application/contexts/editor_context/editor_context.tsx
diff --git a/src/legacy/core_plugins/console/public/np_ready/application/contexts/editor_context/editor_registry.ts b/src/plugins/console/public/application/contexts/editor_context/editor_registry.ts
similarity index 100%
rename from src/legacy/core_plugins/console/public/np_ready/application/contexts/editor_context/editor_registry.ts
rename to src/plugins/console/public/application/contexts/editor_context/editor_registry.ts
diff --git a/src/legacy/core_plugins/console/public/np_ready/application/contexts/editor_context/index.ts b/src/plugins/console/public/application/contexts/editor_context/index.ts
similarity index 100%
rename from src/legacy/core_plugins/console/public/np_ready/application/contexts/editor_context/index.ts
rename to src/plugins/console/public/application/contexts/editor_context/index.ts
diff --git a/src/legacy/core_plugins/console/public/np_ready/application/contexts/index.ts b/src/plugins/console/public/application/contexts/index.ts
similarity index 100%
rename from src/legacy/core_plugins/console/public/np_ready/application/contexts/index.ts
rename to src/plugins/console/public/application/contexts/index.ts
diff --git a/src/legacy/core_plugins/console/public/np_ready/application/contexts/request_context.tsx b/src/plugins/console/public/application/contexts/request_context.tsx
similarity index 100%
rename from src/legacy/core_plugins/console/public/np_ready/application/contexts/request_context.tsx
rename to src/plugins/console/public/application/contexts/request_context.tsx
diff --git a/src/legacy/core_plugins/console/public/np_ready/application/contexts/services_context.tsx b/src/plugins/console/public/application/contexts/services_context.tsx
similarity index 96%
rename from src/legacy/core_plugins/console/public/np_ready/application/contexts/services_context.tsx
rename to src/plugins/console/public/application/contexts/services_context.tsx
index d7f036e1aecb6..4393cab4adbc5 100644
--- a/src/legacy/core_plugins/console/public/np_ready/application/contexts/services_context.tsx
+++ b/src/plugins/console/public/application/contexts/services_context.tsx
@@ -20,7 +20,7 @@
import React, { createContext, useContext } from 'react';
import { NotificationsSetup } from 'kibana/public';
import { History, Storage, Settings } from '../../services';
-import { ObjectStorageClient } from '../../../../common/types';
+import { ObjectStorageClient } from '../../../common/types';
import { MetricsTracker } from '../../types';
export interface ContextValue {
diff --git a/src/legacy/core_plugins/console/public/np_ready/application/factories/index.ts b/src/plugins/console/public/application/factories/index.ts
similarity index 100%
rename from src/legacy/core_plugins/console/public/np_ready/application/factories/index.ts
rename to src/plugins/console/public/application/factories/index.ts
diff --git a/src/legacy/core_plugins/console/public/np_ready/application/factories/token_iterator.ts b/src/plugins/console/public/application/factories/token_iterator.ts
similarity index 100%
rename from src/legacy/core_plugins/console/public/np_ready/application/factories/token_iterator.ts
rename to src/plugins/console/public/application/factories/token_iterator.ts
diff --git a/src/legacy/core_plugins/console/public/np_ready/application/hooks/index.ts b/src/plugins/console/public/application/hooks/index.ts
similarity index 100%
rename from src/legacy/core_plugins/console/public/np_ready/application/hooks/index.ts
rename to src/plugins/console/public/application/hooks/index.ts
diff --git a/src/legacy/core_plugins/console/public/np_ready/application/hooks/use_data_init/data_migration.ts b/src/plugins/console/public/application/hooks/use_data_init/data_migration.ts
similarity index 95%
rename from src/legacy/core_plugins/console/public/np_ready/application/hooks/use_data_init/data_migration.ts
rename to src/plugins/console/public/application/hooks/use_data_init/data_migration.ts
index 08acd78ba2b8a..67d39c37a2f45 100644
--- a/src/legacy/core_plugins/console/public/np_ready/application/hooks/use_data_init/data_migration.ts
+++ b/src/plugins/console/public/application/hooks/use_data_init/data_migration.ts
@@ -18,7 +18,7 @@
*/
import { History } from '../../../services';
-import { ObjectStorageClient } from '../../../../../common/types';
+import { ObjectStorageClient } from '../../../../common/types';
export interface Dependencies {
history: History;
diff --git a/src/legacy/core_plugins/console/public/np_ready/application/hooks/use_data_init/index.ts b/src/plugins/console/public/application/hooks/use_data_init/index.ts
similarity index 100%
rename from src/legacy/core_plugins/console/public/np_ready/application/hooks/use_data_init/index.ts
rename to src/plugins/console/public/application/hooks/use_data_init/index.ts
diff --git a/src/legacy/core_plugins/console/public/np_ready/application/hooks/use_data_init/use_data_init.ts b/src/plugins/console/public/application/hooks/use_data_init/use_data_init.ts
similarity index 88%
rename from src/legacy/core_plugins/console/public/np_ready/application/hooks/use_data_init/use_data_init.ts
rename to src/plugins/console/public/application/hooks/use_data_init/use_data_init.ts
index 2212827c1f598..2722c7a1665d3 100644
--- a/src/legacy/core_plugins/console/public/np_ready/application/hooks/use_data_init/use_data_init.ts
+++ b/src/plugins/console/public/application/hooks/use_data_init/use_data_init.ts
@@ -51,8 +51,12 @@ export const useDataInit = () => {
});
dispatch({ type: 'setCurrentTextObject', payload: newObject });
} else {
- // For now, we always take the first text object returned.
- dispatch({ type: 'setCurrentTextObject', payload: results[0] });
+ dispatch({
+ type: 'setCurrentTextObject',
+ // For backwards compatibility, we sort here according to date created to
+ // always take the first item created.
+ payload: results.sort((a, b) => a.createdAt - b.createdAt)[0],
+ });
}
} catch (e) {
setError(e);
diff --git a/src/legacy/core_plugins/console/public/np_ready/application/hooks/use_restore_request_from_history/index.ts b/src/plugins/console/public/application/hooks/use_restore_request_from_history/index.ts
similarity index 100%
rename from src/legacy/core_plugins/console/public/np_ready/application/hooks/use_restore_request_from_history/index.ts
rename to src/plugins/console/public/application/hooks/use_restore_request_from_history/index.ts
diff --git a/src/legacy/core_plugins/console/public/np_ready/application/hooks/use_restore_request_from_history/restore_request_from_history.ts b/src/plugins/console/public/application/hooks/use_restore_request_from_history/restore_request_from_history.ts
similarity index 100%
rename from src/legacy/core_plugins/console/public/np_ready/application/hooks/use_restore_request_from_history/restore_request_from_history.ts
rename to src/plugins/console/public/application/hooks/use_restore_request_from_history/restore_request_from_history.ts
diff --git a/src/legacy/core_plugins/console/public/np_ready/application/hooks/use_restore_request_from_history/use_restore_request_from_history.ts b/src/plugins/console/public/application/hooks/use_restore_request_from_history/use_restore_request_from_history.ts
similarity index 100%
rename from src/legacy/core_plugins/console/public/np_ready/application/hooks/use_restore_request_from_history/use_restore_request_from_history.ts
rename to src/plugins/console/public/application/hooks/use_restore_request_from_history/use_restore_request_from_history.ts
diff --git a/src/legacy/core_plugins/console/public/np_ready/application/hooks/use_save_current_text_object.ts b/src/plugins/console/public/application/hooks/use_save_current_text_object.ts
similarity index 100%
rename from src/legacy/core_plugins/console/public/np_ready/application/hooks/use_save_current_text_object.ts
rename to src/plugins/console/public/application/hooks/use_save_current_text_object.ts
diff --git a/src/legacy/core_plugins/console/public/np_ready/application/hooks/use_send_current_request_to_es/index.ts b/src/plugins/console/public/application/hooks/use_send_current_request_to_es/index.ts
similarity index 100%
rename from src/legacy/core_plugins/console/public/np_ready/application/hooks/use_send_current_request_to_es/index.ts
rename to src/plugins/console/public/application/hooks/use_send_current_request_to_es/index.ts
diff --git a/src/legacy/core_plugins/console/public/np_ready/application/hooks/use_send_current_request_to_es/send_request_to_es.ts b/src/plugins/console/public/application/hooks/use_send_current_request_to_es/send_request_to_es.ts
similarity index 100%
rename from src/legacy/core_plugins/console/public/np_ready/application/hooks/use_send_current_request_to_es/send_request_to_es.ts
rename to src/plugins/console/public/application/hooks/use_send_current_request_to_es/send_request_to_es.ts
diff --git a/src/legacy/core_plugins/console/public/np_ready/application/hooks/use_send_current_request_to_es/track.ts b/src/plugins/console/public/application/hooks/use_send_current_request_to_es/track.ts
similarity index 100%
rename from src/legacy/core_plugins/console/public/np_ready/application/hooks/use_send_current_request_to_es/track.ts
rename to src/plugins/console/public/application/hooks/use_send_current_request_to_es/track.ts
diff --git a/src/legacy/core_plugins/console/public/np_ready/application/hooks/use_send_current_request_to_es/use_send_current_request_to_es.ts b/src/plugins/console/public/application/hooks/use_send_current_request_to_es/use_send_current_request_to_es.ts
similarity index 100%
rename from src/legacy/core_plugins/console/public/np_ready/application/hooks/use_send_current_request_to_es/use_send_current_request_to_es.ts
rename to src/plugins/console/public/application/hooks/use_send_current_request_to_es/use_send_current_request_to_es.ts
diff --git a/src/legacy/core_plugins/console/public/np_ready/application/hooks/use_set_input_editor.ts b/src/plugins/console/public/application/hooks/use_set_input_editor.ts
similarity index 100%
rename from src/legacy/core_plugins/console/public/np_ready/application/hooks/use_set_input_editor.ts
rename to src/plugins/console/public/application/hooks/use_set_input_editor.ts
diff --git a/src/legacy/core_plugins/console/public/np_ready/application/index.tsx b/src/plugins/console/public/application/index.tsx
similarity index 81%
rename from src/legacy/core_plugins/console/public/np_ready/application/index.tsx
rename to src/plugins/console/public/application/index.tsx
index efd0f2ba86024..1fef52da6f31b 100644
--- a/src/legacy/core_plugins/console/public/np_ready/application/index.tsx
+++ b/src/plugins/console/public/application/index.tsx
@@ -18,27 +18,38 @@
*/
import React from 'react';
+import { render, unmountComponentAtNode } from 'react-dom';
import { NotificationsSetup } from 'src/core/public';
import { ServicesContextProvider, EditorContextProvider, RequestContextProvider } from './contexts';
import { Main } from './containers';
import { createStorage, createHistory, createSettings, Settings } from '../services';
import * as localStorageObjectClient from '../lib/local_storage_object_client';
import { createUsageTracker } from '../services/tracker';
+import { UsageCollectionSetup } from '../../../usage_collection/public';
let settingsRef: Settings;
export function legacyBackDoorToSettings() {
return settingsRef;
}
-export function boot(deps: {
+export interface BootDependencies {
docLinkVersion: string;
I18nContext: any;
notifications: NotificationsSetup;
elasticsearchUrl: string;
-}) {
- const { I18nContext, notifications, docLinkVersion, elasticsearchUrl } = deps;
+ usageCollection?: UsageCollectionSetup;
+ element: HTMLElement;
+}
- const trackUiMetric = createUsageTracker();
+export function renderApp({
+ I18nContext,
+ notifications,
+ docLinkVersion,
+ elasticsearchUrl,
+ usageCollection,
+ element,
+}: BootDependencies) {
+ const trackUiMetric = createUsageTracker(usageCollection);
trackUiMetric.load('opened_app');
const storage = createStorage({
@@ -50,7 +61,7 @@ export function boot(deps: {
const objectStorageClient = localStorageObjectClient.create(storage);
settingsRef = settings;
- return (
+ render(
-
+ ,
+ element
);
+
+ return () => unmountComponentAtNode(element);
}
diff --git a/src/legacy/core_plugins/console/public/np_ready/application/logo.svg b/src/plugins/console/public/application/logo.svg
similarity index 100%
rename from src/legacy/core_plugins/console/public/np_ready/application/logo.svg
rename to src/plugins/console/public/application/logo.svg
diff --git a/src/legacy/core_plugins/console/public/np_ready/application/models/index.ts b/src/plugins/console/public/application/models/index.ts
similarity index 100%
rename from src/legacy/core_plugins/console/public/np_ready/application/models/index.ts
rename to src/plugins/console/public/application/models/index.ts
diff --git a/src/legacy/core_plugins/console/public/np_ready/application/models/legacy_core_editor/__tests__/input_tokenization.test.js b/src/plugins/console/public/application/models/legacy_core_editor/__tests__/input_tokenization.test.js
similarity index 100%
rename from src/legacy/core_plugins/console/public/np_ready/application/models/legacy_core_editor/__tests__/input_tokenization.test.js
rename to src/plugins/console/public/application/models/legacy_core_editor/__tests__/input_tokenization.test.js
diff --git a/src/legacy/core_plugins/console/public/np_ready/application/models/legacy_core_editor/__tests__/output_tokenization.test.js b/src/plugins/console/public/application/models/legacy_core_editor/__tests__/output_tokenization.test.js
similarity index 100%
rename from src/legacy/core_plugins/console/public/np_ready/application/models/legacy_core_editor/__tests__/output_tokenization.test.js
rename to src/plugins/console/public/application/models/legacy_core_editor/__tests__/output_tokenization.test.js
diff --git a/src/legacy/core_plugins/console/public/np_ready/application/models/legacy_core_editor/create.ts b/src/plugins/console/public/application/models/legacy_core_editor/create.ts
similarity index 100%
rename from src/legacy/core_plugins/console/public/np_ready/application/models/legacy_core_editor/create.ts
rename to src/plugins/console/public/application/models/legacy_core_editor/create.ts
diff --git a/src/legacy/core_plugins/console/public/np_ready/application/models/legacy_core_editor/create_readonly.ts b/src/plugins/console/public/application/models/legacy_core_editor/create_readonly.ts
similarity index 100%
rename from src/legacy/core_plugins/console/public/np_ready/application/models/legacy_core_editor/create_readonly.ts
rename to src/plugins/console/public/application/models/legacy_core_editor/create_readonly.ts
diff --git a/src/legacy/core_plugins/console/public/np_ready/application/models/legacy_core_editor/index.ts b/src/plugins/console/public/application/models/legacy_core_editor/index.ts
similarity index 100%
rename from src/legacy/core_plugins/console/public/np_ready/application/models/legacy_core_editor/index.ts
rename to src/plugins/console/public/application/models/legacy_core_editor/index.ts
diff --git a/src/legacy/core_plugins/console/public/np_ready/application/models/legacy_core_editor/legacy_core_editor.test.mocks.ts b/src/plugins/console/public/application/models/legacy_core_editor/legacy_core_editor.test.mocks.ts
similarity index 100%
rename from src/legacy/core_plugins/console/public/np_ready/application/models/legacy_core_editor/legacy_core_editor.test.mocks.ts
rename to src/plugins/console/public/application/models/legacy_core_editor/legacy_core_editor.test.mocks.ts
diff --git a/src/legacy/core_plugins/console/public/np_ready/application/models/legacy_core_editor/legacy_core_editor.ts b/src/plugins/console/public/application/models/legacy_core_editor/legacy_core_editor.ts
similarity index 100%
rename from src/legacy/core_plugins/console/public/np_ready/application/models/legacy_core_editor/legacy_core_editor.ts
rename to src/plugins/console/public/application/models/legacy_core_editor/legacy_core_editor.ts
diff --git a/src/legacy/core_plugins/console/public/np_ready/application/models/legacy_core_editor/mode/elasticsearch_sql_highlight_rules.ts b/src/plugins/console/public/application/models/legacy_core_editor/mode/elasticsearch_sql_highlight_rules.ts
similarity index 100%
rename from src/legacy/core_plugins/console/public/np_ready/application/models/legacy_core_editor/mode/elasticsearch_sql_highlight_rules.ts
rename to src/plugins/console/public/application/models/legacy_core_editor/mode/elasticsearch_sql_highlight_rules.ts
diff --git a/src/legacy/core_plugins/console/public/np_ready/application/models/legacy_core_editor/mode/input.js b/src/plugins/console/public/application/models/legacy_core_editor/mode/input.js
similarity index 100%
rename from src/legacy/core_plugins/console/public/np_ready/application/models/legacy_core_editor/mode/input.js
rename to src/plugins/console/public/application/models/legacy_core_editor/mode/input.js
diff --git a/src/legacy/core_plugins/console/public/np_ready/application/models/legacy_core_editor/mode/input_highlight_rules.js b/src/plugins/console/public/application/models/legacy_core_editor/mode/input_highlight_rules.js
similarity index 100%
rename from src/legacy/core_plugins/console/public/np_ready/application/models/legacy_core_editor/mode/input_highlight_rules.js
rename to src/plugins/console/public/application/models/legacy_core_editor/mode/input_highlight_rules.js
diff --git a/src/legacy/core_plugins/console/public/np_ready/application/models/legacy_core_editor/mode/output.js b/src/plugins/console/public/application/models/legacy_core_editor/mode/output.js
similarity index 100%
rename from src/legacy/core_plugins/console/public/np_ready/application/models/legacy_core_editor/mode/output.js
rename to src/plugins/console/public/application/models/legacy_core_editor/mode/output.js
diff --git a/src/legacy/core_plugins/console/public/np_ready/application/models/legacy_core_editor/mode/output_highlight_rules.js b/src/plugins/console/public/application/models/legacy_core_editor/mode/output_highlight_rules.js
similarity index 100%
rename from src/legacy/core_plugins/console/public/np_ready/application/models/legacy_core_editor/mode/output_highlight_rules.js
rename to src/plugins/console/public/application/models/legacy_core_editor/mode/output_highlight_rules.js
diff --git a/src/legacy/core_plugins/console/public/np_ready/application/models/legacy_core_editor/mode/script.js b/src/plugins/console/public/application/models/legacy_core_editor/mode/script.js
similarity index 100%
rename from src/legacy/core_plugins/console/public/np_ready/application/models/legacy_core_editor/mode/script.js
rename to src/plugins/console/public/application/models/legacy_core_editor/mode/script.js
diff --git a/src/legacy/core_plugins/console/public/np_ready/application/models/legacy_core_editor/mode/script_highlight_rules.js b/src/plugins/console/public/application/models/legacy_core_editor/mode/script_highlight_rules.js
similarity index 100%
rename from src/legacy/core_plugins/console/public/np_ready/application/models/legacy_core_editor/mode/script_highlight_rules.js
rename to src/plugins/console/public/application/models/legacy_core_editor/mode/script_highlight_rules.js
diff --git a/src/legacy/core_plugins/console/public/np_ready/application/models/legacy_core_editor/mode/worker/index.js b/src/plugins/console/public/application/models/legacy_core_editor/mode/worker/index.js
similarity index 100%
rename from src/legacy/core_plugins/console/public/np_ready/application/models/legacy_core_editor/mode/worker/index.js
rename to src/plugins/console/public/application/models/legacy_core_editor/mode/worker/index.js
diff --git a/src/legacy/core_plugins/console/public/np_ready/application/models/legacy_core_editor/mode/worker/worker.js b/src/plugins/console/public/application/models/legacy_core_editor/mode/worker/worker.js
similarity index 100%
rename from src/legacy/core_plugins/console/public/np_ready/application/models/legacy_core_editor/mode/worker/worker.js
rename to src/plugins/console/public/application/models/legacy_core_editor/mode/worker/worker.js
diff --git a/src/legacy/core_plugins/console/public/np_ready/application/models/legacy_core_editor/mode/x_json_highlight_rules.js b/src/plugins/console/public/application/models/legacy_core_editor/mode/x_json_highlight_rules.js
similarity index 100%
rename from src/legacy/core_plugins/console/public/np_ready/application/models/legacy_core_editor/mode/x_json_highlight_rules.js
rename to src/plugins/console/public/application/models/legacy_core_editor/mode/x_json_highlight_rules.js
diff --git a/src/legacy/core_plugins/console/public/np_ready/application/models/legacy_core_editor/smart_resize.ts b/src/plugins/console/public/application/models/legacy_core_editor/smart_resize.ts
similarity index 100%
rename from src/legacy/core_plugins/console/public/np_ready/application/models/legacy_core_editor/smart_resize.ts
rename to src/plugins/console/public/application/models/legacy_core_editor/smart_resize.ts
diff --git a/src/legacy/core_plugins/console/public/np_ready/application/models/legacy_core_editor/theme_sense_dark.js b/src/plugins/console/public/application/models/legacy_core_editor/theme_sense_dark.js
similarity index 100%
rename from src/legacy/core_plugins/console/public/np_ready/application/models/legacy_core_editor/theme_sense_dark.js
rename to src/plugins/console/public/application/models/legacy_core_editor/theme_sense_dark.js
diff --git a/src/legacy/core_plugins/console/public/np_ready/application/models/sense_editor/__tests__/editor_input1.txt b/src/plugins/console/public/application/models/sense_editor/__tests__/editor_input1.txt
similarity index 100%
rename from src/legacy/core_plugins/console/public/np_ready/application/models/sense_editor/__tests__/editor_input1.txt
rename to src/plugins/console/public/application/models/sense_editor/__tests__/editor_input1.txt
diff --git a/src/legacy/core_plugins/console/public/np_ready/application/models/sense_editor/__tests__/integration.test.js b/src/plugins/console/public/application/models/sense_editor/__tests__/integration.test.js
similarity index 100%
rename from src/legacy/core_plugins/console/public/np_ready/application/models/sense_editor/__tests__/integration.test.js
rename to src/plugins/console/public/application/models/sense_editor/__tests__/integration.test.js
diff --git a/src/legacy/core_plugins/console/public/np_ready/application/models/sense_editor/__tests__/sense_editor.test.js b/src/plugins/console/public/application/models/sense_editor/__tests__/sense_editor.test.js
similarity index 100%
rename from src/legacy/core_plugins/console/public/np_ready/application/models/sense_editor/__tests__/sense_editor.test.js
rename to src/plugins/console/public/application/models/sense_editor/__tests__/sense_editor.test.js
diff --git a/src/legacy/core_plugins/console/public/np_ready/application/models/sense_editor/create.ts b/src/plugins/console/public/application/models/sense_editor/create.ts
similarity index 100%
rename from src/legacy/core_plugins/console/public/np_ready/application/models/sense_editor/create.ts
rename to src/plugins/console/public/application/models/sense_editor/create.ts
diff --git a/src/legacy/core_plugins/console/public/np_ready/application/models/sense_editor/curl.ts b/src/plugins/console/public/application/models/sense_editor/curl.ts
similarity index 100%
rename from src/legacy/core_plugins/console/public/np_ready/application/models/sense_editor/curl.ts
rename to src/plugins/console/public/application/models/sense_editor/curl.ts
diff --git a/src/legacy/core_plugins/console/public/np_ready/application/models/sense_editor/index.ts b/src/plugins/console/public/application/models/sense_editor/index.ts
similarity index 100%
rename from src/legacy/core_plugins/console/public/np_ready/application/models/sense_editor/index.ts
rename to src/plugins/console/public/application/models/sense_editor/index.ts
diff --git a/src/legacy/core_plugins/console/public/np_ready/application/models/sense_editor/sense_editor.test.mocks.ts b/src/plugins/console/public/application/models/sense_editor/sense_editor.test.mocks.ts
similarity index 100%
rename from src/legacy/core_plugins/console/public/np_ready/application/models/sense_editor/sense_editor.test.mocks.ts
rename to src/plugins/console/public/application/models/sense_editor/sense_editor.test.mocks.ts
diff --git a/src/legacy/core_plugins/console/public/np_ready/application/models/sense_editor/sense_editor.ts b/src/plugins/console/public/application/models/sense_editor/sense_editor.ts
similarity index 100%
rename from src/legacy/core_plugins/console/public/np_ready/application/models/sense_editor/sense_editor.ts
rename to src/plugins/console/public/application/models/sense_editor/sense_editor.ts
diff --git a/src/legacy/core_plugins/console/public/np_ready/application/stores/editor.ts b/src/plugins/console/public/application/stores/editor.ts
similarity index 96%
rename from src/legacy/core_plugins/console/public/np_ready/application/stores/editor.ts
rename to src/plugins/console/public/application/stores/editor.ts
index 844eacd9b91a8..73c29e7ff8575 100644
--- a/src/legacy/core_plugins/console/public/np_ready/application/stores/editor.ts
+++ b/src/plugins/console/public/application/stores/editor.ts
@@ -21,7 +21,7 @@ import { Reducer } from 'react';
import { produce } from 'immer';
import { identity } from 'fp-ts/lib/function';
import { DevToolsSettings } from '../../services';
-import { TextObject } from '../../../../common/text_object';
+import { TextObject } from '../../../common/text_object';
export interface Store {
ready: boolean;
diff --git a/src/legacy/core_plugins/console/public/np_ready/application/stores/request.ts b/src/plugins/console/public/application/stores/request.ts
similarity index 100%
rename from src/legacy/core_plugins/console/public/np_ready/application/stores/request.ts
rename to src/plugins/console/public/application/stores/request.ts
diff --git a/src/legacy/core_plugins/console/public/np_ready/index.ts b/src/plugins/console/public/index.ts
similarity index 85%
rename from src/legacy/core_plugins/console/public/np_ready/index.ts
rename to src/plugins/console/public/index.ts
index 045420f401e3b..2af9d1d16af02 100644
--- a/src/legacy/core_plugins/console/public/np_ready/index.ts
+++ b/src/plugins/console/public/index.ts
@@ -17,12 +17,10 @@
* under the License.
*/
-import { PluginInitializerContext } from 'kibana/public';
-
import { ConsoleUIPlugin } from './plugin';
export { ConsoleUIPlugin as Plugin };
-export function plugin(ctx: PluginInitializerContext) {
- return new ConsoleUIPlugin(ctx);
+export function plugin() {
+ return new ConsoleUIPlugin();
}
diff --git a/src/legacy/core_plugins/console/public/np_ready/lib/ace_token_provider/index.ts b/src/plugins/console/public/lib/ace_token_provider/index.ts
similarity index 100%
rename from src/legacy/core_plugins/console/public/np_ready/lib/ace_token_provider/index.ts
rename to src/plugins/console/public/lib/ace_token_provider/index.ts
diff --git a/src/legacy/core_plugins/console/public/np_ready/lib/ace_token_provider/token_provider.test.ts b/src/plugins/console/public/lib/ace_token_provider/token_provider.test.ts
similarity index 100%
rename from src/legacy/core_plugins/console/public/np_ready/lib/ace_token_provider/token_provider.test.ts
rename to src/plugins/console/public/lib/ace_token_provider/token_provider.test.ts
diff --git a/src/legacy/core_plugins/console/public/np_ready/lib/ace_token_provider/token_provider.ts b/src/plugins/console/public/lib/ace_token_provider/token_provider.ts
similarity index 100%
rename from src/legacy/core_plugins/console/public/np_ready/lib/ace_token_provider/token_provider.ts
rename to src/plugins/console/public/lib/ace_token_provider/token_provider.ts
diff --git a/src/legacy/core_plugins/console/public/np_ready/lib/autocomplete/__tests__/url_autocomplete.test.js b/src/plugins/console/public/lib/autocomplete/__tests__/url_autocomplete.test.js
similarity index 100%
rename from src/legacy/core_plugins/console/public/np_ready/lib/autocomplete/__tests__/url_autocomplete.test.js
rename to src/plugins/console/public/lib/autocomplete/__tests__/url_autocomplete.test.js
diff --git a/src/legacy/core_plugins/console/public/np_ready/lib/autocomplete/__tests__/url_params.test.js b/src/plugins/console/public/lib/autocomplete/__tests__/url_params.test.js
similarity index 100%
rename from src/legacy/core_plugins/console/public/np_ready/lib/autocomplete/__tests__/url_params.test.js
rename to src/plugins/console/public/lib/autocomplete/__tests__/url_params.test.js
diff --git a/src/legacy/core_plugins/console/public/np_ready/lib/autocomplete/autocomplete.ts b/src/plugins/console/public/lib/autocomplete/autocomplete.ts
similarity index 100%
rename from src/legacy/core_plugins/console/public/np_ready/lib/autocomplete/autocomplete.ts
rename to src/plugins/console/public/lib/autocomplete/autocomplete.ts
diff --git a/src/legacy/core_plugins/console/public/np_ready/lib/autocomplete/body_completer.js b/src/plugins/console/public/lib/autocomplete/body_completer.js
similarity index 100%
rename from src/legacy/core_plugins/console/public/np_ready/lib/autocomplete/body_completer.js
rename to src/plugins/console/public/lib/autocomplete/body_completer.js
diff --git a/src/legacy/core_plugins/console/public/np_ready/lib/autocomplete/components/accept_endpoint_component.js b/src/plugins/console/public/lib/autocomplete/components/accept_endpoint_component.js
similarity index 100%
rename from src/legacy/core_plugins/console/public/np_ready/lib/autocomplete/components/accept_endpoint_component.js
rename to src/plugins/console/public/lib/autocomplete/components/accept_endpoint_component.js
diff --git a/src/legacy/core_plugins/console/public/np_ready/lib/autocomplete/components/autocomplete_component.js b/src/plugins/console/public/lib/autocomplete/components/autocomplete_component.js
similarity index 100%
rename from src/legacy/core_plugins/console/public/np_ready/lib/autocomplete/components/autocomplete_component.js
rename to src/plugins/console/public/lib/autocomplete/components/autocomplete_component.js
diff --git a/src/legacy/core_plugins/console/public/np_ready/lib/autocomplete/components/conditional_proxy.js b/src/plugins/console/public/lib/autocomplete/components/conditional_proxy.js
similarity index 100%
rename from src/legacy/core_plugins/console/public/np_ready/lib/autocomplete/components/conditional_proxy.js
rename to src/plugins/console/public/lib/autocomplete/components/conditional_proxy.js
diff --git a/src/legacy/core_plugins/console/public/np_ready/lib/autocomplete/components/constant_component.js b/src/plugins/console/public/lib/autocomplete/components/constant_component.js
similarity index 100%
rename from src/legacy/core_plugins/console/public/np_ready/lib/autocomplete/components/constant_component.js
rename to src/plugins/console/public/lib/autocomplete/components/constant_component.js
diff --git a/src/legacy/core_plugins/console/public/np_ready/lib/autocomplete/components/field_autocomplete_component.js b/src/plugins/console/public/lib/autocomplete/components/field_autocomplete_component.js
similarity index 100%
rename from src/legacy/core_plugins/console/public/np_ready/lib/autocomplete/components/field_autocomplete_component.js
rename to src/plugins/console/public/lib/autocomplete/components/field_autocomplete_component.js
diff --git a/src/legacy/core_plugins/console/public/np_ready/lib/autocomplete/components/full_request_component.ts b/src/plugins/console/public/lib/autocomplete/components/full_request_component.ts
similarity index 100%
rename from src/legacy/core_plugins/console/public/np_ready/lib/autocomplete/components/full_request_component.ts
rename to src/plugins/console/public/lib/autocomplete/components/full_request_component.ts
diff --git a/src/legacy/core_plugins/console/public/np_ready/lib/autocomplete/components/global_only_component.js b/src/plugins/console/public/lib/autocomplete/components/global_only_component.js
similarity index 100%
rename from src/legacy/core_plugins/console/public/np_ready/lib/autocomplete/components/global_only_component.js
rename to src/plugins/console/public/lib/autocomplete/components/global_only_component.js
diff --git a/src/legacy/core_plugins/console/public/np_ready/lib/autocomplete/components/id_autocomplete_component.js b/src/plugins/console/public/lib/autocomplete/components/id_autocomplete_component.js
similarity index 100%
rename from src/legacy/core_plugins/console/public/np_ready/lib/autocomplete/components/id_autocomplete_component.js
rename to src/plugins/console/public/lib/autocomplete/components/id_autocomplete_component.js
diff --git a/src/legacy/core_plugins/console/public/np_ready/lib/autocomplete/components/index.js b/src/plugins/console/public/lib/autocomplete/components/index.js
similarity index 100%
rename from src/legacy/core_plugins/console/public/np_ready/lib/autocomplete/components/index.js
rename to src/plugins/console/public/lib/autocomplete/components/index.js
diff --git a/src/legacy/core_plugins/console/public/np_ready/lib/autocomplete/components/index_autocomplete_component.js b/src/plugins/console/public/lib/autocomplete/components/index_autocomplete_component.js
similarity index 100%
rename from src/legacy/core_plugins/console/public/np_ready/lib/autocomplete/components/index_autocomplete_component.js
rename to src/plugins/console/public/lib/autocomplete/components/index_autocomplete_component.js
diff --git a/src/legacy/core_plugins/console/public/np_ready/lib/autocomplete/components/list_component.js b/src/plugins/console/public/lib/autocomplete/components/list_component.js
similarity index 100%
rename from src/legacy/core_plugins/console/public/np_ready/lib/autocomplete/components/list_component.js
rename to src/plugins/console/public/lib/autocomplete/components/list_component.js
diff --git a/src/legacy/core_plugins/console/public/np_ready/lib/autocomplete/components/object_component.js b/src/plugins/console/public/lib/autocomplete/components/object_component.js
similarity index 100%
rename from src/legacy/core_plugins/console/public/np_ready/lib/autocomplete/components/object_component.js
rename to src/plugins/console/public/lib/autocomplete/components/object_component.js
diff --git a/src/legacy/core_plugins/console/public/np_ready/lib/autocomplete/components/shared_component.js b/src/plugins/console/public/lib/autocomplete/components/shared_component.js
similarity index 100%
rename from src/legacy/core_plugins/console/public/np_ready/lib/autocomplete/components/shared_component.js
rename to src/plugins/console/public/lib/autocomplete/components/shared_component.js
diff --git a/src/legacy/core_plugins/console/public/np_ready/lib/autocomplete/components/simple_param_component.js b/src/plugins/console/public/lib/autocomplete/components/simple_param_component.js
similarity index 100%
rename from src/legacy/core_plugins/console/public/np_ready/lib/autocomplete/components/simple_param_component.js
rename to src/plugins/console/public/lib/autocomplete/components/simple_param_component.js
diff --git a/src/legacy/core_plugins/console/public/np_ready/lib/autocomplete/components/template_autocomplete_component.js b/src/plugins/console/public/lib/autocomplete/components/template_autocomplete_component.js
similarity index 100%
rename from src/legacy/core_plugins/console/public/np_ready/lib/autocomplete/components/template_autocomplete_component.js
rename to src/plugins/console/public/lib/autocomplete/components/template_autocomplete_component.js
diff --git a/src/legacy/core_plugins/console/public/np_ready/lib/autocomplete/components/type_autocomplete_component.js b/src/plugins/console/public/lib/autocomplete/components/type_autocomplete_component.js
similarity index 100%
rename from src/legacy/core_plugins/console/public/np_ready/lib/autocomplete/components/type_autocomplete_component.js
rename to src/plugins/console/public/lib/autocomplete/components/type_autocomplete_component.js
diff --git a/src/legacy/core_plugins/console/public/np_ready/lib/autocomplete/components/url_pattern_matcher.js b/src/plugins/console/public/lib/autocomplete/components/url_pattern_matcher.js
similarity index 100%
rename from src/legacy/core_plugins/console/public/np_ready/lib/autocomplete/components/url_pattern_matcher.js
rename to src/plugins/console/public/lib/autocomplete/components/url_pattern_matcher.js
diff --git a/src/legacy/core_plugins/console/public/np_ready/lib/autocomplete/components/username_autocomplete_component.js b/src/plugins/console/public/lib/autocomplete/components/username_autocomplete_component.js
similarity index 100%
rename from src/legacy/core_plugins/console/public/np_ready/lib/autocomplete/components/username_autocomplete_component.js
rename to src/plugins/console/public/lib/autocomplete/components/username_autocomplete_component.js
diff --git a/src/legacy/core_plugins/console/public/np_ready/lib/autocomplete/engine.js b/src/plugins/console/public/lib/autocomplete/engine.js
similarity index 100%
rename from src/legacy/core_plugins/console/public/np_ready/lib/autocomplete/engine.js
rename to src/plugins/console/public/lib/autocomplete/engine.js
diff --git a/src/legacy/core_plugins/console/public/np_ready/lib/autocomplete/get_endpoint_from_position.ts b/src/plugins/console/public/lib/autocomplete/get_endpoint_from_position.ts
similarity index 92%
rename from src/legacy/core_plugins/console/public/np_ready/lib/autocomplete/get_endpoint_from_position.ts
rename to src/plugins/console/public/lib/autocomplete/get_endpoint_from_position.ts
index cb037e29e33f6..8cac8d1208cee 100644
--- a/src/legacy/core_plugins/console/public/np_ready/lib/autocomplete/get_endpoint_from_position.ts
+++ b/src/plugins/console/public/lib/autocomplete/get_endpoint_from_position.ts
@@ -30,7 +30,10 @@ export function getEndpointFromPosition(editor: CoreEditor, pos: Position, parse
const context = {
...getCurrentMethodAndTokenPaths(
editor,
- { column: lineValue.length, lineNumber: pos.lineNumber },
+ {
+ column: lineValue.length + 1 /* Go to the very end of the line */,
+ lineNumber: pos.lineNumber,
+ },
parser,
true
),
diff --git a/src/legacy/core_plugins/console/public/np_ready/lib/autocomplete/url_params.js b/src/plugins/console/public/lib/autocomplete/url_params.js
similarity index 100%
rename from src/legacy/core_plugins/console/public/np_ready/lib/autocomplete/url_params.js
rename to src/plugins/console/public/lib/autocomplete/url_params.js
diff --git a/src/legacy/core_plugins/console/public/np_ready/lib/curl_parsing/__tests__/curl_parsing.test.js b/src/plugins/console/public/lib/curl_parsing/__tests__/curl_parsing.test.js
similarity index 100%
rename from src/legacy/core_plugins/console/public/np_ready/lib/curl_parsing/__tests__/curl_parsing.test.js
rename to src/plugins/console/public/lib/curl_parsing/__tests__/curl_parsing.test.js
diff --git a/src/legacy/core_plugins/console/public/np_ready/lib/curl_parsing/__tests__/curl_parsing.txt b/src/plugins/console/public/lib/curl_parsing/__tests__/curl_parsing.txt
similarity index 100%
rename from src/legacy/core_plugins/console/public/np_ready/lib/curl_parsing/__tests__/curl_parsing.txt
rename to src/plugins/console/public/lib/curl_parsing/__tests__/curl_parsing.txt
diff --git a/src/legacy/core_plugins/console/public/np_ready/lib/curl_parsing/curl.js b/src/plugins/console/public/lib/curl_parsing/curl.js
similarity index 100%
rename from src/legacy/core_plugins/console/public/np_ready/lib/curl_parsing/curl.js
rename to src/plugins/console/public/lib/curl_parsing/curl.js
diff --git a/src/legacy/core_plugins/console/public/np_ready/lib/es/__tests__/content_type.test.js b/src/plugins/console/public/lib/es/__tests__/content_type.test.js
similarity index 100%
rename from src/legacy/core_plugins/console/public/np_ready/lib/es/__tests__/content_type.test.js
rename to src/plugins/console/public/lib/es/__tests__/content_type.test.js
diff --git a/src/legacy/core_plugins/console/public/np_ready/lib/es/es.js b/src/plugins/console/public/lib/es/es.js
similarity index 100%
rename from src/legacy/core_plugins/console/public/np_ready/lib/es/es.js
rename to src/plugins/console/public/lib/es/es.js
diff --git a/src/legacy/core_plugins/console/public/np_ready/lib/kb/__tests__/kb.test.js b/src/plugins/console/public/lib/kb/__tests__/kb.test.js
similarity index 100%
rename from src/legacy/core_plugins/console/public/np_ready/lib/kb/__tests__/kb.test.js
rename to src/plugins/console/public/lib/kb/__tests__/kb.test.js
diff --git a/src/legacy/core_plugins/console/public/np_ready/lib/kb/api.js b/src/plugins/console/public/lib/kb/api.js
similarity index 100%
rename from src/legacy/core_plugins/console/public/np_ready/lib/kb/api.js
rename to src/plugins/console/public/lib/kb/api.js
diff --git a/src/legacy/core_plugins/console/public/np_ready/lib/kb/index.js b/src/plugins/console/public/lib/kb/index.js
similarity index 100%
rename from src/legacy/core_plugins/console/public/np_ready/lib/kb/index.js
rename to src/plugins/console/public/lib/kb/index.js
diff --git a/src/legacy/core_plugins/console/public/np_ready/lib/kb/kb.js b/src/plugins/console/public/lib/kb/kb.js
similarity index 100%
rename from src/legacy/core_plugins/console/public/np_ready/lib/kb/kb.js
rename to src/plugins/console/public/lib/kb/kb.js
diff --git a/src/legacy/core_plugins/console/public/np_ready/lib/local_storage_object_client/create.ts b/src/plugins/console/public/lib/local_storage_object_client/create.ts
similarity index 88%
rename from src/legacy/core_plugins/console/public/np_ready/lib/local_storage_object_client/create.ts
rename to src/plugins/console/public/lib/local_storage_object_client/create.ts
index 36948b9acb962..503387f7b4a41 100644
--- a/src/legacy/core_plugins/console/public/np_ready/lib/local_storage_object_client/create.ts
+++ b/src/plugins/console/public/lib/local_storage_object_client/create.ts
@@ -18,8 +18,8 @@
*/
import { Storage } from '../../services';
-import { ObjectStorageClient } from '../../../../common/types';
-import { TextObject, textObjectTypeName } from '../../../../common/text_object';
+import { ObjectStorageClient } from '../../../common/types';
+import { TextObject, textObjectTypeName } from '../../../common/text_object';
import { LocalObjectStorage } from './local_storage_object_client';
export const create = (storage: Storage): ObjectStorageClient => {
diff --git a/src/legacy/core_plugins/console/public/np_ready/lib/local_storage_object_client/index.ts b/src/plugins/console/public/lib/local_storage_object_client/index.ts
similarity index 100%
rename from src/legacy/core_plugins/console/public/np_ready/lib/local_storage_object_client/index.ts
rename to src/plugins/console/public/lib/local_storage_object_client/index.ts
diff --git a/src/legacy/core_plugins/console/public/np_ready/lib/local_storage_object_client/local_storage_object_client.ts b/src/plugins/console/public/lib/local_storage_object_client/local_storage_object_client.ts
similarity index 96%
rename from src/legacy/core_plugins/console/public/np_ready/lib/local_storage_object_client/local_storage_object_client.ts
rename to src/plugins/console/public/lib/local_storage_object_client/local_storage_object_client.ts
index 41c88d23b2533..8eac345898f9a 100644
--- a/src/legacy/core_plugins/console/public/np_ready/lib/local_storage_object_client/local_storage_object_client.ts
+++ b/src/plugins/console/public/lib/local_storage_object_client/local_storage_object_client.ts
@@ -18,7 +18,7 @@
*/
import uuid from 'uuid';
-import { ObjectStorage, IdObject } from '../../../../common/types';
+import { ObjectStorage, IdObject } from '../../../common/types';
import { Storage } from '../../services';
export class LocalObjectStorage implements ObjectStorage {
diff --git a/src/legacy/core_plugins/console/public/np_ready/lib/mappings/__tests__/mapping.test.js b/src/plugins/console/public/lib/mappings/__tests__/mapping.test.js
similarity index 100%
rename from src/legacy/core_plugins/console/public/np_ready/lib/mappings/__tests__/mapping.test.js
rename to src/plugins/console/public/lib/mappings/__tests__/mapping.test.js
diff --git a/src/legacy/core_plugins/console/public/np_ready/lib/mappings/mappings.js b/src/plugins/console/public/lib/mappings/mappings.js
similarity index 100%
rename from src/legacy/core_plugins/console/public/np_ready/lib/mappings/mappings.js
rename to src/plugins/console/public/lib/mappings/mappings.js
diff --git a/src/legacy/core_plugins/console/public/np_ready/lib/row_parser.ts b/src/plugins/console/public/lib/row_parser.ts
similarity index 100%
rename from src/legacy/core_plugins/console/public/np_ready/lib/row_parser.ts
rename to src/plugins/console/public/lib/row_parser.ts
diff --git a/src/legacy/core_plugins/console/public/np_ready/lib/token_iterator/index.ts b/src/plugins/console/public/lib/token_iterator/index.ts
similarity index 100%
rename from src/legacy/core_plugins/console/public/np_ready/lib/token_iterator/index.ts
rename to src/plugins/console/public/lib/token_iterator/index.ts
diff --git a/src/legacy/core_plugins/console/public/np_ready/lib/token_iterator/token_iterator.test.ts b/src/plugins/console/public/lib/token_iterator/token_iterator.test.ts
similarity index 100%
rename from src/legacy/core_plugins/console/public/np_ready/lib/token_iterator/token_iterator.test.ts
rename to src/plugins/console/public/lib/token_iterator/token_iterator.test.ts
diff --git a/src/legacy/core_plugins/console/public/np_ready/lib/token_iterator/token_iterator.ts b/src/plugins/console/public/lib/token_iterator/token_iterator.ts
similarity index 100%
rename from src/legacy/core_plugins/console/public/np_ready/lib/token_iterator/token_iterator.ts
rename to src/plugins/console/public/lib/token_iterator/token_iterator.ts
diff --git a/src/legacy/core_plugins/console/public/np_ready/lib/utils/__tests__/utils.test.js b/src/plugins/console/public/lib/utils/__tests__/utils.test.js
similarity index 100%
rename from src/legacy/core_plugins/console/public/np_ready/lib/utils/__tests__/utils.test.js
rename to src/plugins/console/public/lib/utils/__tests__/utils.test.js
diff --git a/src/legacy/core_plugins/console/public/np_ready/lib/utils/__tests__/utils_string_collapsing.txt b/src/plugins/console/public/lib/utils/__tests__/utils_string_collapsing.txt
similarity index 100%
rename from src/legacy/core_plugins/console/public/np_ready/lib/utils/__tests__/utils_string_collapsing.txt
rename to src/plugins/console/public/lib/utils/__tests__/utils_string_collapsing.txt
diff --git a/src/legacy/core_plugins/console/public/np_ready/lib/utils/__tests__/utils_string_expanding.txt b/src/plugins/console/public/lib/utils/__tests__/utils_string_expanding.txt
similarity index 100%
rename from src/legacy/core_plugins/console/public/np_ready/lib/utils/__tests__/utils_string_expanding.txt
rename to src/plugins/console/public/lib/utils/__tests__/utils_string_expanding.txt
diff --git a/src/legacy/core_plugins/console/public/np_ready/lib/utils/utils.ts b/src/plugins/console/public/lib/utils/utils.ts
similarity index 100%
rename from src/legacy/core_plugins/console/public/np_ready/lib/utils/utils.ts
rename to src/plugins/console/public/lib/utils/utils.ts
diff --git a/src/legacy/core_plugins/console/public/np_ready/plugin.ts b/src/plugins/console/public/plugin.ts
similarity index 58%
rename from src/legacy/core_plugins/console/public/np_ready/plugin.ts
rename to src/plugins/console/public/plugin.ts
index 22351ae95ba87..71a5e150a9f00 100644
--- a/src/legacy/core_plugins/console/public/np_ready/plugin.ts
+++ b/src/plugins/console/public/plugin.ts
@@ -17,23 +17,21 @@
* under the License.
*/
-import { render, unmountComponentAtNode } from 'react-dom';
import { i18n } from '@kbn/i18n';
-import { PluginInitializerContext, Plugin, CoreStart, CoreSetup } from 'src/core/public';
-import { XPluginSet } from '../legacy';
+import { CoreSetup, CoreStart, Plugin } from 'kibana/public';
-export class ConsoleUIPlugin implements Plugin {
- // @ts-ignore
- constructor(private readonly ctx: PluginInitializerContext) {}
+import { FeatureCatalogueCategory } from '../../home/public';
- async setup({ notifications }: CoreSetup, pluginSet: XPluginSet) {
- const {
- __LEGACY: { I18nContext, elasticsearchUrl, category },
- dev_tools,
- home,
- } = pluginSet;
+import { AppSetupUIPluginDependencies } from './types';
+export class ConsoleUIPlugin implements Plugin {
+ constructor() {}
+
+ async setup(
+ { notifications, getStartServices }: CoreSetup,
+ { dev_tools, home, usageCollection }: AppSetupUIPluginDependencies
+ ) {
home.featureCatalogue.register({
id: 'console',
title: i18n.translate('console.devToolsTitle', {
@@ -45,7 +43,7 @@ export class ConsoleUIPlugin implements Plugin {
icon: 'consoleApp',
path: '/app/kibana#/dev_tools/console',
showOnHomePage: true,
- category,
+ category: FeatureCatalogueCategory.ADMIN,
});
dev_tools.register({
@@ -55,20 +53,21 @@ export class ConsoleUIPlugin implements Plugin {
defaultMessage: 'Console',
}),
enableRouting: false,
- async mount({ core: { docLinks } }, { element }) {
- const { boot } = await import('./application');
- render(
- boot({
- docLinkVersion: docLinks.DOC_LINK_VERSION,
- I18nContext,
- notifications,
- elasticsearchUrl,
- }),
- element
- );
- return () => {
- unmountComponentAtNode(element);
- };
+ mount: async ({ core: { docLinks, i18n: i18nDep } }, { element }) => {
+ const { renderApp } = await import('./application');
+ const [{ injectedMetadata }] = await getStartServices();
+ const elasticsearchUrl = injectedMetadata.getInjectedVar(
+ 'elasticsearchUrl',
+ 'http://localhost:9200'
+ ) as string;
+ return renderApp({
+ docLinkVersion: docLinks.DOC_LINK_VERSION,
+ I18nContext: i18nDep.Context,
+ notifications,
+ elasticsearchUrl,
+ usageCollection,
+ element,
+ });
},
});
}
diff --git a/src/legacy/core_plugins/console/public/np_ready/services/history.ts b/src/plugins/console/public/services/history.ts
similarity index 100%
rename from src/legacy/core_plugins/console/public/np_ready/services/history.ts
rename to src/plugins/console/public/services/history.ts
diff --git a/src/legacy/core_plugins/console/public/np_ready/services/index.ts b/src/plugins/console/public/services/index.ts
similarity index 100%
rename from src/legacy/core_plugins/console/public/np_ready/services/index.ts
rename to src/plugins/console/public/services/index.ts
diff --git a/src/legacy/core_plugins/console/public/np_ready/services/settings.ts b/src/plugins/console/public/services/settings.ts
similarity index 100%
rename from src/legacy/core_plugins/console/public/np_ready/services/settings.ts
rename to src/plugins/console/public/services/settings.ts
diff --git a/src/legacy/core_plugins/console/public/np_ready/services/storage.ts b/src/plugins/console/public/services/storage.ts
similarity index 100%
rename from src/legacy/core_plugins/console/public/np_ready/services/storage.ts
rename to src/plugins/console/public/services/storage.ts
diff --git a/src/legacy/core_plugins/console/public/np_ready/services/tracker.ts b/src/plugins/console/public/services/tracker.ts
similarity index 62%
rename from src/legacy/core_plugins/console/public/np_ready/services/tracker.ts
rename to src/plugins/console/public/services/tracker.ts
index 13d5f875b3c6f..f5abcd145d0f7 100644
--- a/src/legacy/core_plugins/console/public/np_ready/services/tracker.ts
+++ b/src/plugins/console/public/services/tracker.ts
@@ -17,15 +17,22 @@
* under the License.
*/
-import { METRIC_TYPE } from '@kbn/analytics';
+import { METRIC_TYPE, UiStatsMetricType } from '@kbn/analytics';
import { MetricsTracker } from '../types';
-import { createUiStatsReporter } from '../../../../ui_metric/public';
+import { UsageCollectionSetup } from '../../../usage_collection/public';
const APP_TRACKER_NAME = 'console';
-export const createUsageTracker = (): MetricsTracker => {
- const track = createUiStatsReporter(APP_TRACKER_NAME);
+
+export const createUsageTracker = (usageCollection?: UsageCollectionSetup): MetricsTracker => {
+ const track = (type: UiStatsMetricType, name: string) =>
+ usageCollection?.reportUiStats(APP_TRACKER_NAME, type, name);
+
return {
- count: (eventName: string) => track(METRIC_TYPE.COUNT, eventName),
- load: (eventName: string) => track(METRIC_TYPE.LOADED, eventName),
+ count: (eventName: string) => {
+ track(METRIC_TYPE.COUNT, eventName);
+ },
+ load: (eventName: string) => {
+ track(METRIC_TYPE.LOADED, eventName);
+ },
};
};
diff --git a/src/legacy/core_plugins/console/public/np_ready/types/common.ts b/src/plugins/console/public/types/common.ts
similarity index 100%
rename from src/legacy/core_plugins/console/public/np_ready/types/common.ts
rename to src/plugins/console/public/types/common.ts
diff --git a/src/legacy/core_plugins/console/public/np_ready/types/core_editor.ts b/src/plugins/console/public/types/core_editor.ts
similarity index 100%
rename from src/legacy/core_plugins/console/public/np_ready/types/core_editor.ts
rename to src/plugins/console/public/types/core_editor.ts
diff --git a/src/legacy/core_plugins/console/public/np_ready/types/index.ts b/src/plugins/console/public/types/index.ts
similarity index 95%
rename from src/legacy/core_plugins/console/public/np_ready/types/index.ts
rename to src/plugins/console/public/types/index.ts
index 78c6b6c8f55cc..555a0ea82c523 100644
--- a/src/legacy/core_plugins/console/public/np_ready/types/index.ts
+++ b/src/plugins/console/public/types/index.ts
@@ -17,6 +17,7 @@
* under the License.
*/
+export * from './plugin_dependencies';
export * from './core_editor';
export * from './token';
export * from './tokens_provider';
diff --git a/src/plugins/console/public/types/plugin_dependencies.ts b/src/plugins/console/public/types/plugin_dependencies.ts
new file mode 100644
index 0000000000000..6bc4ff25ee442
--- /dev/null
+++ b/src/plugins/console/public/types/plugin_dependencies.ts
@@ -0,0 +1,27 @@
+/*
+ * Licensed to Elasticsearch B.V. under one or more contributor
+ * license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright
+ * ownership. Elasticsearch B.V. licenses this file to you under
+ * the Apache License, Version 2.0 (the "License"); you may
+ * not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+import { HomePublicPluginSetup } from '../../../home/public';
+import { DevToolsSetup } from '../../../dev_tools/public';
+import { UsageCollectionSetup } from '../../../usage_collection/public';
+
+export interface AppSetupUIPluginDependencies {
+ home: HomePublicPluginSetup;
+ dev_tools: DevToolsSetup;
+ usageCollection?: UsageCollectionSetup;
+}
diff --git a/src/legacy/core_plugins/console/public/np_ready/types/token.ts b/src/plugins/console/public/types/token.ts
similarity index 100%
rename from src/legacy/core_plugins/console/public/np_ready/types/token.ts
rename to src/plugins/console/public/types/token.ts
diff --git a/src/legacy/core_plugins/console/public/np_ready/types/tokens_provider.ts b/src/plugins/console/public/types/tokens_provider.ts
similarity index 100%
rename from src/legacy/core_plugins/console/public/np_ready/types/tokens_provider.ts
rename to src/plugins/console/public/types/tokens_provider.ts
diff --git a/src/legacy/core_plugins/console/server/__tests__/elasticsearch_proxy_config.js b/src/plugins/console/server/__tests__/elasticsearch_proxy_config.js
similarity index 98%
rename from src/legacy/core_plugins/console/server/__tests__/elasticsearch_proxy_config.js
rename to src/plugins/console/server/__tests__/elasticsearch_proxy_config.js
index ec7d256975b27..df8b49b0a089e 100644
--- a/src/legacy/core_plugins/console/server/__tests__/elasticsearch_proxy_config.js
+++ b/src/plugins/console/server/__tests__/elasticsearch_proxy_config.js
@@ -19,7 +19,7 @@
import expect from '@kbn/expect';
import moment from 'moment';
-import { getElasticsearchProxyConfig } from '../elasticsearch_proxy_config';
+import { getElasticsearchProxyConfig } from '../lib/elasticsearch_proxy_config';
import https from 'https';
import http from 'http';
diff --git a/src/legacy/core_plugins/console/server/__tests__/proxy_config.js b/src/plugins/console/server/__tests__/proxy_config.js
similarity index 99%
rename from src/legacy/core_plugins/console/server/__tests__/proxy_config.js
rename to src/plugins/console/server/__tests__/proxy_config.js
index 2a221aa261167..b0b85e6bb7d06 100644
--- a/src/legacy/core_plugins/console/server/__tests__/proxy_config.js
+++ b/src/plugins/console/server/__tests__/proxy_config.js
@@ -24,7 +24,7 @@ import sinon from 'sinon';
import https, { Agent as HttpsAgent } from 'https';
import { parse as parseUrl } from 'url';
-import { ProxyConfig } from '../proxy_config';
+import { ProxyConfig } from '../lib/proxy_config';
const matchGoogle = {
protocol: 'https',
diff --git a/src/legacy/core_plugins/console/server/__tests__/proxy_config_collection.js b/src/plugins/console/server/__tests__/proxy_config_collection.js
similarity index 98%
rename from src/legacy/core_plugins/console/server/__tests__/proxy_config_collection.js
rename to src/plugins/console/server/__tests__/proxy_config_collection.js
index 1791ca9865d25..e1bc099ac1e85 100644
--- a/src/legacy/core_plugins/console/server/__tests__/proxy_config_collection.js
+++ b/src/plugins/console/server/__tests__/proxy_config_collection.js
@@ -24,7 +24,7 @@ import sinon from 'sinon';
import fs from 'fs';
import { Agent as HttpsAgent } from 'https';
-import { ProxyConfigCollection } from '../proxy_config_collection';
+import { ProxyConfigCollection } from '../lib/proxy_config_collection';
describe('ProxyConfigCollection', function() {
beforeEach(function() {
diff --git a/src/legacy/core_plugins/console/server/__tests__/proxy_route/body.js b/src/plugins/console/server/__tests__/proxy_route/body.test.ts
similarity index 63%
rename from src/legacy/core_plugins/console/server/__tests__/proxy_route/body.js
rename to src/plugins/console/server/__tests__/proxy_route/body.test.ts
index 923567769a6b8..252009a8977f3 100644
--- a/src/legacy/core_plugins/console/server/__tests__/proxy_route/body.js
+++ b/src/plugins/console/server/__tests__/proxy_route/body.test.ts
@@ -16,79 +16,83 @@
* specific language governing permissions and limitations
* under the License.
*/
+import { getProxyRouteHandlerDeps } from './mocks';
-import sinon from 'sinon';
import expect from '@kbn/expect';
-import { Server } from 'hapi';
+import { Readable } from 'stream';
+
+import { kibanaResponseFactory } from '../../../../../core/server';
+import { createHandler } from '../../routes/api/console/proxy/create_handler';
+import * as requestModule from '../../lib/proxy_request';
import { createResponseStub } from './stubs';
-import { createProxyRoute } from '../../';
-import * as requestModule from '../../request';
describe('Console Proxy Route', () => {
- const sandbox = sinon.createSandbox();
- const teardowns = [];
- let request;
+ let request: any;
beforeEach(() => {
- request = async (method, path, response) => {
- sandbox.stub(requestModule, 'sendRequest').callsFake(createResponseStub(response));
- const server = new Server();
- server.route(
- createProxyRoute({
- hosts: ['http://localhost:9200'],
- })
- );
+ request = (method: string, path: string, response: string) => {
+ (requestModule.proxyRequest as jest.Mock).mockResolvedValue(createResponseStub(response));
+ const handler = createHandler(getProxyRouteHandlerDeps({}));
- teardowns.push(() => server.stop());
-
- const params = [];
- if (path != null) params.push(`path=${path}`);
- if (method != null) params.push(`method=${method}`);
- return await server.inject({
- method: 'POST',
- url: `/api/console/proxy${params.length ? `?${params.join('&')}` : ''}`,
- });
+ return handler(
+ {} as any,
+ {
+ headers: {},
+ query: { method, path },
+ } as any,
+ kibanaResponseFactory
+ );
};
});
+ const readStream = (s: Readable) =>
+ new Promise(resolve => {
+ let v = '';
+ s.on('data', data => {
+ v += data;
+ });
+ s.on('end', () => resolve(v));
+ });
+
afterEach(async () => {
- sandbox.restore();
- await Promise.all(teardowns.splice(0).map(fn => fn()));
+ jest.resetAllMocks();
});
describe('response body', () => {
describe('GET request', () => {
it('returns the exact body', async () => {
const { payload } = await request('GET', '/', 'foobar');
- expect(payload).to.be('foobar');
+ expect(await readStream(payload)).to.be('foobar');
});
});
describe('POST request', () => {
it('returns the exact body', async () => {
const { payload } = await request('POST', '/', 'foobar');
- expect(payload).to.be('foobar');
+ expect(await readStream(payload)).to.be('foobar');
});
});
describe('PUT request', () => {
it('returns the exact body', async () => {
const { payload } = await request('PUT', '/', 'foobar');
- expect(payload).to.be('foobar');
+ expect(await readStream(payload)).to.be('foobar');
});
});
describe('DELETE request', () => {
it('returns the exact body', async () => {
const { payload } = await request('DELETE', '/', 'foobar');
- expect(payload).to.be('foobar');
+ expect(await readStream(payload)).to.be('foobar');
});
});
describe('HEAD request', () => {
it('returns the status code and text', async () => {
const { payload } = await request('HEAD', '/');
+ expect(typeof payload).to.be('string');
expect(payload).to.be('200 - OK');
});
describe('mixed casing', () => {
it('returns the status code and text', async () => {
const { payload } = await request('HeAd', '/');
+ expect(typeof payload).to.be('string');
expect(payload).to.be('200 - OK');
});
});
diff --git a/src/plugins/console/server/__tests__/proxy_route/headers.test.ts b/src/plugins/console/server/__tests__/proxy_route/headers.test.ts
new file mode 100644
index 0000000000000..8a779715ac823
--- /dev/null
+++ b/src/plugins/console/server/__tests__/proxy_route/headers.test.ts
@@ -0,0 +1,89 @@
+/*
+ * Licensed to Elasticsearch B.V. under one or more contributor
+ * license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright
+ * ownership. Elasticsearch B.V. licenses this file to you under
+ * the Apache License, Version 2.0 (the "License"); you may
+ * not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+jest.mock('../../../../../core/server/http/router/request', () => ({
+ ensureRawRequest: jest.fn(),
+}));
+
+import { kibanaResponseFactory } from '../../../../../core/server';
+
+// eslint-disable-next-line @kbn/eslint/no-restricted-paths
+import { ensureRawRequest } from '../../../../../core/server/http/router/request';
+
+import { getProxyRouteHandlerDeps } from './mocks';
+
+import expect from '@kbn/expect';
+import * as requestModule from '../../lib/proxy_request';
+
+import { createHandler } from '../../routes/api/console/proxy/create_handler';
+
+import { createResponseStub } from './stubs';
+
+describe('Console Proxy Route', () => {
+ let handler: ReturnType;
+
+ beforeEach(() => {
+ (requestModule.proxyRequest as jest.Mock).mockResolvedValue(createResponseStub(''));
+ handler = createHandler(getProxyRouteHandlerDeps({}));
+ });
+
+ afterEach(async () => {
+ jest.resetAllMocks();
+ });
+
+ describe('headers', () => {
+ it('forwards the remote header info', async () => {
+ (ensureRawRequest as jest.Mock).mockReturnValue({
+ // This mocks the shape of the hapi request object, will probably change
+ info: {
+ remoteAddress: '0.0.0.0',
+ remotePort: '1234',
+ host: 'test',
+ },
+ server: {
+ info: {
+ protocol: 'http',
+ },
+ },
+ });
+
+ await handler(
+ {} as any,
+ {
+ headers: {},
+ query: {
+ method: 'POST',
+ path: '/api/console/proxy?method=GET&path=/',
+ },
+ } as any,
+ kibanaResponseFactory
+ );
+
+ expect((requestModule.proxyRequest as jest.Mock).mock.calls.length).to.be(1);
+ const [[{ headers }]] = (requestModule.proxyRequest as jest.Mock).mock.calls;
+ expect(headers).to.have.property('x-forwarded-for');
+ expect(headers['x-forwarded-for']).to.be('0.0.0.0');
+ expect(headers).to.have.property('x-forwarded-port');
+ expect(headers['x-forwarded-port']).to.be('1234');
+ expect(headers).to.have.property('x-forwarded-proto');
+ expect(headers['x-forwarded-proto']).to.be('http');
+ expect(headers).to.have.property('x-forwarded-host');
+ expect(headers['x-forwarded-host']).to.be('test');
+ });
+ });
+});
diff --git a/src/legacy/core_plugins/vis_type_timeseries/server/lib/search_strategies/strategies/abstract_search_strategy.js b/src/plugins/console/server/__tests__/proxy_route/mocks.ts
similarity index 50%
rename from src/legacy/core_plugins/vis_type_timeseries/server/lib/search_strategies/strategies/abstract_search_strategy.js
rename to src/plugins/console/server/__tests__/proxy_route/mocks.ts
index 794e92a1954a9..74bd43fe52146 100644
--- a/src/legacy/core_plugins/vis_type_timeseries/server/lib/search_strategies/strategies/abstract_search_strategy.js
+++ b/src/plugins/console/server/__tests__/proxy_route/mocks.ts
@@ -17,26 +17,28 @@
* under the License.
*/
-export class AbstractSearchStrategy {
- constructor(server, callWithRequestFactory, SearchRequest) {
- this.getCallWithRequestInstance = req => callWithRequestFactory(server, req);
+jest.mock('../../lib/proxy_request', () => ({
+ proxyRequest: jest.fn(),
+}));
- this.getSearchRequest = req => {
- const callWithRequest = this.getCallWithRequestInstance(req);
+import { duration } from 'moment';
+import { ProxyConfigCollection } from '../../lib';
+import { CreateHandlerDependencies } from '../../routes/api/console/proxy/create_handler';
+import { coreMock } from '../../../../../core/server/mocks';
- return new SearchRequest(req, callWithRequest);
- };
- }
-
- async getFieldsForWildcard(req, indexPattern) {
- const { indexPatternsService } = req.pre;
-
- return await indexPatternsService.getFieldsForWildcard({
- pattern: indexPattern,
- });
- }
-
- checkForViability() {
- throw new TypeError('Must override method');
- }
-}
+export const getProxyRouteHandlerDeps = ({
+ proxyConfigCollection = new ProxyConfigCollection([]),
+ pathFilters = [/.*/],
+ readLegacyESConfig = () => ({
+ requestTimeout: duration(30000),
+ customHeaders: {},
+ requestHeadersWhitelist: [],
+ hosts: ['http://localhost:9200'],
+ }),
+ log = coreMock.createPluginInitializerContext().logger.get(),
+}: Partial): CreateHandlerDependencies => ({
+ proxyConfigCollection,
+ pathFilters,
+ readLegacyESConfig,
+ log,
+});
diff --git a/src/plugins/console/server/__tests__/proxy_route/params.test.ts b/src/plugins/console/server/__tests__/proxy_route/params.test.ts
new file mode 100644
index 0000000000000..1ab9c3ae789cc
--- /dev/null
+++ b/src/plugins/console/server/__tests__/proxy_route/params.test.ts
@@ -0,0 +1,87 @@
+/*
+ * Licensed to Elasticsearch B.V. under one or more contributor
+ * license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright
+ * ownership. Elasticsearch B.V. licenses this file to you under
+ * the Apache License, Version 2.0 (the "License"); you may
+ * not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+import { kibanaResponseFactory } from '../../../../../core/server';
+import { getProxyRouteHandlerDeps } from './mocks';
+import { createResponseStub } from './stubs';
+import * as requestModule from '../../lib/proxy_request';
+import expect from '@kbn/expect';
+
+import { createHandler } from '../../routes/api/console/proxy/create_handler';
+
+describe('Console Proxy Route', () => {
+ let handler: ReturnType;
+
+ afterEach(() => {
+ jest.resetAllMocks();
+ });
+
+ describe('params', () => {
+ describe('pathFilters', () => {
+ describe('no matches', () => {
+ it('rejects with 403', async () => {
+ handler = createHandler(
+ getProxyRouteHandlerDeps({ pathFilters: [/^\/foo\//, /^\/bar\//] })
+ );
+
+ const { status } = await handler(
+ {} as any,
+ { query: { method: 'POST', path: '/baz/id' } } as any,
+ kibanaResponseFactory
+ );
+
+ expect(status).to.be(403);
+ });
+ });
+ describe('one match', () => {
+ it('allows the request', async () => {
+ handler = createHandler(
+ getProxyRouteHandlerDeps({ pathFilters: [/^\/foo\//, /^\/bar\//] })
+ );
+
+ (requestModule.proxyRequest as jest.Mock).mockResolvedValue(createResponseStub('foo'));
+
+ const { status } = await handler(
+ {} as any,
+ { headers: {}, query: { method: 'POST', path: '/foo/id' } } as any,
+ kibanaResponseFactory
+ );
+
+ expect(status).to.be(200);
+ expect((requestModule.proxyRequest as jest.Mock).mock.calls.length).to.be(1);
+ });
+ });
+ describe('all match', () => {
+ it('allows the request', async () => {
+ handler = createHandler(getProxyRouteHandlerDeps({ pathFilters: [/^\/foo\//] }));
+
+ (requestModule.proxyRequest as jest.Mock).mockResolvedValue(createResponseStub('foo'));
+
+ const { status } = await handler(
+ {} as any,
+ { headers: {}, query: { method: 'GET', path: '/foo/id' } } as any,
+ kibanaResponseFactory
+ );
+
+ expect(status).to.be(200);
+ expect((requestModule.proxyRequest as jest.Mock).mock.calls.length).to.be(1);
+ });
+ });
+ });
+ });
+});
diff --git a/src/plugins/console/server/__tests__/proxy_route/query_string.test.ts b/src/plugins/console/server/__tests__/proxy_route/query_string.test.ts
new file mode 100644
index 0000000000000..028022db1096d
--- /dev/null
+++ b/src/plugins/console/server/__tests__/proxy_route/query_string.test.ts
@@ -0,0 +1,76 @@
+/*
+ * Licensed to Elasticsearch B.V. under one or more contributor
+ * license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright
+ * ownership. Elasticsearch B.V. licenses this file to you under
+ * the Apache License, Version 2.0 (the "License"); you may
+ * not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+import { kibanaResponseFactory } from '../../../../../core/server';
+import { getProxyRouteHandlerDeps } from './mocks';
+import { createResponseStub } from './stubs';
+import * as requestModule from '../../lib/proxy_request';
+
+import expect from '@kbn/expect';
+
+import { createHandler } from '../../routes/api/console/proxy/create_handler';
+
+describe('Console Proxy Route', () => {
+ let request: any;
+ beforeEach(() => {
+ (requestModule.proxyRequest as jest.Mock).mockResolvedValue(createResponseStub('foo'));
+
+ request = async (method: string, path: string) => {
+ const handler = createHandler(getProxyRouteHandlerDeps({}));
+
+ return handler(
+ {} as any,
+ { headers: {}, query: { method, path } } as any,
+ kibanaResponseFactory
+ );
+ };
+ });
+
+ afterEach(async () => {
+ jest.resetAllMocks();
+ });
+
+ describe('query string', () => {
+ describe('path', () => {
+ describe('contains full url', () => {
+ it('treats the url as a path', async () => {
+ await request('GET', 'http://evil.com/test');
+ expect((requestModule.proxyRequest as jest.Mock).mock.calls.length).to.be(1);
+ const [[args]] = (requestModule.proxyRequest as jest.Mock).mock.calls;
+ expect(args.uri.href).to.be('http://localhost:9200/http://evil.com/test?pretty=true');
+ });
+ });
+ describe('starts with a slash', () => {
+ it('combines well with the base url', async () => {
+ await request('GET', '/index/id');
+ expect((requestModule.proxyRequest as jest.Mock).mock.calls.length).to.be(1);
+ const [[args]] = (requestModule.proxyRequest as jest.Mock).mock.calls;
+ expect(args.uri.href).to.be('http://localhost:9200/index/id?pretty=true');
+ });
+ });
+ describe(`doesn't start with a slash`, () => {
+ it('combines well with the base url', async () => {
+ await request('GET', 'index/id');
+ expect((requestModule.proxyRequest as jest.Mock).mock.calls.length).to.be(1);
+ const [[args]] = (requestModule.proxyRequest as jest.Mock).mock.calls;
+ expect(args.uri.href).to.be('http://localhost:9200/index/id?pretty=true');
+ });
+ });
+ });
+ });
+});
diff --git a/src/plugins/console/server/__tests__/proxy_route/route_validation.test.ts b/src/plugins/console/server/__tests__/proxy_route/route_validation.test.ts
new file mode 100644
index 0000000000000..403ef9737ae42
--- /dev/null
+++ b/src/plugins/console/server/__tests__/proxy_route/route_validation.test.ts
@@ -0,0 +1,52 @@
+/*
+ * Licensed to Elasticsearch B.V. under one or more contributor
+ * license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright
+ * ownership. Elasticsearch B.V. licenses this file to you under
+ * the Apache License, Version 2.0 (the "License"); you may
+ * not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import { routeValidationConfig } from '../../routes/api/console/proxy/validation_config';
+
+const { query } = routeValidationConfig;
+
+describe('Proxy route validation', () => {
+ describe('query', () => {
+ describe('allows', () => {
+ it('known http verb method and path value', () => {
+ expect(query.validate({ method: 'GET', path: 'test' }));
+ });
+ it('mixed case http verbs', () => {
+ expect(query.validate({ method: 'hEaD', path: 'test' }));
+ });
+ });
+ describe('throws for', () => {
+ it('empty query method value', () => {
+ expect(() => {
+ query.validate({ method: '', path: 'test' });
+ }).toThrow('Method must be one of');
+ });
+ it('unknown method value', () => {
+ expect(() => {
+ query.validate({ method: 'abc', path: 'test' });
+ }).toThrow('Method must be one of');
+ });
+ it('empty path value', () => {
+ expect(() => {
+ query.validate({ method: 'GET', path: '' });
+ }).toThrow('Expected non-empty string');
+ });
+ });
+ });
+});
diff --git a/src/legacy/core_plugins/console/server/__tests__/proxy_route/stubs.js b/src/plugins/console/server/__tests__/proxy_route/stubs.ts
similarity index 65%
rename from src/legacy/core_plugins/console/server/__tests__/proxy_route/stubs.js
rename to src/plugins/console/server/__tests__/proxy_route/stubs.ts
index 18ad277c0bf6b..12ad9cbe26e9c 100644
--- a/src/legacy/core_plugins/console/server/__tests__/proxy_route/stubs.js
+++ b/src/plugins/console/server/__tests__/proxy_route/stubs.ts
@@ -16,27 +16,25 @@
* specific language governing permissions and limitations
* under the License.
*/
-
+import { IncomingMessage } from 'http';
import { Readable } from 'stream';
-export function createResponseStub(response) {
- return async () => {
- const resp = new Readable({
- read() {
- if (response) {
- this.push(response);
- }
- this.push(null);
- },
- });
-
- resp.statusCode = 200;
- resp.statusMessage = 'OK';
- resp.headers = {
- 'content-type': 'text/plain',
- 'content-length': String(response ? response.length : 0),
- };
+export function createResponseStub(response: any) {
+ const resp: any = new Readable({
+ read() {
+ if (response) {
+ this.push(response);
+ }
+ this.push(null);
+ },
+ });
- return resp;
+ resp.statusCode = 200;
+ resp.statusMessage = 'OK';
+ resp.headers = {
+ 'content-type': 'text/plain',
+ 'content-length': String(response ? response.length : 0),
};
+
+ return resp as IncomingMessage;
}
diff --git a/src/legacy/core_plugins/console/server/__tests__/set_headers.js b/src/plugins/console/server/__tests__/set_headers.js
similarity index 97%
rename from src/legacy/core_plugins/console/server/__tests__/set_headers.js
rename to src/plugins/console/server/__tests__/set_headers.js
index 3cab23a05884f..1f349cbbb571e 100644
--- a/src/legacy/core_plugins/console/server/__tests__/set_headers.js
+++ b/src/plugins/console/server/__tests__/set_headers.js
@@ -18,7 +18,7 @@
*/
import expect from '@kbn/expect';
-import { setHeaders } from '../set_headers';
+import { setHeaders } from '../lib';
describe('#set_headers', function() {
it('throws if not given an object as the first argument', function() {
diff --git a/src/legacy/core_plugins/console/server/__tests__/wildcard_matcher.js b/src/plugins/console/server/__tests__/wildcard_matcher.js
similarity index 98%
rename from src/legacy/core_plugins/console/server/__tests__/wildcard_matcher.js
rename to src/plugins/console/server/__tests__/wildcard_matcher.js
index ef0588973ab29..ccf68f3c16ca3 100644
--- a/src/legacy/core_plugins/console/server/__tests__/wildcard_matcher.js
+++ b/src/plugins/console/server/__tests__/wildcard_matcher.js
@@ -18,7 +18,7 @@
*/
/* eslint-env mocha */
-import { WildcardMatcher } from '../wildcard_matcher';
+import { WildcardMatcher } from '../lib/wildcard_matcher';
function should(candidate, ...constructorArgs) {
if (!new WildcardMatcher(...constructorArgs).match(candidate)) {
diff --git a/src/plugins/console/server/config.ts b/src/plugins/console/server/config.ts
new file mode 100644
index 0000000000000..ebd4b37bb41b2
--- /dev/null
+++ b/src/plugins/console/server/config.ts
@@ -0,0 +1,55 @@
+/*
+ * Licensed to Elasticsearch B.V. under one or more contributor
+ * license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright
+ * ownership. Elasticsearch B.V. licenses this file to you under
+ * the Apache License, Version 2.0 (the "License"); you may
+ * not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import { schema, TypeOf } from '@kbn/config-schema';
+
+export type ConfigType = TypeOf;
+
+export const config = schema.object(
+ {
+ enabled: schema.boolean({ defaultValue: true }),
+ proxyFilter: schema.arrayOf(schema.string(), { defaultValue: ['.*'] }),
+ ssl: schema.object({ verify: schema.boolean({ defaultValue: false }) }, {}),
+
+ // This does not actually work, track this issue: https://github.com/elastic/kibana/issues/55576
+ proxyConfig: schema.arrayOf(
+ schema.object({
+ match: schema.object({
+ protocol: schema.string({ defaultValue: '*' }),
+ host: schema.string({ defaultValue: '*' }),
+ port: schema.string({ defaultValue: '*' }),
+ path: schema.string({ defaultValue: '*' }),
+ }),
+
+ timeout: schema.number(),
+ ssl: schema.object(
+ {
+ verify: schema.boolean(),
+ ca: schema.arrayOf(schema.string()),
+ cert: schema.string(),
+ key: schema.string(),
+ },
+ { defaultValue: undefined }
+ ),
+ }),
+ { defaultValue: [] }
+ ),
+ },
+ { defaultValue: undefined }
+);
diff --git a/src/legacy/core_plugins/vis_type_timeseries/server/lib/get_index_pattern_service.js b/src/plugins/console/server/index.ts
similarity index 63%
rename from src/legacy/core_plugins/vis_type_timeseries/server/lib/get_index_pattern_service.js
rename to src/plugins/console/server/index.ts
index 54e90ab7dd9b7..b603deee12e23 100644
--- a/src/legacy/core_plugins/vis_type_timeseries/server/lib/get_index_pattern_service.js
+++ b/src/plugins/console/server/index.ts
@@ -16,15 +16,16 @@
* specific language governing permissions and limitations
* under the License.
*/
+import { PluginConfigDescriptor, PluginInitializerContext } from 'kibana/server';
-import { IndexPatternsFetcher } from '../../../../../plugins/data/server/';
-export const getIndexPatternService = {
- assign: 'indexPatternsService',
- method(req) {
- const dataCluster = req.server.plugins.elasticsearch.getCluster('data');
- const callDataCluster = (...args) => {
- return dataCluster.callWithRequest(req, ...args);
- };
- return new IndexPatternsFetcher(callDataCluster);
- },
+import { ConfigType, config as configSchema } from './config';
+import { ConsoleServerPlugin } from './plugin';
+
+export { ConsoleSetup } from './types';
+
+export const plugin = (ctx: PluginInitializerContext) => new ConsoleServerPlugin(ctx);
+
+export const config: PluginConfigDescriptor = {
+ deprecations: ({ unused }) => [unused('ssl')],
+ schema: configSchema,
};
diff --git a/src/legacy/core_plugins/console/server/elasticsearch_proxy_config.ts b/src/plugins/console/server/lib/elasticsearch_proxy_config.ts
similarity index 94%
rename from src/legacy/core_plugins/console/server/elasticsearch_proxy_config.ts
rename to src/plugins/console/server/lib/elasticsearch_proxy_config.ts
index 5f44a524e9cc8..901d726ac51d8 100644
--- a/src/legacy/core_plugins/console/server/elasticsearch_proxy_config.ts
+++ b/src/plugins/console/server/lib/elasticsearch_proxy_config.ts
@@ -21,6 +21,7 @@ import _ from 'lodash';
import http from 'http';
import https from 'https';
import url from 'url';
+import { Duration } from 'moment';
const createAgent = (legacyConfig: any) => {
const target = url.parse(_.head(legacyConfig.hosts));
@@ -58,7 +59,7 @@ const createAgent = (legacyConfig: any) => {
return new https.Agent(agentOptions);
};
-export const getElasticsearchProxyConfig = (legacyConfig: any) => {
+export const getElasticsearchProxyConfig = (legacyConfig: { requestTimeout: Duration }) => {
return {
timeout: legacyConfig.requestTimeout.asMilliseconds(),
agent: createAgent(legacyConfig),
diff --git a/src/legacy/core_plugins/console/server/index.js b/src/plugins/console/server/lib/index.ts
similarity index 80%
rename from src/legacy/core_plugins/console/server/index.js
rename to src/plugins/console/server/lib/index.ts
index 15a8a5baf79dc..98004768f880b 100644
--- a/src/legacy/core_plugins/console/server/index.js
+++ b/src/plugins/console/server/lib/index.ts
@@ -17,6 +17,9 @@
* under the License.
*/
+export { ProxyConfig } from './proxy_config';
export { ProxyConfigCollection } from './proxy_config_collection';
+export { proxyRequest } from './proxy_request';
export { getElasticsearchProxyConfig } from './elasticsearch_proxy_config';
-export { createProxyRoute } from './proxy_route';
+export { setHeaders } from './set_headers';
+export { addProcessorDefinition, addExtensionSpecFilePath } from './spec_definitions';
diff --git a/src/legacy/core_plugins/console/server/proxy_config.js b/src/plugins/console/server/lib/proxy_config.ts
similarity index 80%
rename from src/legacy/core_plugins/console/server/proxy_config.js
rename to src/plugins/console/server/lib/proxy_config.ts
index b8c1b11f9a0d3..5adb9c58f784e 100644
--- a/src/legacy/core_plugins/console/server/proxy_config.js
+++ b/src/plugins/console/server/lib/proxy_config.ts
@@ -19,12 +19,27 @@
import { values } from 'lodash';
import { format as formatUrl } from 'url';
-import { Agent as HttpsAgent } from 'https';
+import { Agent as HttpsAgent, AgentOptions } from 'https';
import { WildcardMatcher } from './wildcard_matcher';
export class ProxyConfig {
- constructor(config) {
+ // @ts-ignore
+ private id: string;
+ private matchers: {
+ protocol: WildcardMatcher;
+ host: WildcardMatcher;
+ port: WildcardMatcher;
+ path: WildcardMatcher;
+ };
+
+ private readonly timeout: number;
+
+ private readonly sslAgent?: HttpsAgent;
+
+ private verifySsl: any;
+
+ constructor(config: { match: any; timeout: number }) {
config = {
...config,
};
@@ -57,11 +72,11 @@ export class ProxyConfig {
this.sslAgent = this._makeSslAgent(config);
}
- _makeSslAgent(config) {
+ _makeSslAgent(config: any) {
const ssl = config.ssl || {};
this.verifySsl = ssl.verify;
- const sslAgentOpts = {
+ const sslAgentOpts: AgentOptions = {
ca: ssl.ca,
cert: ssl.cert,
key: ssl.key,
@@ -73,7 +88,12 @@ export class ProxyConfig {
}
}
- getForParsedUri({ protocol, hostname, port, pathname }) {
+ getForParsedUri({
+ protocol,
+ hostname,
+ port,
+ pathname,
+ }: Record<'protocol' | 'hostname' | 'port' | 'pathname', string>) {
let match = this.matchers.protocol.match(protocol.slice(0, -1));
match = match && this.matchers.host.match(hostname);
match = match && this.matchers.port.match(port);
diff --git a/src/legacy/core_plugins/console/server/proxy_config_collection.js b/src/plugins/console/server/lib/proxy_config_collection.ts
similarity index 83%
rename from src/legacy/core_plugins/console/server/proxy_config_collection.js
rename to src/plugins/console/server/lib/proxy_config_collection.ts
index 79bc057aaaf7f..5d0b02fed5b18 100644
--- a/src/legacy/core_plugins/console/server/proxy_config_collection.js
+++ b/src/plugins/console/server/lib/proxy_config_collection.ts
@@ -18,18 +18,24 @@
*/
import { defaultsDeep } from 'lodash';
+import { parse as parseUrl } from 'url';
import { ProxyConfig } from './proxy_config';
-import { parse as parseUrl } from 'url';
export class ProxyConfigCollection {
- constructor(configs = []) {
+ private configs: ProxyConfig[];
+
+ constructor(configs: Array<{ match: any; timeout: number }> = []) {
this.configs = configs.map(settings => new ProxyConfig(settings));
}
- configForUri(uri) {
+ hasConfig() {
+ return Boolean(this.configs.length);
+ }
+
+ configForUri(uri: string): object {
const parsedUri = parseUrl(uri);
- const settings = this.configs.map(config => config.getForParsedUri(parsedUri));
+ const settings = this.configs.map(config => config.getForParsedUri(parsedUri as any));
return defaultsDeep({}, ...settings);
}
}
diff --git a/src/legacy/core_plugins/console/server/request.test.ts b/src/plugins/console/server/lib/proxy_request.test.ts
similarity index 96%
rename from src/legacy/core_plugins/console/server/request.test.ts
rename to src/plugins/console/server/lib/proxy_request.test.ts
index 2cbde5b3b39b8..0285daef7d725 100644
--- a/src/legacy/core_plugins/console/server/request.test.ts
+++ b/src/plugins/console/server/lib/proxy_request.test.ts
@@ -18,7 +18,7 @@
*/
import http, { ClientRequest } from 'http';
import * as sinon from 'sinon';
-import { sendRequest } from './request';
+import { proxyRequest } from './proxy_request';
import { URL } from 'url';
import { fail } from 'assert';
@@ -46,7 +46,7 @@ describe(`Console's send request`, () => {
it('correctly implements timeout and abort mechanism', async () => {
try {
- await sendRequest({
+ await proxyRequest({
agent: null as any,
headers: {},
method: 'get',
diff --git a/src/legacy/core_plugins/console/server/request.ts b/src/plugins/console/server/lib/proxy_request.ts
similarity index 99%
rename from src/legacy/core_plugins/console/server/request.ts
rename to src/plugins/console/server/lib/proxy_request.ts
index 0f6b78b484adf..ed02b23d77f6a 100644
--- a/src/legacy/core_plugins/console/server/request.ts
+++ b/src/plugins/console/server/lib/proxy_request.ts
@@ -37,7 +37,7 @@ interface Args {
// We use a modified version of Hapi's Wreck because Hapi, Axios, and Superagent don't support GET requests
// with bodies, but ES APIs do. Similarly with DELETE requests with bodies. Another library, `request`
// diverged too much from current behaviour.
-export const sendRequest = ({
+export const proxyRequest = ({
method,
headers,
agent,
diff --git a/src/legacy/core_plugins/console/server/set_headers.js b/src/plugins/console/server/lib/set_headers.ts
similarity index 94%
rename from src/legacy/core_plugins/console/server/set_headers.js
rename to src/plugins/console/server/lib/set_headers.ts
index 5ea4c214dc42e..ee0be40312a4d 100644
--- a/src/legacy/core_plugins/console/server/set_headers.js
+++ b/src/plugins/console/server/lib/set_headers.ts
@@ -19,7 +19,7 @@
import { isPlainObject } from 'lodash';
-export function setHeaders(originalHeaders, newHeaders) {
+export function setHeaders(originalHeaders: object, newHeaders: object) {
if (!isPlainObject(originalHeaders)) {
throw new Error(
`Expected originalHeaders to be an object, but ${typeof originalHeaders} given`
diff --git a/src/legacy/core_plugins/console/server/api_server/api.js b/src/plugins/console/server/lib/spec_definitions/api.js
similarity index 100%
rename from src/legacy/core_plugins/console/server/api_server/api.js
rename to src/plugins/console/server/lib/spec_definitions/api.js
diff --git a/src/legacy/core_plugins/console/server/api_server/es_6_0.js b/src/plugins/console/server/lib/spec_definitions/es_6_0.js
similarity index 100%
rename from src/legacy/core_plugins/console/server/api_server/es_6_0.js
rename to src/plugins/console/server/lib/spec_definitions/es_6_0.js
diff --git a/src/legacy/core_plugins/console/server/api_server/es_6_0/aggregations.js b/src/plugins/console/server/lib/spec_definitions/es_6_0/aggregations.js
similarity index 100%
rename from src/legacy/core_plugins/console/server/api_server/es_6_0/aggregations.js
rename to src/plugins/console/server/lib/spec_definitions/es_6_0/aggregations.js
diff --git a/src/legacy/core_plugins/console/server/api_server/es_6_0/aliases.js b/src/plugins/console/server/lib/spec_definitions/es_6_0/aliases.js
similarity index 100%
rename from src/legacy/core_plugins/console/server/api_server/es_6_0/aliases.js
rename to src/plugins/console/server/lib/spec_definitions/es_6_0/aliases.js
diff --git a/src/legacy/core_plugins/console/server/api_server/es_6_0/document.js b/src/plugins/console/server/lib/spec_definitions/es_6_0/document.js
similarity index 100%
rename from src/legacy/core_plugins/console/server/api_server/es_6_0/document.js
rename to src/plugins/console/server/lib/spec_definitions/es_6_0/document.js
diff --git a/src/legacy/core_plugins/console/server/api_server/es_6_0/filter.js b/src/plugins/console/server/lib/spec_definitions/es_6_0/filter.js
similarity index 100%
rename from src/legacy/core_plugins/console/server/api_server/es_6_0/filter.js
rename to src/plugins/console/server/lib/spec_definitions/es_6_0/filter.js
diff --git a/src/legacy/core_plugins/console/server/api_server/es_6_0/globals.js b/src/plugins/console/server/lib/spec_definitions/es_6_0/globals.js
similarity index 100%
rename from src/legacy/core_plugins/console/server/api_server/es_6_0/globals.js
rename to src/plugins/console/server/lib/spec_definitions/es_6_0/globals.js
diff --git a/src/legacy/core_plugins/console/server/api_server/es_6_0/ingest.js b/src/plugins/console/server/lib/spec_definitions/es_6_0/ingest.js
similarity index 100%
rename from src/legacy/core_plugins/console/server/api_server/es_6_0/ingest.js
rename to src/plugins/console/server/lib/spec_definitions/es_6_0/ingest.js
diff --git a/src/legacy/core_plugins/console/server/api_server/es_6_0/mappings.js b/src/plugins/console/server/lib/spec_definitions/es_6_0/mappings.js
similarity index 100%
rename from src/legacy/core_plugins/console/server/api_server/es_6_0/mappings.js
rename to src/plugins/console/server/lib/spec_definitions/es_6_0/mappings.js
diff --git a/src/legacy/core_plugins/console/server/api_server/es_6_0/query/dsl.js b/src/plugins/console/server/lib/spec_definitions/es_6_0/query/dsl.js
similarity index 100%
rename from src/legacy/core_plugins/console/server/api_server/es_6_0/query/dsl.js
rename to src/plugins/console/server/lib/spec_definitions/es_6_0/query/dsl.js
diff --git a/src/legacy/core_plugins/console/server/api_server/es_6_0/query/index.js b/src/plugins/console/server/lib/spec_definitions/es_6_0/query/index.js
similarity index 100%
rename from src/legacy/core_plugins/console/server/api_server/es_6_0/query/index.js
rename to src/plugins/console/server/lib/spec_definitions/es_6_0/query/index.js
diff --git a/src/legacy/core_plugins/console/server/api_server/es_6_0/query/templates.js b/src/plugins/console/server/lib/spec_definitions/es_6_0/query/templates.js
similarity index 100%
rename from src/legacy/core_plugins/console/server/api_server/es_6_0/query/templates.js
rename to src/plugins/console/server/lib/spec_definitions/es_6_0/query/templates.js
diff --git a/src/legacy/core_plugins/console/server/api_server/es_6_0/reindex.js b/src/plugins/console/server/lib/spec_definitions/es_6_0/reindex.js
similarity index 100%
rename from src/legacy/core_plugins/console/server/api_server/es_6_0/reindex.js
rename to src/plugins/console/server/lib/spec_definitions/es_6_0/reindex.js
diff --git a/src/legacy/core_plugins/console/server/api_server/es_6_0/search.js b/src/plugins/console/server/lib/spec_definitions/es_6_0/search.js
similarity index 100%
rename from src/legacy/core_plugins/console/server/api_server/es_6_0/search.js
rename to src/plugins/console/server/lib/spec_definitions/es_6_0/search.js
diff --git a/src/plugins/console/server/lib/spec_definitions/index.d.ts b/src/plugins/console/server/lib/spec_definitions/index.d.ts
new file mode 100644
index 0000000000000..0a79d3fb386f1
--- /dev/null
+++ b/src/plugins/console/server/lib/spec_definitions/index.d.ts
@@ -0,0 +1,24 @@
+/*
+ * Licensed to Elasticsearch B.V. under one or more contributor
+ * license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright
+ * ownership. Elasticsearch B.V. licenses this file to you under
+ * the Apache License, Version 2.0 (the "License"); you may
+ * not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+export declare function addProcessorDefinition(...args: any[]): any;
+
+export declare function resolveApi(senseVersion: string, apis: string[]): object;
+
+export declare function addExtensionSpecFilePath(...args: any[]): any;
diff --git a/src/plugins/console/server/lib/spec_definitions/index.js b/src/plugins/console/server/lib/spec_definitions/index.js
new file mode 100644
index 0000000000000..3fe1913d5a193
--- /dev/null
+++ b/src/plugins/console/server/lib/spec_definitions/index.js
@@ -0,0 +1,24 @@
+/*
+ * Licensed to Elasticsearch B.V. under one or more contributor
+ * license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright
+ * ownership. Elasticsearch B.V. licenses this file to you under
+ * the Apache License, Version 2.0 (the "License"); you may
+ * not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+export { addProcessorDefinition } from './es_6_0/ingest';
+
+export { addExtensionSpecFilePath } from './spec';
+
+export { resolveApi } from './server';
diff --git a/src/legacy/core_plugins/console/server/api_server/server.js b/src/plugins/console/server/lib/spec_definitions/server.js
similarity index 91%
rename from src/legacy/core_plugins/console/server/api_server/server.js
rename to src/plugins/console/server/lib/spec_definitions/server.js
index 48ed73cb3611d..dd700bf019507 100644
--- a/src/legacy/core_plugins/console/server/api_server/server.js
+++ b/src/plugins/console/server/lib/spec_definitions/server.js
@@ -21,7 +21,7 @@ import _ from 'lodash';
const KNOWN_APIS = ['es_6_0'];
-export function resolveApi(senseVersion, apis, h) {
+export function resolveApi(senseVersion, apis) {
const result = {};
_.each(apis, function(name) {
{
@@ -33,5 +33,5 @@ export function resolveApi(senseVersion, apis, h) {
}
});
- return h.response(result).type('application/json');
+ return result;
}
diff --git a/src/legacy/core_plugins/console/server/api_server/server.test.js b/src/plugins/console/server/lib/spec_definitions/server.test.js
similarity index 100%
rename from src/legacy/core_plugins/console/server/api_server/server.test.js
rename to src/plugins/console/server/lib/spec_definitions/server.test.js
diff --git a/src/legacy/core_plugins/console/server/api_server/spec/.eslintrc b/src/plugins/console/server/lib/spec_definitions/spec/.eslintrc
similarity index 100%
rename from src/legacy/core_plugins/console/server/api_server/spec/.eslintrc
rename to src/plugins/console/server/lib/spec_definitions/spec/.eslintrc
diff --git a/src/legacy/core_plugins/console/server/api_server/spec/generated/_common.json b/src/plugins/console/server/lib/spec_definitions/spec/generated/_common.json
similarity index 100%
rename from src/legacy/core_plugins/console/server/api_server/spec/generated/_common.json
rename to src/plugins/console/server/lib/spec_definitions/spec/generated/_common.json
diff --git a/src/legacy/core_plugins/console/server/api_server/spec/generated/bulk.json b/src/plugins/console/server/lib/spec_definitions/spec/generated/bulk.json
similarity index 100%
rename from src/legacy/core_plugins/console/server/api_server/spec/generated/bulk.json
rename to src/plugins/console/server/lib/spec_definitions/spec/generated/bulk.json
diff --git a/src/legacy/core_plugins/console/server/api_server/spec/generated/cat.aliases.json b/src/plugins/console/server/lib/spec_definitions/spec/generated/cat.aliases.json
similarity index 100%
rename from src/legacy/core_plugins/console/server/api_server/spec/generated/cat.aliases.json
rename to src/plugins/console/server/lib/spec_definitions/spec/generated/cat.aliases.json
diff --git a/src/legacy/core_plugins/console/server/api_server/spec/generated/cat.allocation.json b/src/plugins/console/server/lib/spec_definitions/spec/generated/cat.allocation.json
similarity index 100%
rename from src/legacy/core_plugins/console/server/api_server/spec/generated/cat.allocation.json
rename to src/plugins/console/server/lib/spec_definitions/spec/generated/cat.allocation.json
diff --git a/src/legacy/core_plugins/console/server/api_server/spec/generated/cat.count.json b/src/plugins/console/server/lib/spec_definitions/spec/generated/cat.count.json
similarity index 100%
rename from src/legacy/core_plugins/console/server/api_server/spec/generated/cat.count.json
rename to src/plugins/console/server/lib/spec_definitions/spec/generated/cat.count.json
diff --git a/src/legacy/core_plugins/console/server/api_server/spec/generated/cat.fielddata.json b/src/plugins/console/server/lib/spec_definitions/spec/generated/cat.fielddata.json
similarity index 100%
rename from src/legacy/core_plugins/console/server/api_server/spec/generated/cat.fielddata.json
rename to src/plugins/console/server/lib/spec_definitions/spec/generated/cat.fielddata.json
diff --git a/src/legacy/core_plugins/console/server/api_server/spec/generated/cat.health.json b/src/plugins/console/server/lib/spec_definitions/spec/generated/cat.health.json
similarity index 100%
rename from src/legacy/core_plugins/console/server/api_server/spec/generated/cat.health.json
rename to src/plugins/console/server/lib/spec_definitions/spec/generated/cat.health.json
diff --git a/src/legacy/core_plugins/console/server/api_server/spec/generated/cat.help.json b/src/plugins/console/server/lib/spec_definitions/spec/generated/cat.help.json
similarity index 100%
rename from src/legacy/core_plugins/console/server/api_server/spec/generated/cat.help.json
rename to src/plugins/console/server/lib/spec_definitions/spec/generated/cat.help.json
diff --git a/src/legacy/core_plugins/console/server/api_server/spec/generated/cat.indices.json b/src/plugins/console/server/lib/spec_definitions/spec/generated/cat.indices.json
similarity index 100%
rename from src/legacy/core_plugins/console/server/api_server/spec/generated/cat.indices.json
rename to src/plugins/console/server/lib/spec_definitions/spec/generated/cat.indices.json
diff --git a/src/legacy/core_plugins/console/server/api_server/spec/generated/cat.master.json b/src/plugins/console/server/lib/spec_definitions/spec/generated/cat.master.json
similarity index 100%
rename from src/legacy/core_plugins/console/server/api_server/spec/generated/cat.master.json
rename to src/plugins/console/server/lib/spec_definitions/spec/generated/cat.master.json
diff --git a/src/legacy/core_plugins/console/server/api_server/spec/generated/cat.nodeattrs.json b/src/plugins/console/server/lib/spec_definitions/spec/generated/cat.nodeattrs.json
similarity index 100%
rename from src/legacy/core_plugins/console/server/api_server/spec/generated/cat.nodeattrs.json
rename to src/plugins/console/server/lib/spec_definitions/spec/generated/cat.nodeattrs.json
diff --git a/src/legacy/core_plugins/console/server/api_server/spec/generated/cat.nodes.json b/src/plugins/console/server/lib/spec_definitions/spec/generated/cat.nodes.json
similarity index 100%
rename from src/legacy/core_plugins/console/server/api_server/spec/generated/cat.nodes.json
rename to src/plugins/console/server/lib/spec_definitions/spec/generated/cat.nodes.json
diff --git a/src/legacy/core_plugins/console/server/api_server/spec/generated/cat.pending_tasks.json b/src/plugins/console/server/lib/spec_definitions/spec/generated/cat.pending_tasks.json
similarity index 100%
rename from src/legacy/core_plugins/console/server/api_server/spec/generated/cat.pending_tasks.json
rename to src/plugins/console/server/lib/spec_definitions/spec/generated/cat.pending_tasks.json
diff --git a/src/legacy/core_plugins/console/server/api_server/spec/generated/cat.plugins.json b/src/plugins/console/server/lib/spec_definitions/spec/generated/cat.plugins.json
similarity index 100%
rename from src/legacy/core_plugins/console/server/api_server/spec/generated/cat.plugins.json
rename to src/plugins/console/server/lib/spec_definitions/spec/generated/cat.plugins.json
diff --git a/src/legacy/core_plugins/console/server/api_server/spec/generated/cat.recovery.json b/src/plugins/console/server/lib/spec_definitions/spec/generated/cat.recovery.json
similarity index 100%
rename from src/legacy/core_plugins/console/server/api_server/spec/generated/cat.recovery.json
rename to src/plugins/console/server/lib/spec_definitions/spec/generated/cat.recovery.json
diff --git a/src/legacy/core_plugins/console/server/api_server/spec/generated/cat.repositories.json b/src/plugins/console/server/lib/spec_definitions/spec/generated/cat.repositories.json
similarity index 100%
rename from src/legacy/core_plugins/console/server/api_server/spec/generated/cat.repositories.json
rename to src/plugins/console/server/lib/spec_definitions/spec/generated/cat.repositories.json
diff --git a/src/legacy/core_plugins/console/server/api_server/spec/generated/cat.segments.json b/src/plugins/console/server/lib/spec_definitions/spec/generated/cat.segments.json
similarity index 100%
rename from src/legacy/core_plugins/console/server/api_server/spec/generated/cat.segments.json
rename to src/plugins/console/server/lib/spec_definitions/spec/generated/cat.segments.json
diff --git a/src/legacy/core_plugins/console/server/api_server/spec/generated/cat.shards.json b/src/plugins/console/server/lib/spec_definitions/spec/generated/cat.shards.json
similarity index 100%
rename from src/legacy/core_plugins/console/server/api_server/spec/generated/cat.shards.json
rename to src/plugins/console/server/lib/spec_definitions/spec/generated/cat.shards.json
diff --git a/src/legacy/core_plugins/console/server/api_server/spec/generated/cat.snapshots.json b/src/plugins/console/server/lib/spec_definitions/spec/generated/cat.snapshots.json
similarity index 100%
rename from src/legacy/core_plugins/console/server/api_server/spec/generated/cat.snapshots.json
rename to src/plugins/console/server/lib/spec_definitions/spec/generated/cat.snapshots.json
diff --git a/src/legacy/core_plugins/console/server/api_server/spec/generated/cat.tasks.json b/src/plugins/console/server/lib/spec_definitions/spec/generated/cat.tasks.json
similarity index 100%
rename from src/legacy/core_plugins/console/server/api_server/spec/generated/cat.tasks.json
rename to src/plugins/console/server/lib/spec_definitions/spec/generated/cat.tasks.json
diff --git a/src/legacy/core_plugins/console/server/api_server/spec/generated/cat.templates.json b/src/plugins/console/server/lib/spec_definitions/spec/generated/cat.templates.json
similarity index 100%
rename from src/legacy/core_plugins/console/server/api_server/spec/generated/cat.templates.json
rename to src/plugins/console/server/lib/spec_definitions/spec/generated/cat.templates.json
diff --git a/src/legacy/core_plugins/console/server/api_server/spec/generated/cat.thread_pool.json b/src/plugins/console/server/lib/spec_definitions/spec/generated/cat.thread_pool.json
similarity index 100%
rename from src/legacy/core_plugins/console/server/api_server/spec/generated/cat.thread_pool.json
rename to src/plugins/console/server/lib/spec_definitions/spec/generated/cat.thread_pool.json
diff --git a/src/legacy/core_plugins/console/server/api_server/spec/generated/clear_scroll.json b/src/plugins/console/server/lib/spec_definitions/spec/generated/clear_scroll.json
similarity index 100%
rename from src/legacy/core_plugins/console/server/api_server/spec/generated/clear_scroll.json
rename to src/plugins/console/server/lib/spec_definitions/spec/generated/clear_scroll.json
diff --git a/src/legacy/core_plugins/console/server/api_server/spec/generated/cluster.allocation_explain.json b/src/plugins/console/server/lib/spec_definitions/spec/generated/cluster.allocation_explain.json
similarity index 100%
rename from src/legacy/core_plugins/console/server/api_server/spec/generated/cluster.allocation_explain.json
rename to src/plugins/console/server/lib/spec_definitions/spec/generated/cluster.allocation_explain.json
diff --git a/src/legacy/core_plugins/console/server/api_server/spec/generated/cluster.get_settings.json b/src/plugins/console/server/lib/spec_definitions/spec/generated/cluster.get_settings.json
similarity index 100%
rename from src/legacy/core_plugins/console/server/api_server/spec/generated/cluster.get_settings.json
rename to src/plugins/console/server/lib/spec_definitions/spec/generated/cluster.get_settings.json
diff --git a/src/legacy/core_plugins/console/server/api_server/spec/generated/cluster.health.json b/src/plugins/console/server/lib/spec_definitions/spec/generated/cluster.health.json
similarity index 100%
rename from src/legacy/core_plugins/console/server/api_server/spec/generated/cluster.health.json
rename to src/plugins/console/server/lib/spec_definitions/spec/generated/cluster.health.json
diff --git a/src/legacy/core_plugins/console/server/api_server/spec/generated/cluster.pending_tasks.json b/src/plugins/console/server/lib/spec_definitions/spec/generated/cluster.pending_tasks.json
similarity index 100%
rename from src/legacy/core_plugins/console/server/api_server/spec/generated/cluster.pending_tasks.json
rename to src/plugins/console/server/lib/spec_definitions/spec/generated/cluster.pending_tasks.json
diff --git a/src/legacy/core_plugins/console/server/api_server/spec/generated/cluster.put_settings.json b/src/plugins/console/server/lib/spec_definitions/spec/generated/cluster.put_settings.json
similarity index 100%
rename from src/legacy/core_plugins/console/server/api_server/spec/generated/cluster.put_settings.json
rename to src/plugins/console/server/lib/spec_definitions/spec/generated/cluster.put_settings.json
diff --git a/src/legacy/core_plugins/console/server/api_server/spec/generated/cluster.remote_info.json b/src/plugins/console/server/lib/spec_definitions/spec/generated/cluster.remote_info.json
similarity index 100%
rename from src/legacy/core_plugins/console/server/api_server/spec/generated/cluster.remote_info.json
rename to src/plugins/console/server/lib/spec_definitions/spec/generated/cluster.remote_info.json
diff --git a/src/legacy/core_plugins/console/server/api_server/spec/generated/cluster.reroute.json b/src/plugins/console/server/lib/spec_definitions/spec/generated/cluster.reroute.json
similarity index 100%
rename from src/legacy/core_plugins/console/server/api_server/spec/generated/cluster.reroute.json
rename to src/plugins/console/server/lib/spec_definitions/spec/generated/cluster.reroute.json
diff --git a/src/legacy/core_plugins/console/server/api_server/spec/generated/cluster.state.json b/src/plugins/console/server/lib/spec_definitions/spec/generated/cluster.state.json
similarity index 100%
rename from src/legacy/core_plugins/console/server/api_server/spec/generated/cluster.state.json
rename to src/plugins/console/server/lib/spec_definitions/spec/generated/cluster.state.json
diff --git a/src/legacy/core_plugins/console/server/api_server/spec/generated/cluster.stats.json b/src/plugins/console/server/lib/spec_definitions/spec/generated/cluster.stats.json
similarity index 100%
rename from src/legacy/core_plugins/console/server/api_server/spec/generated/cluster.stats.json
rename to src/plugins/console/server/lib/spec_definitions/spec/generated/cluster.stats.json
diff --git a/src/legacy/core_plugins/console/server/api_server/spec/generated/count.json b/src/plugins/console/server/lib/spec_definitions/spec/generated/count.json
similarity index 100%
rename from src/legacy/core_plugins/console/server/api_server/spec/generated/count.json
rename to src/plugins/console/server/lib/spec_definitions/spec/generated/count.json
diff --git a/src/legacy/core_plugins/console/server/api_server/spec/generated/create.json b/src/plugins/console/server/lib/spec_definitions/spec/generated/create.json
similarity index 100%
rename from src/legacy/core_plugins/console/server/api_server/spec/generated/create.json
rename to src/plugins/console/server/lib/spec_definitions/spec/generated/create.json
diff --git a/src/legacy/core_plugins/console/server/api_server/spec/generated/delete.json b/src/plugins/console/server/lib/spec_definitions/spec/generated/delete.json
similarity index 100%
rename from src/legacy/core_plugins/console/server/api_server/spec/generated/delete.json
rename to src/plugins/console/server/lib/spec_definitions/spec/generated/delete.json
diff --git a/src/legacy/core_plugins/console/server/api_server/spec/generated/delete_by_query.json b/src/plugins/console/server/lib/spec_definitions/spec/generated/delete_by_query.json
similarity index 100%
rename from src/legacy/core_plugins/console/server/api_server/spec/generated/delete_by_query.json
rename to src/plugins/console/server/lib/spec_definitions/spec/generated/delete_by_query.json
diff --git a/src/legacy/core_plugins/console/server/api_server/spec/generated/delete_by_query_rethrottle.json b/src/plugins/console/server/lib/spec_definitions/spec/generated/delete_by_query_rethrottle.json
similarity index 100%
rename from src/legacy/core_plugins/console/server/api_server/spec/generated/delete_by_query_rethrottle.json
rename to src/plugins/console/server/lib/spec_definitions/spec/generated/delete_by_query_rethrottle.json
diff --git a/src/legacy/core_plugins/console/server/api_server/spec/generated/delete_script.json b/src/plugins/console/server/lib/spec_definitions/spec/generated/delete_script.json
similarity index 100%
rename from src/legacy/core_plugins/console/server/api_server/spec/generated/delete_script.json
rename to src/plugins/console/server/lib/spec_definitions/spec/generated/delete_script.json
diff --git a/src/legacy/core_plugins/console/server/api_server/spec/generated/exists.json b/src/plugins/console/server/lib/spec_definitions/spec/generated/exists.json
similarity index 100%
rename from src/legacy/core_plugins/console/server/api_server/spec/generated/exists.json
rename to src/plugins/console/server/lib/spec_definitions/spec/generated/exists.json
diff --git a/src/legacy/core_plugins/console/server/api_server/spec/generated/exists_source.json b/src/plugins/console/server/lib/spec_definitions/spec/generated/exists_source.json
similarity index 100%
rename from src/legacy/core_plugins/console/server/api_server/spec/generated/exists_source.json
rename to src/plugins/console/server/lib/spec_definitions/spec/generated/exists_source.json
diff --git a/src/legacy/core_plugins/console/server/api_server/spec/generated/explain.json b/src/plugins/console/server/lib/spec_definitions/spec/generated/explain.json
similarity index 100%
rename from src/legacy/core_plugins/console/server/api_server/spec/generated/explain.json
rename to src/plugins/console/server/lib/spec_definitions/spec/generated/explain.json
diff --git a/src/legacy/core_plugins/console/server/api_server/spec/generated/field_caps.json b/src/plugins/console/server/lib/spec_definitions/spec/generated/field_caps.json
similarity index 100%
rename from src/legacy/core_plugins/console/server/api_server/spec/generated/field_caps.json
rename to src/plugins/console/server/lib/spec_definitions/spec/generated/field_caps.json
diff --git a/src/legacy/core_plugins/console/server/api_server/spec/generated/get.json b/src/plugins/console/server/lib/spec_definitions/spec/generated/get.json
similarity index 100%
rename from src/legacy/core_plugins/console/server/api_server/spec/generated/get.json
rename to src/plugins/console/server/lib/spec_definitions/spec/generated/get.json
diff --git a/src/legacy/core_plugins/console/server/api_server/spec/generated/get_script.json b/src/plugins/console/server/lib/spec_definitions/spec/generated/get_script.json
similarity index 100%
rename from src/legacy/core_plugins/console/server/api_server/spec/generated/get_script.json
rename to src/plugins/console/server/lib/spec_definitions/spec/generated/get_script.json
diff --git a/src/legacy/core_plugins/console/server/api_server/spec/generated/get_script_context.json b/src/plugins/console/server/lib/spec_definitions/spec/generated/get_script_context.json
similarity index 100%
rename from src/legacy/core_plugins/console/server/api_server/spec/generated/get_script_context.json
rename to src/plugins/console/server/lib/spec_definitions/spec/generated/get_script_context.json
diff --git a/src/legacy/core_plugins/console/server/api_server/spec/generated/get_script_languages.json b/src/plugins/console/server/lib/spec_definitions/spec/generated/get_script_languages.json
similarity index 100%
rename from src/legacy/core_plugins/console/server/api_server/spec/generated/get_script_languages.json
rename to src/plugins/console/server/lib/spec_definitions/spec/generated/get_script_languages.json
diff --git a/src/legacy/core_plugins/console/server/api_server/spec/generated/get_source.json b/src/plugins/console/server/lib/spec_definitions/spec/generated/get_source.json
similarity index 100%
rename from src/legacy/core_plugins/console/server/api_server/spec/generated/get_source.json
rename to src/plugins/console/server/lib/spec_definitions/spec/generated/get_source.json
diff --git a/src/legacy/core_plugins/console/server/api_server/spec/generated/index.json b/src/plugins/console/server/lib/spec_definitions/spec/generated/index.json
similarity index 100%
rename from src/legacy/core_plugins/console/server/api_server/spec/generated/index.json
rename to src/plugins/console/server/lib/spec_definitions/spec/generated/index.json
diff --git a/src/legacy/core_plugins/console/server/api_server/spec/generated/indices.analyze.json b/src/plugins/console/server/lib/spec_definitions/spec/generated/indices.analyze.json
similarity index 100%
rename from src/legacy/core_plugins/console/server/api_server/spec/generated/indices.analyze.json
rename to src/plugins/console/server/lib/spec_definitions/spec/generated/indices.analyze.json
diff --git a/src/legacy/core_plugins/console/server/api_server/spec/generated/indices.clear_cache.json b/src/plugins/console/server/lib/spec_definitions/spec/generated/indices.clear_cache.json
similarity index 100%
rename from src/legacy/core_plugins/console/server/api_server/spec/generated/indices.clear_cache.json
rename to src/plugins/console/server/lib/spec_definitions/spec/generated/indices.clear_cache.json
diff --git a/src/legacy/core_plugins/console/server/api_server/spec/generated/indices.clone.json b/src/plugins/console/server/lib/spec_definitions/spec/generated/indices.clone.json
similarity index 100%
rename from src/legacy/core_plugins/console/server/api_server/spec/generated/indices.clone.json
rename to src/plugins/console/server/lib/spec_definitions/spec/generated/indices.clone.json
diff --git a/src/legacy/core_plugins/console/server/api_server/spec/generated/indices.close.json b/src/plugins/console/server/lib/spec_definitions/spec/generated/indices.close.json
similarity index 100%
rename from src/legacy/core_plugins/console/server/api_server/spec/generated/indices.close.json
rename to src/plugins/console/server/lib/spec_definitions/spec/generated/indices.close.json
diff --git a/src/legacy/core_plugins/console/server/api_server/spec/generated/indices.create.json b/src/plugins/console/server/lib/spec_definitions/spec/generated/indices.create.json
similarity index 100%
rename from src/legacy/core_plugins/console/server/api_server/spec/generated/indices.create.json
rename to src/plugins/console/server/lib/spec_definitions/spec/generated/indices.create.json
diff --git a/src/legacy/core_plugins/console/server/api_server/spec/generated/indices.delete.json b/src/plugins/console/server/lib/spec_definitions/spec/generated/indices.delete.json
similarity index 100%
rename from src/legacy/core_plugins/console/server/api_server/spec/generated/indices.delete.json
rename to src/plugins/console/server/lib/spec_definitions/spec/generated/indices.delete.json
diff --git a/src/legacy/core_plugins/console/server/api_server/spec/generated/indices.delete_alias.json b/src/plugins/console/server/lib/spec_definitions/spec/generated/indices.delete_alias.json
similarity index 100%
rename from src/legacy/core_plugins/console/server/api_server/spec/generated/indices.delete_alias.json
rename to src/plugins/console/server/lib/spec_definitions/spec/generated/indices.delete_alias.json
diff --git a/src/legacy/core_plugins/console/server/api_server/spec/generated/indices.delete_template.json b/src/plugins/console/server/lib/spec_definitions/spec/generated/indices.delete_template.json
similarity index 100%
rename from src/legacy/core_plugins/console/server/api_server/spec/generated/indices.delete_template.json
rename to src/plugins/console/server/lib/spec_definitions/spec/generated/indices.delete_template.json
diff --git a/src/legacy/core_plugins/console/server/api_server/spec/generated/indices.exists.json b/src/plugins/console/server/lib/spec_definitions/spec/generated/indices.exists.json
similarity index 100%
rename from src/legacy/core_plugins/console/server/api_server/spec/generated/indices.exists.json
rename to src/plugins/console/server/lib/spec_definitions/spec/generated/indices.exists.json
diff --git a/src/legacy/core_plugins/console/server/api_server/spec/generated/indices.exists_alias.json b/src/plugins/console/server/lib/spec_definitions/spec/generated/indices.exists_alias.json
similarity index 100%
rename from src/legacy/core_plugins/console/server/api_server/spec/generated/indices.exists_alias.json
rename to src/plugins/console/server/lib/spec_definitions/spec/generated/indices.exists_alias.json
diff --git a/src/legacy/core_plugins/console/server/api_server/spec/generated/indices.exists_template.json b/src/plugins/console/server/lib/spec_definitions/spec/generated/indices.exists_template.json
similarity index 100%
rename from src/legacy/core_plugins/console/server/api_server/spec/generated/indices.exists_template.json
rename to src/plugins/console/server/lib/spec_definitions/spec/generated/indices.exists_template.json
diff --git a/src/legacy/core_plugins/console/server/api_server/spec/generated/indices.exists_type.json b/src/plugins/console/server/lib/spec_definitions/spec/generated/indices.exists_type.json
similarity index 100%
rename from src/legacy/core_plugins/console/server/api_server/spec/generated/indices.exists_type.json
rename to src/plugins/console/server/lib/spec_definitions/spec/generated/indices.exists_type.json
diff --git a/src/legacy/core_plugins/console/server/api_server/spec/generated/indices.flush.json b/src/plugins/console/server/lib/spec_definitions/spec/generated/indices.flush.json
similarity index 100%
rename from src/legacy/core_plugins/console/server/api_server/spec/generated/indices.flush.json
rename to src/plugins/console/server/lib/spec_definitions/spec/generated/indices.flush.json
diff --git a/src/legacy/core_plugins/console/server/api_server/spec/generated/indices.flush_synced.json b/src/plugins/console/server/lib/spec_definitions/spec/generated/indices.flush_synced.json
similarity index 100%
rename from src/legacy/core_plugins/console/server/api_server/spec/generated/indices.flush_synced.json
rename to src/plugins/console/server/lib/spec_definitions/spec/generated/indices.flush_synced.json
diff --git a/src/legacy/core_plugins/console/server/api_server/spec/generated/indices.forcemerge.json b/src/plugins/console/server/lib/spec_definitions/spec/generated/indices.forcemerge.json
similarity index 100%
rename from src/legacy/core_plugins/console/server/api_server/spec/generated/indices.forcemerge.json
rename to src/plugins/console/server/lib/spec_definitions/spec/generated/indices.forcemerge.json
diff --git a/src/legacy/core_plugins/console/server/api_server/spec/generated/indices.get.json b/src/plugins/console/server/lib/spec_definitions/spec/generated/indices.get.json
similarity index 100%
rename from src/legacy/core_plugins/console/server/api_server/spec/generated/indices.get.json
rename to src/plugins/console/server/lib/spec_definitions/spec/generated/indices.get.json
diff --git a/src/legacy/core_plugins/console/server/api_server/spec/generated/indices.get_alias.json b/src/plugins/console/server/lib/spec_definitions/spec/generated/indices.get_alias.json
similarity index 100%
rename from src/legacy/core_plugins/console/server/api_server/spec/generated/indices.get_alias.json
rename to src/plugins/console/server/lib/spec_definitions/spec/generated/indices.get_alias.json
diff --git a/src/legacy/core_plugins/console/server/api_server/spec/generated/indices.get_field_mapping.json b/src/plugins/console/server/lib/spec_definitions/spec/generated/indices.get_field_mapping.json
similarity index 100%
rename from src/legacy/core_plugins/console/server/api_server/spec/generated/indices.get_field_mapping.json
rename to src/plugins/console/server/lib/spec_definitions/spec/generated/indices.get_field_mapping.json
diff --git a/src/legacy/core_plugins/console/server/api_server/spec/generated/indices.get_mapping.json b/src/plugins/console/server/lib/spec_definitions/spec/generated/indices.get_mapping.json
similarity index 100%
rename from src/legacy/core_plugins/console/server/api_server/spec/generated/indices.get_mapping.json
rename to src/plugins/console/server/lib/spec_definitions/spec/generated/indices.get_mapping.json
diff --git a/src/legacy/core_plugins/console/server/api_server/spec/generated/indices.get_settings.json b/src/plugins/console/server/lib/spec_definitions/spec/generated/indices.get_settings.json
similarity index 100%
rename from src/legacy/core_plugins/console/server/api_server/spec/generated/indices.get_settings.json
rename to src/plugins/console/server/lib/spec_definitions/spec/generated/indices.get_settings.json
diff --git a/src/legacy/core_plugins/console/server/api_server/spec/generated/indices.get_template.json b/src/plugins/console/server/lib/spec_definitions/spec/generated/indices.get_template.json
similarity index 100%
rename from src/legacy/core_plugins/console/server/api_server/spec/generated/indices.get_template.json
rename to src/plugins/console/server/lib/spec_definitions/spec/generated/indices.get_template.json
diff --git a/src/legacy/core_plugins/console/server/api_server/spec/generated/indices.get_upgrade.json b/src/plugins/console/server/lib/spec_definitions/spec/generated/indices.get_upgrade.json
similarity index 100%
rename from src/legacy/core_plugins/console/server/api_server/spec/generated/indices.get_upgrade.json
rename to src/plugins/console/server/lib/spec_definitions/spec/generated/indices.get_upgrade.json
diff --git a/src/legacy/core_plugins/console/server/api_server/spec/generated/indices.open.json b/src/plugins/console/server/lib/spec_definitions/spec/generated/indices.open.json
similarity index 100%
rename from src/legacy/core_plugins/console/server/api_server/spec/generated/indices.open.json
rename to src/plugins/console/server/lib/spec_definitions/spec/generated/indices.open.json
diff --git a/src/legacy/core_plugins/console/server/api_server/spec/generated/indices.put_alias.json b/src/plugins/console/server/lib/spec_definitions/spec/generated/indices.put_alias.json
similarity index 100%
rename from src/legacy/core_plugins/console/server/api_server/spec/generated/indices.put_alias.json
rename to src/plugins/console/server/lib/spec_definitions/spec/generated/indices.put_alias.json
diff --git a/src/legacy/core_plugins/console/server/api_server/spec/generated/indices.put_mapping.json b/src/plugins/console/server/lib/spec_definitions/spec/generated/indices.put_mapping.json
similarity index 100%
rename from src/legacy/core_plugins/console/server/api_server/spec/generated/indices.put_mapping.json
rename to src/plugins/console/server/lib/spec_definitions/spec/generated/indices.put_mapping.json
diff --git a/src/legacy/core_plugins/console/server/api_server/spec/generated/indices.put_settings.json b/src/plugins/console/server/lib/spec_definitions/spec/generated/indices.put_settings.json
similarity index 100%
rename from src/legacy/core_plugins/console/server/api_server/spec/generated/indices.put_settings.json
rename to src/plugins/console/server/lib/spec_definitions/spec/generated/indices.put_settings.json
diff --git a/src/legacy/core_plugins/console/server/api_server/spec/generated/indices.put_template.json b/src/plugins/console/server/lib/spec_definitions/spec/generated/indices.put_template.json
similarity index 100%
rename from src/legacy/core_plugins/console/server/api_server/spec/generated/indices.put_template.json
rename to src/plugins/console/server/lib/spec_definitions/spec/generated/indices.put_template.json
diff --git a/src/legacy/core_plugins/console/server/api_server/spec/generated/indices.recovery.json b/src/plugins/console/server/lib/spec_definitions/spec/generated/indices.recovery.json
similarity index 100%
rename from src/legacy/core_plugins/console/server/api_server/spec/generated/indices.recovery.json
rename to src/plugins/console/server/lib/spec_definitions/spec/generated/indices.recovery.json
diff --git a/src/legacy/core_plugins/console/server/api_server/spec/generated/indices.refresh.json b/src/plugins/console/server/lib/spec_definitions/spec/generated/indices.refresh.json
similarity index 100%
rename from src/legacy/core_plugins/console/server/api_server/spec/generated/indices.refresh.json
rename to src/plugins/console/server/lib/spec_definitions/spec/generated/indices.refresh.json
diff --git a/src/legacy/core_plugins/console/server/api_server/spec/generated/indices.rollover.json b/src/plugins/console/server/lib/spec_definitions/spec/generated/indices.rollover.json
similarity index 100%
rename from src/legacy/core_plugins/console/server/api_server/spec/generated/indices.rollover.json
rename to src/plugins/console/server/lib/spec_definitions/spec/generated/indices.rollover.json
diff --git a/src/legacy/core_plugins/console/server/api_server/spec/generated/indices.segments.json b/src/plugins/console/server/lib/spec_definitions/spec/generated/indices.segments.json
similarity index 100%
rename from src/legacy/core_plugins/console/server/api_server/spec/generated/indices.segments.json
rename to src/plugins/console/server/lib/spec_definitions/spec/generated/indices.segments.json
diff --git a/src/legacy/core_plugins/console/server/api_server/spec/generated/indices.shard_stores.json b/src/plugins/console/server/lib/spec_definitions/spec/generated/indices.shard_stores.json
similarity index 100%
rename from src/legacy/core_plugins/console/server/api_server/spec/generated/indices.shard_stores.json
rename to src/plugins/console/server/lib/spec_definitions/spec/generated/indices.shard_stores.json
diff --git a/src/legacy/core_plugins/console/server/api_server/spec/generated/indices.shrink.json b/src/plugins/console/server/lib/spec_definitions/spec/generated/indices.shrink.json
similarity index 100%
rename from src/legacy/core_plugins/console/server/api_server/spec/generated/indices.shrink.json
rename to src/plugins/console/server/lib/spec_definitions/spec/generated/indices.shrink.json
diff --git a/src/legacy/core_plugins/console/server/api_server/spec/generated/indices.split.json b/src/plugins/console/server/lib/spec_definitions/spec/generated/indices.split.json
similarity index 100%
rename from src/legacy/core_plugins/console/server/api_server/spec/generated/indices.split.json
rename to src/plugins/console/server/lib/spec_definitions/spec/generated/indices.split.json
diff --git a/src/legacy/core_plugins/console/server/api_server/spec/generated/indices.stats.json b/src/plugins/console/server/lib/spec_definitions/spec/generated/indices.stats.json
similarity index 100%
rename from src/legacy/core_plugins/console/server/api_server/spec/generated/indices.stats.json
rename to src/plugins/console/server/lib/spec_definitions/spec/generated/indices.stats.json
diff --git a/src/legacy/core_plugins/console/server/api_server/spec/generated/indices.update_aliases.json b/src/plugins/console/server/lib/spec_definitions/spec/generated/indices.update_aliases.json
similarity index 100%
rename from src/legacy/core_plugins/console/server/api_server/spec/generated/indices.update_aliases.json
rename to src/plugins/console/server/lib/spec_definitions/spec/generated/indices.update_aliases.json
diff --git a/src/legacy/core_plugins/console/server/api_server/spec/generated/indices.upgrade.json b/src/plugins/console/server/lib/spec_definitions/spec/generated/indices.upgrade.json
similarity index 100%
rename from src/legacy/core_plugins/console/server/api_server/spec/generated/indices.upgrade.json
rename to src/plugins/console/server/lib/spec_definitions/spec/generated/indices.upgrade.json
diff --git a/src/legacy/core_plugins/console/server/api_server/spec/generated/indices.validate_query.json b/src/plugins/console/server/lib/spec_definitions/spec/generated/indices.validate_query.json
similarity index 100%
rename from src/legacy/core_plugins/console/server/api_server/spec/generated/indices.validate_query.json
rename to src/plugins/console/server/lib/spec_definitions/spec/generated/indices.validate_query.json
diff --git a/src/legacy/core_plugins/console/server/api_server/spec/generated/info.json b/src/plugins/console/server/lib/spec_definitions/spec/generated/info.json
similarity index 100%
rename from src/legacy/core_plugins/console/server/api_server/spec/generated/info.json
rename to src/plugins/console/server/lib/spec_definitions/spec/generated/info.json
diff --git a/src/legacy/core_plugins/console/server/api_server/spec/generated/ingest.delete_pipeline.json b/src/plugins/console/server/lib/spec_definitions/spec/generated/ingest.delete_pipeline.json
similarity index 100%
rename from src/legacy/core_plugins/console/server/api_server/spec/generated/ingest.delete_pipeline.json
rename to src/plugins/console/server/lib/spec_definitions/spec/generated/ingest.delete_pipeline.json
diff --git a/src/legacy/core_plugins/console/server/api_server/spec/generated/ingest.get_pipeline.json b/src/plugins/console/server/lib/spec_definitions/spec/generated/ingest.get_pipeline.json
similarity index 100%
rename from src/legacy/core_plugins/console/server/api_server/spec/generated/ingest.get_pipeline.json
rename to src/plugins/console/server/lib/spec_definitions/spec/generated/ingest.get_pipeline.json
diff --git a/src/legacy/core_plugins/console/server/api_server/spec/generated/ingest.processor_grok.json b/src/plugins/console/server/lib/spec_definitions/spec/generated/ingest.processor_grok.json
similarity index 100%
rename from src/legacy/core_plugins/console/server/api_server/spec/generated/ingest.processor_grok.json
rename to src/plugins/console/server/lib/spec_definitions/spec/generated/ingest.processor_grok.json
diff --git a/src/legacy/core_plugins/console/server/api_server/spec/generated/ingest.put_pipeline.json b/src/plugins/console/server/lib/spec_definitions/spec/generated/ingest.put_pipeline.json
similarity index 100%
rename from src/legacy/core_plugins/console/server/api_server/spec/generated/ingest.put_pipeline.json
rename to src/plugins/console/server/lib/spec_definitions/spec/generated/ingest.put_pipeline.json
diff --git a/src/legacy/core_plugins/console/server/api_server/spec/generated/ingest.simulate.json b/src/plugins/console/server/lib/spec_definitions/spec/generated/ingest.simulate.json
similarity index 100%
rename from src/legacy/core_plugins/console/server/api_server/spec/generated/ingest.simulate.json
rename to src/plugins/console/server/lib/spec_definitions/spec/generated/ingest.simulate.json
diff --git a/src/legacy/core_plugins/console/server/api_server/spec/generated/mget.json b/src/plugins/console/server/lib/spec_definitions/spec/generated/mget.json
similarity index 100%
rename from src/legacy/core_plugins/console/server/api_server/spec/generated/mget.json
rename to src/plugins/console/server/lib/spec_definitions/spec/generated/mget.json
diff --git a/src/legacy/core_plugins/console/server/api_server/spec/generated/msearch.json b/src/plugins/console/server/lib/spec_definitions/spec/generated/msearch.json
similarity index 100%
rename from src/legacy/core_plugins/console/server/api_server/spec/generated/msearch.json
rename to src/plugins/console/server/lib/spec_definitions/spec/generated/msearch.json
diff --git a/src/legacy/core_plugins/console/server/api_server/spec/generated/msearch_template.json b/src/plugins/console/server/lib/spec_definitions/spec/generated/msearch_template.json
similarity index 100%
rename from src/legacy/core_plugins/console/server/api_server/spec/generated/msearch_template.json
rename to src/plugins/console/server/lib/spec_definitions/spec/generated/msearch_template.json
diff --git a/src/legacy/core_plugins/console/server/api_server/spec/generated/mtermvectors.json b/src/plugins/console/server/lib/spec_definitions/spec/generated/mtermvectors.json
similarity index 100%
rename from src/legacy/core_plugins/console/server/api_server/spec/generated/mtermvectors.json
rename to src/plugins/console/server/lib/spec_definitions/spec/generated/mtermvectors.json
diff --git a/src/legacy/core_plugins/console/server/api_server/spec/generated/nodes.hot_threads.json b/src/plugins/console/server/lib/spec_definitions/spec/generated/nodes.hot_threads.json
similarity index 100%
rename from src/legacy/core_plugins/console/server/api_server/spec/generated/nodes.hot_threads.json
rename to src/plugins/console/server/lib/spec_definitions/spec/generated/nodes.hot_threads.json
diff --git a/src/legacy/core_plugins/console/server/api_server/spec/generated/nodes.info.json b/src/plugins/console/server/lib/spec_definitions/spec/generated/nodes.info.json
similarity index 100%
rename from src/legacy/core_plugins/console/server/api_server/spec/generated/nodes.info.json
rename to src/plugins/console/server/lib/spec_definitions/spec/generated/nodes.info.json
diff --git a/src/legacy/core_plugins/console/server/api_server/spec/generated/nodes.reload_secure_settings.json b/src/plugins/console/server/lib/spec_definitions/spec/generated/nodes.reload_secure_settings.json
similarity index 100%
rename from src/legacy/core_plugins/console/server/api_server/spec/generated/nodes.reload_secure_settings.json
rename to src/plugins/console/server/lib/spec_definitions/spec/generated/nodes.reload_secure_settings.json
diff --git a/src/legacy/core_plugins/console/server/api_server/spec/generated/nodes.stats.json b/src/plugins/console/server/lib/spec_definitions/spec/generated/nodes.stats.json
similarity index 100%
rename from src/legacy/core_plugins/console/server/api_server/spec/generated/nodes.stats.json
rename to src/plugins/console/server/lib/spec_definitions/spec/generated/nodes.stats.json
diff --git a/src/legacy/core_plugins/console/server/api_server/spec/generated/nodes.usage.json b/src/plugins/console/server/lib/spec_definitions/spec/generated/nodes.usage.json
similarity index 100%
rename from src/legacy/core_plugins/console/server/api_server/spec/generated/nodes.usage.json
rename to src/plugins/console/server/lib/spec_definitions/spec/generated/nodes.usage.json
diff --git a/src/legacy/core_plugins/console/server/api_server/spec/generated/ping.json b/src/plugins/console/server/lib/spec_definitions/spec/generated/ping.json
similarity index 100%
rename from src/legacy/core_plugins/console/server/api_server/spec/generated/ping.json
rename to src/plugins/console/server/lib/spec_definitions/spec/generated/ping.json
diff --git a/src/legacy/core_plugins/console/server/api_server/spec/generated/put_script.json b/src/plugins/console/server/lib/spec_definitions/spec/generated/put_script.json
similarity index 100%
rename from src/legacy/core_plugins/console/server/api_server/spec/generated/put_script.json
rename to src/plugins/console/server/lib/spec_definitions/spec/generated/put_script.json
diff --git a/src/legacy/core_plugins/console/server/api_server/spec/generated/rank_eval.json b/src/plugins/console/server/lib/spec_definitions/spec/generated/rank_eval.json
similarity index 100%
rename from src/legacy/core_plugins/console/server/api_server/spec/generated/rank_eval.json
rename to src/plugins/console/server/lib/spec_definitions/spec/generated/rank_eval.json
diff --git a/src/legacy/core_plugins/console/server/api_server/spec/generated/reindex.json b/src/plugins/console/server/lib/spec_definitions/spec/generated/reindex.json
similarity index 100%
rename from src/legacy/core_plugins/console/server/api_server/spec/generated/reindex.json
rename to src/plugins/console/server/lib/spec_definitions/spec/generated/reindex.json
diff --git a/src/legacy/core_plugins/console/server/api_server/spec/generated/reindex_rethrottle.json b/src/plugins/console/server/lib/spec_definitions/spec/generated/reindex_rethrottle.json
similarity index 100%
rename from src/legacy/core_plugins/console/server/api_server/spec/generated/reindex_rethrottle.json
rename to src/plugins/console/server/lib/spec_definitions/spec/generated/reindex_rethrottle.json
diff --git a/src/legacy/core_plugins/console/server/api_server/spec/generated/render_search_template.json b/src/plugins/console/server/lib/spec_definitions/spec/generated/render_search_template.json
similarity index 100%
rename from src/legacy/core_plugins/console/server/api_server/spec/generated/render_search_template.json
rename to src/plugins/console/server/lib/spec_definitions/spec/generated/render_search_template.json
diff --git a/src/legacy/core_plugins/console/server/api_server/spec/generated/scripts_painless_execute.json b/src/plugins/console/server/lib/spec_definitions/spec/generated/scripts_painless_execute.json
similarity index 100%
rename from src/legacy/core_plugins/console/server/api_server/spec/generated/scripts_painless_execute.json
rename to src/plugins/console/server/lib/spec_definitions/spec/generated/scripts_painless_execute.json
diff --git a/src/legacy/core_plugins/console/server/api_server/spec/generated/scroll.json b/src/plugins/console/server/lib/spec_definitions/spec/generated/scroll.json
similarity index 100%
rename from src/legacy/core_plugins/console/server/api_server/spec/generated/scroll.json
rename to src/plugins/console/server/lib/spec_definitions/spec/generated/scroll.json
diff --git a/src/legacy/core_plugins/console/server/api_server/spec/generated/search.json b/src/plugins/console/server/lib/spec_definitions/spec/generated/search.json
similarity index 100%
rename from src/legacy/core_plugins/console/server/api_server/spec/generated/search.json
rename to src/plugins/console/server/lib/spec_definitions/spec/generated/search.json
diff --git a/src/legacy/core_plugins/console/server/api_server/spec/generated/search_shards.json b/src/plugins/console/server/lib/spec_definitions/spec/generated/search_shards.json
similarity index 100%
rename from src/legacy/core_plugins/console/server/api_server/spec/generated/search_shards.json
rename to src/plugins/console/server/lib/spec_definitions/spec/generated/search_shards.json
diff --git a/src/legacy/core_plugins/console/server/api_server/spec/generated/search_template.json b/src/plugins/console/server/lib/spec_definitions/spec/generated/search_template.json
similarity index 100%
rename from src/legacy/core_plugins/console/server/api_server/spec/generated/search_template.json
rename to src/plugins/console/server/lib/spec_definitions/spec/generated/search_template.json
diff --git a/src/legacy/core_plugins/console/server/api_server/spec/generated/snapshot.cleanup_repository.json b/src/plugins/console/server/lib/spec_definitions/spec/generated/snapshot.cleanup_repository.json
similarity index 100%
rename from src/legacy/core_plugins/console/server/api_server/spec/generated/snapshot.cleanup_repository.json
rename to src/plugins/console/server/lib/spec_definitions/spec/generated/snapshot.cleanup_repository.json
diff --git a/src/legacy/core_plugins/console/server/api_server/spec/generated/snapshot.create.json b/src/plugins/console/server/lib/spec_definitions/spec/generated/snapshot.create.json
similarity index 100%
rename from src/legacy/core_plugins/console/server/api_server/spec/generated/snapshot.create.json
rename to src/plugins/console/server/lib/spec_definitions/spec/generated/snapshot.create.json
diff --git a/src/legacy/core_plugins/console/server/api_server/spec/generated/snapshot.create_repository.json b/src/plugins/console/server/lib/spec_definitions/spec/generated/snapshot.create_repository.json
similarity index 100%
rename from src/legacy/core_plugins/console/server/api_server/spec/generated/snapshot.create_repository.json
rename to src/plugins/console/server/lib/spec_definitions/spec/generated/snapshot.create_repository.json
diff --git a/src/legacy/core_plugins/console/server/api_server/spec/generated/snapshot.delete.json b/src/plugins/console/server/lib/spec_definitions/spec/generated/snapshot.delete.json
similarity index 100%
rename from src/legacy/core_plugins/console/server/api_server/spec/generated/snapshot.delete.json
rename to src/plugins/console/server/lib/spec_definitions/spec/generated/snapshot.delete.json
diff --git a/src/legacy/core_plugins/console/server/api_server/spec/generated/snapshot.delete_repository.json b/src/plugins/console/server/lib/spec_definitions/spec/generated/snapshot.delete_repository.json
similarity index 100%
rename from src/legacy/core_plugins/console/server/api_server/spec/generated/snapshot.delete_repository.json
rename to src/plugins/console/server/lib/spec_definitions/spec/generated/snapshot.delete_repository.json
diff --git a/src/legacy/core_plugins/console/server/api_server/spec/generated/snapshot.get.json b/src/plugins/console/server/lib/spec_definitions/spec/generated/snapshot.get.json
similarity index 100%
rename from src/legacy/core_plugins/console/server/api_server/spec/generated/snapshot.get.json
rename to src/plugins/console/server/lib/spec_definitions/spec/generated/snapshot.get.json
diff --git a/src/legacy/core_plugins/console/server/api_server/spec/generated/snapshot.get_repository.json b/src/plugins/console/server/lib/spec_definitions/spec/generated/snapshot.get_repository.json
similarity index 100%
rename from src/legacy/core_plugins/console/server/api_server/spec/generated/snapshot.get_repository.json
rename to src/plugins/console/server/lib/spec_definitions/spec/generated/snapshot.get_repository.json
diff --git a/src/legacy/core_plugins/console/server/api_server/spec/generated/snapshot.restore.json b/src/plugins/console/server/lib/spec_definitions/spec/generated/snapshot.restore.json
similarity index 100%
rename from src/legacy/core_plugins/console/server/api_server/spec/generated/snapshot.restore.json
rename to src/plugins/console/server/lib/spec_definitions/spec/generated/snapshot.restore.json
diff --git a/src/legacy/core_plugins/console/server/api_server/spec/generated/snapshot.status.json b/src/plugins/console/server/lib/spec_definitions/spec/generated/snapshot.status.json
similarity index 100%
rename from src/legacy/core_plugins/console/server/api_server/spec/generated/snapshot.status.json
rename to src/plugins/console/server/lib/spec_definitions/spec/generated/snapshot.status.json
diff --git a/src/legacy/core_plugins/console/server/api_server/spec/generated/snapshot.verify_repository.json b/src/plugins/console/server/lib/spec_definitions/spec/generated/snapshot.verify_repository.json
similarity index 100%
rename from src/legacy/core_plugins/console/server/api_server/spec/generated/snapshot.verify_repository.json
rename to src/plugins/console/server/lib/spec_definitions/spec/generated/snapshot.verify_repository.json
diff --git a/src/legacy/core_plugins/console/server/api_server/spec/generated/tasks.cancel.json b/src/plugins/console/server/lib/spec_definitions/spec/generated/tasks.cancel.json
similarity index 100%
rename from src/legacy/core_plugins/console/server/api_server/spec/generated/tasks.cancel.json
rename to src/plugins/console/server/lib/spec_definitions/spec/generated/tasks.cancel.json
diff --git a/src/legacy/core_plugins/console/server/api_server/spec/generated/tasks.get.json b/src/plugins/console/server/lib/spec_definitions/spec/generated/tasks.get.json
similarity index 100%
rename from src/legacy/core_plugins/console/server/api_server/spec/generated/tasks.get.json
rename to src/plugins/console/server/lib/spec_definitions/spec/generated/tasks.get.json
diff --git a/src/legacy/core_plugins/console/server/api_server/spec/generated/tasks.list.json b/src/plugins/console/server/lib/spec_definitions/spec/generated/tasks.list.json
similarity index 100%
rename from src/legacy/core_plugins/console/server/api_server/spec/generated/tasks.list.json
rename to src/plugins/console/server/lib/spec_definitions/spec/generated/tasks.list.json
diff --git a/src/legacy/core_plugins/console/server/api_server/spec/generated/termvectors.json b/src/plugins/console/server/lib/spec_definitions/spec/generated/termvectors.json
similarity index 100%
rename from src/legacy/core_plugins/console/server/api_server/spec/generated/termvectors.json
rename to src/plugins/console/server/lib/spec_definitions/spec/generated/termvectors.json
diff --git a/src/legacy/core_plugins/console/server/api_server/spec/generated/update.json b/src/plugins/console/server/lib/spec_definitions/spec/generated/update.json
similarity index 100%
rename from src/legacy/core_plugins/console/server/api_server/spec/generated/update.json
rename to src/plugins/console/server/lib/spec_definitions/spec/generated/update.json
diff --git a/src/legacy/core_plugins/console/server/api_server/spec/generated/update_by_query.json b/src/plugins/console/server/lib/spec_definitions/spec/generated/update_by_query.json
similarity index 100%
rename from src/legacy/core_plugins/console/server/api_server/spec/generated/update_by_query.json
rename to src/plugins/console/server/lib/spec_definitions/spec/generated/update_by_query.json
diff --git a/src/legacy/core_plugins/console/server/api_server/spec/generated/update_by_query_rethrottle.json b/src/plugins/console/server/lib/spec_definitions/spec/generated/update_by_query_rethrottle.json
similarity index 100%
rename from src/legacy/core_plugins/console/server/api_server/spec/generated/update_by_query_rethrottle.json
rename to src/plugins/console/server/lib/spec_definitions/spec/generated/update_by_query_rethrottle.json
diff --git a/src/legacy/core_plugins/console/server/api_server/spec/index.js b/src/plugins/console/server/lib/spec_definitions/spec/index.js
similarity index 100%
rename from src/legacy/core_plugins/console/server/api_server/spec/index.js
rename to src/plugins/console/server/lib/spec_definitions/spec/index.js
diff --git a/src/legacy/core_plugins/console/server/api_server/spec/overrides/clear_scroll.json b/src/plugins/console/server/lib/spec_definitions/spec/overrides/clear_scroll.json
similarity index 100%
rename from src/legacy/core_plugins/console/server/api_server/spec/overrides/clear_scroll.json
rename to src/plugins/console/server/lib/spec_definitions/spec/overrides/clear_scroll.json
diff --git a/src/legacy/core_plugins/console/server/api_server/spec/overrides/cluster.health.json b/src/plugins/console/server/lib/spec_definitions/spec/overrides/cluster.health.json
similarity index 100%
rename from src/legacy/core_plugins/console/server/api_server/spec/overrides/cluster.health.json
rename to src/plugins/console/server/lib/spec_definitions/spec/overrides/cluster.health.json
diff --git a/src/legacy/core_plugins/console/server/api_server/spec/overrides/cluster.put_settings.json b/src/plugins/console/server/lib/spec_definitions/spec/overrides/cluster.put_settings.json
similarity index 100%
rename from src/legacy/core_plugins/console/server/api_server/spec/overrides/cluster.put_settings.json
rename to src/plugins/console/server/lib/spec_definitions/spec/overrides/cluster.put_settings.json
diff --git a/src/legacy/core_plugins/console/server/api_server/spec/overrides/cluster.reroute.json b/src/plugins/console/server/lib/spec_definitions/spec/overrides/cluster.reroute.json
similarity index 100%
rename from src/legacy/core_plugins/console/server/api_server/spec/overrides/cluster.reroute.json
rename to src/plugins/console/server/lib/spec_definitions/spec/overrides/cluster.reroute.json
diff --git a/src/legacy/core_plugins/console/server/api_server/spec/overrides/count.json b/src/plugins/console/server/lib/spec_definitions/spec/overrides/count.json
similarity index 100%
rename from src/legacy/core_plugins/console/server/api_server/spec/overrides/count.json
rename to src/plugins/console/server/lib/spec_definitions/spec/overrides/count.json
diff --git a/src/legacy/core_plugins/console/server/api_server/spec/overrides/indices.analyze.json b/src/plugins/console/server/lib/spec_definitions/spec/overrides/indices.analyze.json
similarity index 100%
rename from src/legacy/core_plugins/console/server/api_server/spec/overrides/indices.analyze.json
rename to src/plugins/console/server/lib/spec_definitions/spec/overrides/indices.analyze.json
diff --git a/src/legacy/core_plugins/console/server/api_server/spec/overrides/indices.clone.json b/src/plugins/console/server/lib/spec_definitions/spec/overrides/indices.clone.json
similarity index 100%
rename from src/legacy/core_plugins/console/server/api_server/spec/overrides/indices.clone.json
rename to src/plugins/console/server/lib/spec_definitions/spec/overrides/indices.clone.json
diff --git a/src/legacy/core_plugins/console/server/api_server/spec/overrides/indices.create.json b/src/plugins/console/server/lib/spec_definitions/spec/overrides/indices.create.json
similarity index 100%
rename from src/legacy/core_plugins/console/server/api_server/spec/overrides/indices.create.json
rename to src/plugins/console/server/lib/spec_definitions/spec/overrides/indices.create.json
diff --git a/src/legacy/core_plugins/console/server/api_server/spec/overrides/indices.delete_template.json b/src/plugins/console/server/lib/spec_definitions/spec/overrides/indices.delete_template.json
similarity index 100%
rename from src/legacy/core_plugins/console/server/api_server/spec/overrides/indices.delete_template.json
rename to src/plugins/console/server/lib/spec_definitions/spec/overrides/indices.delete_template.json
diff --git a/src/legacy/core_plugins/console/server/api_server/spec/overrides/indices.exists_template.json b/src/plugins/console/server/lib/spec_definitions/spec/overrides/indices.exists_template.json
similarity index 100%
rename from src/legacy/core_plugins/console/server/api_server/spec/overrides/indices.exists_template.json
rename to src/plugins/console/server/lib/spec_definitions/spec/overrides/indices.exists_template.json
diff --git a/src/legacy/core_plugins/console/server/api_server/spec/overrides/indices.get_field_mapping.json b/src/plugins/console/server/lib/spec_definitions/spec/overrides/indices.get_field_mapping.json
similarity index 100%
rename from src/legacy/core_plugins/console/server/api_server/spec/overrides/indices.get_field_mapping.json
rename to src/plugins/console/server/lib/spec_definitions/spec/overrides/indices.get_field_mapping.json
diff --git a/src/legacy/core_plugins/console/server/api_server/spec/overrides/indices.get_mapping.json b/src/plugins/console/server/lib/spec_definitions/spec/overrides/indices.get_mapping.json
similarity index 100%
rename from src/legacy/core_plugins/console/server/api_server/spec/overrides/indices.get_mapping.json
rename to src/plugins/console/server/lib/spec_definitions/spec/overrides/indices.get_mapping.json
diff --git a/src/legacy/core_plugins/console/server/api_server/spec/overrides/indices.get_template.json b/src/plugins/console/server/lib/spec_definitions/spec/overrides/indices.get_template.json
similarity index 100%
rename from src/legacy/core_plugins/console/server/api_server/spec/overrides/indices.get_template.json
rename to src/plugins/console/server/lib/spec_definitions/spec/overrides/indices.get_template.json
diff --git a/src/legacy/core_plugins/console/server/api_server/spec/overrides/indices.put_alias.json b/src/plugins/console/server/lib/spec_definitions/spec/overrides/indices.put_alias.json
similarity index 100%
rename from src/legacy/core_plugins/console/server/api_server/spec/overrides/indices.put_alias.json
rename to src/plugins/console/server/lib/spec_definitions/spec/overrides/indices.put_alias.json
diff --git a/src/legacy/core_plugins/console/server/api_server/spec/overrides/indices.put_settings.json b/src/plugins/console/server/lib/spec_definitions/spec/overrides/indices.put_settings.json
similarity index 100%
rename from src/legacy/core_plugins/console/server/api_server/spec/overrides/indices.put_settings.json
rename to src/plugins/console/server/lib/spec_definitions/spec/overrides/indices.put_settings.json
diff --git a/src/legacy/core_plugins/console/server/api_server/spec/overrides/indices.put_template.json b/src/plugins/console/server/lib/spec_definitions/spec/overrides/indices.put_template.json
similarity index 100%
rename from src/legacy/core_plugins/console/server/api_server/spec/overrides/indices.put_template.json
rename to src/plugins/console/server/lib/spec_definitions/spec/overrides/indices.put_template.json
diff --git a/src/legacy/core_plugins/console/server/api_server/spec/overrides/indices.rollover.json b/src/plugins/console/server/lib/spec_definitions/spec/overrides/indices.rollover.json
similarity index 100%
rename from src/legacy/core_plugins/console/server/api_server/spec/overrides/indices.rollover.json
rename to src/plugins/console/server/lib/spec_definitions/spec/overrides/indices.rollover.json
diff --git a/src/legacy/core_plugins/console/server/api_server/spec/overrides/indices.update_aliases.json b/src/plugins/console/server/lib/spec_definitions/spec/overrides/indices.update_aliases.json
similarity index 100%
rename from src/legacy/core_plugins/console/server/api_server/spec/overrides/indices.update_aliases.json
rename to src/plugins/console/server/lib/spec_definitions/spec/overrides/indices.update_aliases.json
diff --git a/src/legacy/core_plugins/console/server/api_server/spec/overrides/indices.validate_query.json b/src/plugins/console/server/lib/spec_definitions/spec/overrides/indices.validate_query.json
similarity index 100%
rename from src/legacy/core_plugins/console/server/api_server/spec/overrides/indices.validate_query.json
rename to src/plugins/console/server/lib/spec_definitions/spec/overrides/indices.validate_query.json
diff --git a/src/legacy/core_plugins/console/server/api_server/spec/overrides/snapshot.create.json b/src/plugins/console/server/lib/spec_definitions/spec/overrides/snapshot.create.json
similarity index 100%
rename from src/legacy/core_plugins/console/server/api_server/spec/overrides/snapshot.create.json
rename to src/plugins/console/server/lib/spec_definitions/spec/overrides/snapshot.create.json
diff --git a/src/legacy/core_plugins/console/server/api_server/spec/overrides/snapshot.create_repository.json b/src/plugins/console/server/lib/spec_definitions/spec/overrides/snapshot.create_repository.json
similarity index 100%
rename from src/legacy/core_plugins/console/server/api_server/spec/overrides/snapshot.create_repository.json
rename to src/plugins/console/server/lib/spec_definitions/spec/overrides/snapshot.create_repository.json
diff --git a/src/legacy/core_plugins/console/server/api_server/spec/overrides/snapshot.restore.json b/src/plugins/console/server/lib/spec_definitions/spec/overrides/snapshot.restore.json
similarity index 100%
rename from src/legacy/core_plugins/console/server/api_server/spec/overrides/snapshot.restore.json
rename to src/plugins/console/server/lib/spec_definitions/spec/overrides/snapshot.restore.json
diff --git a/src/legacy/core_plugins/console/server/wildcard_matcher.js b/src/plugins/console/server/lib/wildcard_matcher.ts
similarity index 81%
rename from src/legacy/core_plugins/console/server/wildcard_matcher.js
rename to src/plugins/console/server/lib/wildcard_matcher.ts
index b99fba9295e51..128ad19172c75 100644
--- a/src/legacy/core_plugins/console/server/wildcard_matcher.js
+++ b/src/plugins/console/server/lib/wildcard_matcher.ts
@@ -17,12 +17,14 @@
* under the License.
*/
-import { Minimatch } from 'minimatch';
+import { Minimatch, IMinimatch } from 'minimatch';
export class WildcardMatcher {
- constructor(wildcardPattern, emptyVal) {
- this.emptyVal = emptyVal;
- this.pattern = String(wildcardPattern || '*');
+ pattern: string;
+ matcher: IMinimatch;
+
+ constructor(private readonly wildcardPattern: string, private readonly emptyVal?: string) {
+ this.pattern = String(this.wildcardPattern || '*');
this.matcher = new Minimatch(this.pattern, {
noglobstar: true,
dot: true,
@@ -32,7 +34,7 @@ export class WildcardMatcher {
});
}
- match(candidate) {
+ match(candidate: string) {
const empty = !candidate || candidate === this.emptyVal;
if (empty && this.pattern === '*') {
return true;
diff --git a/src/plugins/console/server/plugin.ts b/src/plugins/console/server/plugin.ts
new file mode 100644
index 0000000000000..c8ef84aee3b61
--- /dev/null
+++ b/src/plugins/console/server/plugin.ts
@@ -0,0 +1,81 @@
+/*
+ * Licensed to Elasticsearch B.V. under one or more contributor
+ * license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright
+ * ownership. Elasticsearch B.V. licenses this file to you under
+ * the Apache License, Version 2.0 (the "License"); you may
+ * not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+import { first } from 'rxjs/operators';
+import { CoreSetup, Logger, Plugin, PluginInitializerContext } from 'kibana/server';
+
+import { readLegacyEsConfig } from '../../../legacy/core_plugins/console_legacy';
+
+import { ProxyConfigCollection, addExtensionSpecFilePath, addProcessorDefinition } from './lib';
+import { ConfigType } from './config';
+import { registerProxyRoute } from './routes/api/console/proxy';
+import { registerSpecDefinitionsRoute } from './routes/api/console/spec_definitions';
+import { ESConfigForProxy, ConsoleSetup } from './types';
+
+export class ConsoleServerPlugin implements Plugin {
+ log: Logger;
+
+ constructor(private readonly ctx: PluginInitializerContext) {
+ this.log = this.ctx.logger.get();
+ }
+
+ async setup({ http, capabilities, getStartServices }: CoreSetup) {
+ capabilities.registerProvider(() => ({
+ dev_tools: {
+ show: true,
+ save: true,
+ },
+ }));
+
+ const config = await this.ctx.config
+ .create()
+ .pipe(first())
+ .toPromise();
+
+ const { elasticsearch } = await this.ctx.config.legacy.globalConfig$.pipe(first()).toPromise();
+
+ const proxyPathFilters = config.proxyFilter.map((str: string) => new RegExp(str));
+
+ const router = http.createRouter();
+
+ registerProxyRoute({
+ log: this.log,
+ proxyConfigCollection: new ProxyConfigCollection(config.proxyConfig),
+ readLegacyESConfig: (): ESConfigForProxy => {
+ const legacyConfig = readLegacyEsConfig();
+ return {
+ ...elasticsearch,
+ hosts: legacyConfig.hosts,
+ requestHeadersWhitelist: legacyConfig.requestHeadersWhitelist,
+ customHeaders: legacyConfig.customHeaders,
+ };
+ },
+ pathFilters: proxyPathFilters,
+ router,
+ });
+
+ registerSpecDefinitionsRoute({ router });
+
+ return {
+ addExtensionSpecFilePath,
+ addProcessorDefinition,
+ };
+ }
+
+ start() {}
+}
diff --git a/src/plugins/console/server/routes/api/console/proxy/create_handler.ts b/src/plugins/console/server/routes/api/console/proxy/create_handler.ts
new file mode 100644
index 0000000000000..50a9fcf03c209
--- /dev/null
+++ b/src/plugins/console/server/routes/api/console/proxy/create_handler.ts
@@ -0,0 +1,217 @@
+/*
+ * Licensed to Elasticsearch B.V. under one or more contributor
+ * license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright
+ * ownership. Elasticsearch B.V. licenses this file to you under
+ * the Apache License, Version 2.0 (the "License"); you may
+ * not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import { Agent, IncomingMessage } from 'http';
+import * as url from 'url';
+import { pick, trimLeft, trimRight } from 'lodash';
+
+import { KibanaRequest, Logger, RequestHandler } from 'kibana/server';
+
+import { ESConfigForProxy } from '../../../../types';
+import {
+ getElasticsearchProxyConfig,
+ ProxyConfigCollection,
+ proxyRequest,
+ setHeaders,
+} from '../../../../lib';
+
+import { Body, Query } from './validation_config';
+
+// TODO: find a better way to get information from the request like remoteAddress and remotePort
+// for forwarding.
+// eslint-disable-next-line @kbn/eslint/no-restricted-paths
+import { ensureRawRequest } from '../../../../../../../core/server/http/router';
+
+export interface CreateHandlerDependencies {
+ log: Logger;
+ readLegacyESConfig: () => ESConfigForProxy;
+ pathFilters: RegExp[];
+ proxyConfigCollection: ProxyConfigCollection;
+}
+
+function toURL(base: string, path: string) {
+ const urlResult = new url.URL(`${trimRight(base, '/')}/${trimLeft(path, '/')}`);
+ // Appending pretty here to have Elasticsearch do the JSON formatting, as doing
+ // in JS can lead to data loss (7.0 will get munged into 7, thus losing indication of
+ // measurement precision)
+ if (!urlResult.searchParams.get('pretty')) {
+ urlResult.searchParams.append('pretty', 'true');
+ }
+ return urlResult;
+}
+
+function filterHeaders(originalHeaders: object, headersToKeep: string[]): object {
+ const normalizeHeader = function(header: any) {
+ if (!header) {
+ return '';
+ }
+ header = header.toString();
+ return header.trim().toLowerCase();
+ };
+
+ // Normalize list of headers we want to allow in upstream request
+ const headersToKeepNormalized = headersToKeep.map(normalizeHeader);
+
+ return pick(originalHeaders, headersToKeepNormalized);
+}
+
+function getRequestConfig(
+ headers: object,
+ esConfig: ESConfigForProxy,
+ proxyConfigCollection: ProxyConfigCollection,
+ uri: string
+): { agent: Agent; timeout: number; headers: object; rejectUnauthorized?: boolean } {
+ const filteredHeaders = filterHeaders(headers, esConfig.requestHeadersWhitelist);
+ const newHeaders = setHeaders(filteredHeaders, esConfig.customHeaders);
+
+ if (proxyConfigCollection.hasConfig()) {
+ return {
+ ...proxyConfigCollection.configForUri(uri),
+ headers: newHeaders,
+ } as any;
+ }
+
+ return {
+ ...getElasticsearchProxyConfig(esConfig),
+ headers: newHeaders,
+ };
+}
+
+function getProxyHeaders(req: KibanaRequest) {
+ const headers = Object.create(null);
+
+ // Scope this proto-unsafe functionality to where it is being used.
+ function extendCommaList(obj: Record, property: string, value: any) {
+ obj[property] = (obj[property] ? obj[property] + ',' : '') + value;
+ }
+
+ const _req = ensureRawRequest(req);
+
+ if (_req?.info?.remotePort && _req?.info?.remoteAddress) {
+ // see https://git.io/vytQ7
+ extendCommaList(headers, 'x-forwarded-for', _req.info.remoteAddress);
+ extendCommaList(headers, 'x-forwarded-port', _req.info.remotePort);
+ extendCommaList(headers, 'x-forwarded-proto', _req.server.info.protocol);
+ extendCommaList(headers, 'x-forwarded-host', _req.info.host);
+ }
+
+ const contentType = req.headers['content-type'];
+ if (contentType) {
+ headers['content-type'] = contentType;
+ }
+ return headers;
+}
+
+export const createHandler = ({
+ log,
+ readLegacyESConfig,
+ pathFilters,
+ proxyConfigCollection,
+}: CreateHandlerDependencies): RequestHandler => async (
+ ctx,
+ request,
+ response
+) => {
+ const { body, query } = request;
+ const { path, method } = query;
+
+ if (!pathFilters.some(re => re.test(path))) {
+ return response.forbidden({
+ body: `Error connecting to '${path}':\n\nUnable to send requests to that path.`,
+ headers: {
+ 'Content-Type': 'text/plain',
+ },
+ });
+ }
+
+ const legacyConfig = readLegacyESConfig();
+ const { hosts } = legacyConfig;
+ let esIncomingMessage: IncomingMessage;
+
+ for (let idx = 0; idx < hosts.length; ++idx) {
+ const host = hosts[idx];
+ try {
+ const uri = toURL(host, path);
+
+ // Because this can technically be provided by a settings-defined proxy config, we need to
+ // preserve these property names to maintain BWC.
+ const { timeout, agent, headers, rejectUnauthorized } = getRequestConfig(
+ request.headers,
+ legacyConfig,
+ proxyConfigCollection,
+ uri.toString()
+ );
+
+ const requestHeaders = {
+ ...headers,
+ ...getProxyHeaders(request),
+ };
+
+ esIncomingMessage = await proxyRequest({
+ method: method.toLowerCase() as any,
+ headers: requestHeaders,
+ uri,
+ timeout,
+ payload: body,
+ rejectUnauthorized,
+ agent,
+ });
+
+ break;
+ } catch (e) {
+ log.error(e);
+ if (e.code !== 'ECONNREFUSED') {
+ return response.internalError(e);
+ }
+ if (idx === hosts.length - 1) {
+ log.warn(`Could not connect to any configured ES node [${hosts.join(', ')}]`);
+ return response.customError({
+ statusCode: 502,
+ body: e,
+ });
+ }
+ // Otherwise, try the next host...
+ }
+ }
+
+ const {
+ statusCode,
+ statusMessage,
+ headers: { warning },
+ } = esIncomingMessage!;
+
+ if (method.toUpperCase() !== 'HEAD') {
+ return response.custom({
+ statusCode: statusCode!,
+ body: esIncomingMessage!,
+ headers: {
+ warning: warning || '',
+ },
+ });
+ }
+
+ return response.custom({
+ statusCode: statusCode!,
+ body: `${statusCode} - ${statusMessage}`,
+ headers: {
+ warning: warning || '',
+ 'Content-Type': 'text/plain',
+ },
+ });
+};
diff --git a/src/legacy/core_plugins/vis_type_timeseries/server/routes/fields.js b/src/plugins/console/server/routes/api/console/proxy/index.ts
similarity index 57%
rename from src/legacy/core_plugins/vis_type_timeseries/server/routes/fields.js
rename to src/plugins/console/server/routes/api/console/proxy/index.ts
index d984868afb0b0..5f7df1d7cf66b 100644
--- a/src/legacy/core_plugins/vis_type_timeseries/server/routes/fields.js
+++ b/src/plugins/console/server/routes/api/console/proxy/index.ts
@@ -17,26 +17,28 @@
* under the License.
*/
-import { getFields } from '../lib/get_fields';
-import { getIndexPatternService } from '../lib/get_index_pattern_service';
+import { IRouter } from 'kibana/server';
+import { routeValidationConfig } from './validation_config';
+import { createHandler, CreateHandlerDependencies } from './create_handler';
-export const fieldsRoutes = server => {
- server.route({
- config: {
- pre: [getIndexPatternService],
+export const registerProxyRoute = (
+ deps: {
+ router: IRouter;
+ } & CreateHandlerDependencies
+) => {
+ const { router, ...handlerDeps } = deps;
+ router.post(
+ {
+ path: '/api/console/proxy',
+ options: {
+ tags: ['access:console'],
+ body: {
+ output: 'stream',
+ parse: false,
+ },
+ },
+ validate: routeValidationConfig,
},
- path: '/api/metrics/fields',
- method: 'GET',
- handler: async req => {
- try {
- return await getFields(req);
- } catch (err) {
- if (err.isBoom && err.status === 401) {
- return err;
- }
-
- return [];
- }
- },
- });
+ createHandler(handlerDeps)
+ );
};
diff --git a/src/plugins/console/server/routes/api/console/proxy/validation_config.ts b/src/plugins/console/server/routes/api/console/proxy/validation_config.ts
new file mode 100644
index 0000000000000..f2372e9ee80d0
--- /dev/null
+++ b/src/plugins/console/server/routes/api/console/proxy/validation_config.ts
@@ -0,0 +1,44 @@
+/*
+ * Licensed to Elasticsearch B.V. under one or more contributor
+ * license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright
+ * ownership. Elasticsearch B.V. licenses this file to you under
+ * the Apache License, Version 2.0 (the "License"); you may
+ * not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+import { schema, TypeOf } from '@kbn/config-schema';
+
+export type Query = TypeOf;
+export type Body = TypeOf;
+
+const acceptedHttpVerb = schema.string({
+ validate: method => {
+ return ['HEAD', 'GET', 'POST', 'PUT', 'DELETE'].some(
+ verb => verb.toLowerCase() === method.toLowerCase()
+ )
+ ? undefined
+ : `Method must be one of, case insensitive ['HEAD', 'GET', 'POST', 'PUT', 'DELETE']. Received '${method}'.`;
+ },
+});
+
+const nonEmptyString = schema.string({
+ validate: s => (s === '' ? 'Expected non-empty string' : undefined),
+});
+
+export const routeValidationConfig = {
+ query: schema.object({
+ method: acceptedHttpVerb,
+ path: nonEmptyString,
+ }),
+ body: schema.stream(),
+};
diff --git a/src/plugins/console/server/routes/api/console/spec_definitions/index.ts b/src/plugins/console/server/routes/api/console/spec_definitions/index.ts
new file mode 100644
index 0000000000000..e2ece37f407ac
--- /dev/null
+++ b/src/plugins/console/server/routes/api/console/spec_definitions/index.ts
@@ -0,0 +1,48 @@
+/*
+ * Licensed to Elasticsearch B.V. under one or more contributor
+ * license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright
+ * ownership. Elasticsearch B.V. licenses this file to you under
+ * the Apache License, Version 2.0 (the "License"); you may
+ * not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+import { schema, TypeOf } from '@kbn/config-schema';
+import { IRouter, RequestHandler } from 'kibana/server';
+import { resolveApi } from '../../../../lib/spec_definitions';
+
+export const registerSpecDefinitionsRoute = ({ router }: { router: IRouter }) => {
+ const handler: RequestHandler> = async (
+ ctx,
+ request,
+ response
+ ) => {
+ const { sense_version: version, apis } = request.query;
+
+ return response.ok({
+ body: resolveApi(version, apis.split(',')),
+ headers: {
+ 'Content-Type': 'application/json',
+ },
+ });
+ };
+
+ const validate = {
+ query: schema.object({
+ sense_version: schema.string({ defaultValue: '' }),
+ apis: schema.string(),
+ }),
+ };
+
+ router.get({ path: '/api/console/api_server', validate }, handler);
+ router.post({ path: '/api/console/api_server', validate }, handler);
+};
diff --git a/src/plugins/console/server/types.ts b/src/plugins/console/server/types.ts
new file mode 100644
index 0000000000000..60ce56ad39fcd
--- /dev/null
+++ b/src/plugins/console/server/types.ts
@@ -0,0 +1,34 @@
+/*
+ * Licensed to Elasticsearch B.V. under one or more contributor
+ * license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright
+ * ownership. Elasticsearch B.V. licenses this file to you under
+ * the Apache License, Version 2.0 (the "License"); you may
+ * not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import { Duration } from 'moment';
+import { ConsoleServerPlugin } from './plugin';
+
+/** @public */
+export type ConsoleSetup = ReturnType extends Promise
+ ? U
+ : ReturnType;
+
+/** @internal */
+export interface ESConfigForProxy {
+ hosts: string[];
+ requestHeadersWhitelist: string[];
+ customHeaders: Record;
+ requestTimeout: Duration;
+}
diff --git a/src/plugins/data/public/search/index.ts b/src/plugins/data/public/search/index.ts
index cf7e0268d745a..9d6e5072d657f 100644
--- a/src/plugins/data/public/search/index.ts
+++ b/src/plugins/data/public/search/index.ts
@@ -47,6 +47,8 @@ export {
hasSearchStategyForIndexPattern,
defaultSearchStrategy,
SearchError,
+ SearchStrategyProvider,
+ getSearchErrorType,
} from './search_strategy';
export {
diff --git a/src/plugins/data/public/ui/filter_bar/filter_bar.tsx b/src/plugins/data/public/ui/filter_bar/filter_bar.tsx
index 2f1b1f8588eb9..2aaceddd68f0c 100644
--- a/src/plugins/data/public/ui/filter_bar/filter_bar.tsx
+++ b/src/plugins/data/public/ui/filter_bar/filter_bar.tsx
@@ -96,6 +96,7 @@ function FilterBarUI(props: Props) {
withTitle
panelPaddingSize="none"
ownFocus={true}
+ initialFocus=".filterEditor__hiddenItem"
>
diff --git a/src/plugins/data/public/ui/filter_bar/filter_editor/index.tsx b/src/plugins/data/public/ui/filter_bar/filter_editor/index.tsx
index b058d231b8306..b83c3a8e905dc 100644
--- a/src/plugins/data/public/ui/filter_bar/filter_editor/index.tsx
+++ b/src/plugins/data/public/ui/filter_bar/filter_editor/index.tsx
@@ -95,6 +95,7 @@ class FilterEditorUI extends Component
{
defaultMessage="Edit filter"
/>
+
{this.state.isCustomEditorOpen ? (
diff --git a/src/legacy/core_plugins/vis_type_timeseries/common/__snapshots__/model_options.test.js.snap b/src/plugins/vis_type_timeseries/common/__snapshots__/model_options.test.js.snap
similarity index 100%
rename from src/legacy/core_plugins/vis_type_timeseries/common/__snapshots__/model_options.test.js.snap
rename to src/plugins/vis_type_timeseries/common/__snapshots__/model_options.test.js.snap
diff --git a/src/legacy/core_plugins/vis_type_timeseries/common/agg_lookup.js b/src/plugins/vis_type_timeseries/common/agg_lookup.js
similarity index 100%
rename from src/legacy/core_plugins/vis_type_timeseries/common/agg_lookup.js
rename to src/plugins/vis_type_timeseries/common/agg_lookup.js
diff --git a/src/legacy/core_plugins/vis_type_timeseries/common/agg_lookup.test.js b/src/plugins/vis_type_timeseries/common/agg_lookup.test.js
similarity index 100%
rename from src/legacy/core_plugins/vis_type_timeseries/common/agg_lookup.test.js
rename to src/plugins/vis_type_timeseries/common/agg_lookup.test.js
diff --git a/src/legacy/core_plugins/vis_type_timeseries/common/basic_aggs.js b/src/plugins/vis_type_timeseries/common/basic_aggs.js
similarity index 100%
rename from src/legacy/core_plugins/vis_type_timeseries/common/basic_aggs.js
rename to src/plugins/vis_type_timeseries/common/basic_aggs.js
diff --git a/src/legacy/core_plugins/vis_type_timeseries/common/calculate_label.js b/src/plugins/vis_type_timeseries/common/calculate_label.js
similarity index 100%
rename from src/legacy/core_plugins/vis_type_timeseries/common/calculate_label.js
rename to src/plugins/vis_type_timeseries/common/calculate_label.js
diff --git a/src/legacy/core_plugins/vis_type_timeseries/common/calculate_label.test.js b/src/plugins/vis_type_timeseries/common/calculate_label.test.js
similarity index 100%
rename from src/legacy/core_plugins/vis_type_timeseries/common/calculate_label.test.js
rename to src/plugins/vis_type_timeseries/common/calculate_label.test.js
diff --git a/src/legacy/core_plugins/vis_type_timeseries/common/extract_index_patterns.js b/src/plugins/vis_type_timeseries/common/extract_index_patterns.js
similarity index 100%
rename from src/legacy/core_plugins/vis_type_timeseries/common/extract_index_patterns.js
rename to src/plugins/vis_type_timeseries/common/extract_index_patterns.js
diff --git a/src/legacy/core_plugins/vis_type_timeseries/common/extract_index_patterns.test.js b/src/plugins/vis_type_timeseries/common/extract_index_patterns.test.js
similarity index 100%
rename from src/legacy/core_plugins/vis_type_timeseries/common/extract_index_patterns.test.js
rename to src/plugins/vis_type_timeseries/common/extract_index_patterns.test.js
diff --git a/src/legacy/core_plugins/vis_type_timeseries/common/field_types.js b/src/plugins/vis_type_timeseries/common/field_types.js
similarity index 100%
rename from src/legacy/core_plugins/vis_type_timeseries/common/field_types.js
rename to src/plugins/vis_type_timeseries/common/field_types.js
diff --git a/src/legacy/core_plugins/vis_type_timeseries/common/get_last_value.js b/src/plugins/vis_type_timeseries/common/get_last_value.js
similarity index 100%
rename from src/legacy/core_plugins/vis_type_timeseries/common/get_last_value.js
rename to src/plugins/vis_type_timeseries/common/get_last_value.js
diff --git a/src/legacy/core_plugins/vis_type_timeseries/common/get_last_value.test.js b/src/plugins/vis_type_timeseries/common/get_last_value.test.js
similarity index 100%
rename from src/legacy/core_plugins/vis_type_timeseries/common/get_last_value.test.js
rename to src/plugins/vis_type_timeseries/common/get_last_value.test.js
diff --git a/src/legacy/core_plugins/vis_type_timeseries/common/interval_regexp.js b/src/plugins/vis_type_timeseries/common/interval_regexp.js
similarity index 100%
rename from src/legacy/core_plugins/vis_type_timeseries/common/interval_regexp.js
rename to src/plugins/vis_type_timeseries/common/interval_regexp.js
diff --git a/src/legacy/core_plugins/vis_type_timeseries/common/interval_regexp.test.js b/src/plugins/vis_type_timeseries/common/interval_regexp.test.js
similarity index 100%
rename from src/legacy/core_plugins/vis_type_timeseries/common/interval_regexp.test.js
rename to src/plugins/vis_type_timeseries/common/interval_regexp.test.js
diff --git a/src/legacy/core_plugins/vis_type_timeseries/common/metric_types.js b/src/plugins/vis_type_timeseries/common/metric_types.js
similarity index 100%
rename from src/legacy/core_plugins/vis_type_timeseries/common/metric_types.js
rename to src/plugins/vis_type_timeseries/common/metric_types.js
diff --git a/src/legacy/core_plugins/vis_type_timeseries/common/model_options.js b/src/plugins/vis_type_timeseries/common/model_options.js
similarity index 100%
rename from src/legacy/core_plugins/vis_type_timeseries/common/model_options.js
rename to src/plugins/vis_type_timeseries/common/model_options.js
diff --git a/src/legacy/core_plugins/vis_type_timeseries/common/model_options.test.js b/src/plugins/vis_type_timeseries/common/model_options.test.js
similarity index 100%
rename from src/legacy/core_plugins/vis_type_timeseries/common/model_options.test.js
rename to src/plugins/vis_type_timeseries/common/model_options.test.js
diff --git a/src/legacy/core_plugins/vis_type_timeseries/common/panel_types.js b/src/plugins/vis_type_timeseries/common/panel_types.js
similarity index 100%
rename from src/legacy/core_plugins/vis_type_timeseries/common/panel_types.js
rename to src/plugins/vis_type_timeseries/common/panel_types.js
diff --git a/src/legacy/core_plugins/vis_type_timeseries/common/timerange_data_modes.js b/src/plugins/vis_type_timeseries/common/timerange_data_modes.js
similarity index 100%
rename from src/legacy/core_plugins/vis_type_timeseries/common/timerange_data_modes.js
rename to src/plugins/vis_type_timeseries/common/timerange_data_modes.js
diff --git a/src/legacy/core_plugins/vis_type_timeseries/common/to_percentile_number.js b/src/plugins/vis_type_timeseries/common/to_percentile_number.js
similarity index 100%
rename from src/legacy/core_plugins/vis_type_timeseries/common/to_percentile_number.js
rename to src/plugins/vis_type_timeseries/common/to_percentile_number.js
diff --git a/src/legacy/core_plugins/vis_type_timeseries/common/ui_restrictions.js b/src/plugins/vis_type_timeseries/common/ui_restrictions.js
similarity index 100%
rename from src/legacy/core_plugins/vis_type_timeseries/common/ui_restrictions.js
rename to src/plugins/vis_type_timeseries/common/ui_restrictions.js
diff --git a/src/plugins/vis_type_timeseries/server/index.ts b/src/plugins/vis_type_timeseries/server/index.ts
index dfb2394af237b..fa74b6e965971 100644
--- a/src/plugins/vis_type_timeseries/server/index.ts
+++ b/src/plugins/vis_type_timeseries/server/index.ts
@@ -32,6 +32,13 @@ export type VisTypeTimeseriesConfig = TypeOf;
export { ValidationTelemetryServiceSetup } from './validation_telemetry';
+// @ts-ignore
+export { AbstractSearchStrategy } from './lib/search_strategies/strategies/abstract_search_strategy';
+// @ts-ignore
+export { AbstractSearchRequest } from './lib/search_strategies/search_requests/abstract_request';
+// @ts-ignore
+export { DefaultSearchCapabilities } from './lib/search_strategies/default_search_capabilities';
+
export function plugin(initializerContext: PluginInitializerContext) {
return new VisTypeTimeseriesPlugin(initializerContext);
}
diff --git a/src/plugins/vis_type_timeseries/server/lib/get_fields.ts b/src/plugins/vis_type_timeseries/server/lib/get_fields.ts
new file mode 100644
index 0000000000000..8eca30dae7773
--- /dev/null
+++ b/src/plugins/vis_type_timeseries/server/lib/get_fields.ts
@@ -0,0 +1,89 @@
+/*
+ * Licensed to Elasticsearch B.V. under one or more contributor
+ * license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright
+ * ownership. Elasticsearch B.V. licenses this file to you under
+ * the Apache License, Version 2.0 (the "License"); you may
+ * not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+import { uniq } from 'lodash';
+import { first, map } from 'rxjs/operators';
+import { KibanaRequest, RequestHandlerContext } from 'kibana/server';
+
+// @ts-ignore
+import { getIndexPatternObject } from './vis_data/helpers/get_index_pattern';
+import { isNestedField } from '../../../data/server';
+import { Framework } from '../plugin';
+import { FieldDescriptor, IndexPatternsFetcher } from '../../../data/server';
+import { ReqFacade } from './search_strategies/strategies/abstract_search_strategy';
+
+export async function getFields(
+ requestContext: RequestHandlerContext,
+ request: KibanaRequest,
+ framework: Framework,
+ indexPattern: string
+) {
+ // NOTE / TODO: This facade has been put in place to make migrating to the New Platform easier. It
+ // removes the need to refactor many layers of dependencies on "req", and instead just augments the top
+ // level object passed from here. The layers should be refactored fully at some point, but for now
+ // this works and we are still using the New Platform services for these vis data portions.
+ const reqFacade: ReqFacade = {
+ ...request,
+ framework,
+ payload: {},
+ pre: {
+ indexPatternsService: new IndexPatternsFetcher(
+ requestContext.core.elasticsearch.dataClient.callAsCurrentUser
+ ),
+ },
+ getUiSettingsService: () => requestContext.core.uiSettings.client,
+ getSavedObjectsClient: () => requestContext.core.savedObjects.client,
+ server: {
+ plugins: {
+ elasticsearch: {
+ getCluster: () => {
+ return {
+ callWithRequest: async (req: any, endpoint: string, params: any) => {
+ return await requestContext.core.elasticsearch.dataClient.callAsCurrentUser(
+ endpoint,
+ params
+ );
+ },
+ };
+ },
+ },
+ },
+ },
+ getEsShardTimeout: async () => {
+ return await framework.globalConfig$
+ .pipe(
+ first(),
+ map(config => config.elasticsearch.shardTimeout.asMilliseconds())
+ )
+ .toPromise();
+ },
+ };
+ const { indexPatternString } = await getIndexPatternObject(reqFacade, indexPattern);
+ const {
+ searchStrategy,
+ capabilities,
+ } = (await framework.searchStrategyRegistry.getViableStrategy(reqFacade, indexPatternString))!;
+
+ const fields = ((await searchStrategy.getFieldsForWildcard(
+ reqFacade,
+ indexPatternString,
+ capabilities
+ )) as FieldDescriptor[]).filter(field => field.aggregatable && !isNestedField(field));
+
+ return uniq(fields, field => field.name);
+}
diff --git a/src/legacy/core_plugins/vis_type_timeseries/server/lib/get_vis_data.ts b/src/plugins/vis_type_timeseries/server/lib/get_vis_data.ts
similarity index 87%
rename from src/legacy/core_plugins/vis_type_timeseries/server/lib/get_vis_data.ts
rename to src/plugins/vis_type_timeseries/server/lib/get_vis_data.ts
index 58e624fa13442..aef831eaad430 100644
--- a/src/legacy/core_plugins/vis_type_timeseries/server/lib/get_vis_data.ts
+++ b/src/plugins/vis_type_timeseries/server/lib/get_vis_data.ts
@@ -17,11 +17,12 @@
* under the License.
*/
-import { RequestHandlerContext } from 'src/core/server';
+import { FakeRequest, RequestHandlerContext } from 'kibana/server';
import _ from 'lodash';
import { first, map } from 'rxjs/operators';
import { getPanelData } from './vis_data/get_panel_data';
-import { Framework } from '../../../../../plugins/vis_type_timeseries/server';
+import { Framework } from '../index';
+import { ReqFacade } from './search_strategies/strategies/abstract_search_strategy';
interface GetVisDataResponse {
[key: string]: GetVisDataPanel;
@@ -56,15 +57,18 @@ export type GetVisData = (
export function getVisData(
requestContext: RequestHandlerContext,
- options: GetVisDataOptions,
+ request: FakeRequest & { body: GetVisDataOptions },
framework: Framework
): Promise {
// NOTE / TODO: This facade has been put in place to make migrating to the New Platform easier. It
// removes the need to refactor many layers of dependencies on "req", and instead just augments the top
// level object passed from here. The layers should be refactored fully at some point, but for now
// this works and we are still using the New Platform services for these vis data portions.
- const reqFacade: any = {
- payload: options,
+ const reqFacade: ReqFacade = {
+ ...request,
+ framework,
+ pre: {},
+ payload: request.body,
getUiSettingsService: () => requestContext.core.uiSettings.client,
getSavedObjectsClient: () => requestContext.core.savedObjects.client,
server: {
@@ -92,7 +96,7 @@ export function getVisData(
.toPromise();
},
};
- const promises = reqFacade.payload.panels.map(getPanelData(reqFacade));
+ const promises = (reqFacade.payload as GetVisDataOptions).panels.map(getPanelData(reqFacade));
return Promise.all(promises).then(res => {
return res.reduce((acc, data) => {
return _.assign(acc as any, data);
diff --git a/src/legacy/core_plugins/vis_type_timeseries/server/lib/search_strategies/default_search_capabilities.js b/src/plugins/vis_type_timeseries/server/lib/search_strategies/default_search_capabilities.js
similarity index 100%
rename from src/legacy/core_plugins/vis_type_timeseries/server/lib/search_strategies/default_search_capabilities.js
rename to src/plugins/vis_type_timeseries/server/lib/search_strategies/default_search_capabilities.js
diff --git a/src/legacy/core_plugins/vis_type_timeseries/server/lib/search_strategies/default_search_capabilities.test.js b/src/plugins/vis_type_timeseries/server/lib/search_strategies/default_search_capabilities.test.js
similarity index 100%
rename from src/legacy/core_plugins/vis_type_timeseries/server/lib/search_strategies/default_search_capabilities.test.js
rename to src/plugins/vis_type_timeseries/server/lib/search_strategies/default_search_capabilities.test.js
diff --git a/src/legacy/core_plugins/vis_type_timeseries/server/index.ts b/src/plugins/vis_type_timeseries/server/lib/search_strategies/index.ts
similarity index 87%
rename from src/legacy/core_plugins/vis_type_timeseries/server/index.ts
rename to src/plugins/vis_type_timeseries/server/lib/search_strategies/index.ts
index c010628ca04bf..d53683882252b 100644
--- a/src/legacy/core_plugins/vis_type_timeseries/server/index.ts
+++ b/src/plugins/vis_type_timeseries/server/lib/search_strategies/index.ts
@@ -17,5 +17,4 @@
* under the License.
*/
-export { init } from './init';
-export { getVisData, GetVisData, GetVisDataOptions } from './lib/get_vis_data';
+export { SearchStrategyRegistry } from './search_strategy_registry';
diff --git a/src/legacy/core_plugins/vis_type_timeseries/server/lib/search_strategies/searh_requests/abstract_request.js b/src/plugins/vis_type_timeseries/server/lib/search_strategies/search_requests/abstract_request.js
similarity index 100%
rename from src/legacy/core_plugins/vis_type_timeseries/server/lib/search_strategies/searh_requests/abstract_request.js
rename to src/plugins/vis_type_timeseries/server/lib/search_strategies/search_requests/abstract_request.js
diff --git a/src/legacy/core_plugins/vis_type_timeseries/server/lib/search_strategies/searh_requests/abstract_request.test.js b/src/plugins/vis_type_timeseries/server/lib/search_strategies/search_requests/abstract_request.test.js
similarity index 100%
rename from src/legacy/core_plugins/vis_type_timeseries/server/lib/search_strategies/searh_requests/abstract_request.test.js
rename to src/plugins/vis_type_timeseries/server/lib/search_strategies/search_requests/abstract_request.test.js
diff --git a/src/legacy/core_plugins/vis_type_timeseries/server/lib/search_strategies/searh_requests/multi_search_request.js b/src/plugins/vis_type_timeseries/server/lib/search_strategies/search_requests/multi_search_request.js
similarity index 100%
rename from src/legacy/core_plugins/vis_type_timeseries/server/lib/search_strategies/searh_requests/multi_search_request.js
rename to src/plugins/vis_type_timeseries/server/lib/search_strategies/search_requests/multi_search_request.js
diff --git a/src/legacy/core_plugins/vis_type_timeseries/server/lib/search_strategies/searh_requests/multi_search_request.test.js b/src/plugins/vis_type_timeseries/server/lib/search_strategies/search_requests/multi_search_request.test.js
similarity index 100%
rename from src/legacy/core_plugins/vis_type_timeseries/server/lib/search_strategies/searh_requests/multi_search_request.test.js
rename to src/plugins/vis_type_timeseries/server/lib/search_strategies/search_requests/multi_search_request.test.js
diff --git a/src/legacy/core_plugins/vis_type_timeseries/server/lib/search_strategies/searh_requests/search_request.js b/src/plugins/vis_type_timeseries/server/lib/search_strategies/search_requests/search_request.js
similarity index 100%
rename from src/legacy/core_plugins/vis_type_timeseries/server/lib/search_strategies/searh_requests/search_request.js
rename to src/plugins/vis_type_timeseries/server/lib/search_strategies/search_requests/search_request.js
diff --git a/src/legacy/core_plugins/vis_type_timeseries/server/lib/search_strategies/searh_requests/search_request.test.js b/src/plugins/vis_type_timeseries/server/lib/search_strategies/search_requests/search_request.test.js
similarity index 100%
rename from src/legacy/core_plugins/vis_type_timeseries/server/lib/search_strategies/searh_requests/search_request.test.js
rename to src/plugins/vis_type_timeseries/server/lib/search_strategies/search_requests/search_request.test.js
diff --git a/src/legacy/core_plugins/vis_type_timeseries/server/lib/search_strategies/searh_requests/single_search_request.js b/src/plugins/vis_type_timeseries/server/lib/search_strategies/search_requests/single_search_request.js
similarity index 100%
rename from src/legacy/core_plugins/vis_type_timeseries/server/lib/search_strategies/searh_requests/single_search_request.js
rename to src/plugins/vis_type_timeseries/server/lib/search_strategies/search_requests/single_search_request.js
diff --git a/src/legacy/core_plugins/vis_type_timeseries/server/lib/search_strategies/searh_requests/single_search_request.test.js b/src/plugins/vis_type_timeseries/server/lib/search_strategies/search_requests/single_search_request.test.js
similarity index 100%
rename from src/legacy/core_plugins/vis_type_timeseries/server/lib/search_strategies/searh_requests/single_search_request.test.js
rename to src/plugins/vis_type_timeseries/server/lib/search_strategies/search_requests/single_search_request.test.js
diff --git a/src/legacy/core_plugins/vis_type_timeseries/server/lib/search_strategies/search_strategies_register.test.js b/src/plugins/vis_type_timeseries/server/lib/search_strategies/search_strategies_registry.test.ts
similarity index 61%
rename from src/legacy/core_plugins/vis_type_timeseries/server/lib/search_strategies/search_strategies_register.test.js
rename to src/plugins/vis_type_timeseries/server/lib/search_strategies/search_strategies_registry.test.ts
index e03d776b8ee0c..ecd09653b3b48 100644
--- a/src/legacy/core_plugins/vis_type_timeseries/server/lib/search_strategies/search_strategies_register.test.js
+++ b/src/plugins/vis_type_timeseries/server/lib/search_strategies/search_strategies_registry.test.ts
@@ -16,10 +16,13 @@
* specific language governing permissions and limitations
* under the License.
*/
-import { SearchStrategiesRegister } from './search_strategies_register';
+
+import { SearchStrategyRegistry } from './search_strategy_registry';
+// @ts-ignore
import { AbstractSearchStrategy } from './strategies/abstract_search_strategy';
+// @ts-ignore
import { DefaultSearchStrategy } from './strategies/default_search_strategy';
-import { AbstractSearchRequest } from './searh_requests/abstract_request';
+// @ts-ignore
import { DefaultSearchCapabilities } from './default_search_capabilities';
class MockSearchStrategy extends AbstractSearchStrategy {
@@ -31,34 +34,21 @@ class MockSearchStrategy extends AbstractSearchStrategy {
}
}
-describe('SearchStrategiesRegister', () => {
- let server;
- let strategies;
- let anotherSearchStrategy;
+describe('SearchStrategyRegister', () => {
+ let registry: SearchStrategyRegistry;
beforeAll(() => {
- server = {
- expose: jest.fn((strategy, func) => {
- server[strategy] = func;
- }),
- };
- strategies = [
- ['AbstractSearchStrategy', AbstractSearchStrategy],
- ['AbstractSearchRequest', AbstractSearchRequest],
- ['DefaultSearchCapabilities', DefaultSearchCapabilities],
- ['addSearchStrategy', expect.any(Function)],
- ];
-
- SearchStrategiesRegister.init(server);
+ registry = new SearchStrategyRegistry();
});
test('should init strategies register', () => {
- expect(server.expose.mock.calls).toEqual(strategies);
- expect(server.addSearchStrategy()[0] instanceof DefaultSearchStrategy).toBe(true);
+ expect(
+ registry.addStrategy({} as AbstractSearchStrategy)[0] instanceof DefaultSearchStrategy
+ ).toBe(true);
});
test('should not add a strategy if it is not an instance of AbstractSearchStrategy', () => {
- const addedStrategies = server.addSearchStrategy({});
+ const addedStrategies = registry.addStrategy({} as AbstractSearchStrategy);
expect(addedStrategies.length).toEqual(1);
expect(addedStrategies[0] instanceof DefaultSearchStrategy).toBe(true);
@@ -68,18 +58,15 @@ describe('SearchStrategiesRegister', () => {
const req = {};
const indexPattern = '*';
- const { searchStrategy, capabilities } = await SearchStrategiesRegister.getViableStrategy(
- req,
- indexPattern
- );
+ const { searchStrategy, capabilities } = (await registry.getViableStrategy(req, indexPattern))!;
expect(searchStrategy instanceof DefaultSearchStrategy).toBe(true);
expect(capabilities instanceof DefaultSearchCapabilities).toBe(true);
});
test('should add a strategy if it is an instance of AbstractSearchStrategy', () => {
- anotherSearchStrategy = new MockSearchStrategy();
- const addedStrategies = server.addSearchStrategy(anotherSearchStrategy);
+ const anotherSearchStrategy = new MockSearchStrategy({}, {} as any, {});
+ const addedStrategies = registry.addStrategy(anotherSearchStrategy);
expect(addedStrategies.length).toEqual(2);
expect(addedStrategies[0] instanceof AbstractSearchStrategy).toBe(true);
@@ -88,13 +75,12 @@ describe('SearchStrategiesRegister', () => {
test('should return a MockSearchStrategy instance', async () => {
const req = {};
const indexPattern = '*';
+ const anotherSearchStrategy = new MockSearchStrategy({}, {} as any, {});
+ registry.addStrategy(anotherSearchStrategy);
- const { searchStrategy, capabilities } = await SearchStrategiesRegister.getViableStrategy(
- req,
- indexPattern
- );
+ const { searchStrategy, capabilities } = (await registry.getViableStrategy(req, indexPattern))!;
- expect(searchStrategy instanceof AbstractSearchStrategy).toBe(true);
+ expect(searchStrategy instanceof MockSearchStrategy).toBe(true);
expect(capabilities).toEqual({});
});
});
diff --git a/src/legacy/core_plugins/vis_type_timeseries/server/lib/search_strategies/search_strategies_register.js b/src/plugins/vis_type_timeseries/server/lib/search_strategies/search_strategy_registry.ts
similarity index 57%
rename from src/legacy/core_plugins/vis_type_timeseries/server/lib/search_strategies/search_strategies_register.js
rename to src/plugins/vis_type_timeseries/server/lib/search_strategies/search_strategy_registry.ts
index 5fbb4060862a4..6fbed1ddfba0f 100644
--- a/src/legacy/core_plugins/vis_type_timeseries/server/lib/search_strategies/search_strategies_register.js
+++ b/src/plugins/vis_type_timeseries/server/lib/search_strategies/search_strategy_registry.ts
@@ -16,34 +16,32 @@
* specific language governing permissions and limitations
* under the License.
*/
+
import { AbstractSearchStrategy } from './strategies/abstract_search_strategy';
-import { AbstractSearchRequest } from './searh_requests/abstract_request';
+// @ts-ignore
import { DefaultSearchStrategy } from './strategies/default_search_strategy';
-import { DefaultSearchCapabilities } from './default_search_capabilities';
-
+// @ts-ignore
import { extractIndexPatterns } from '../../../common/extract_index_patterns';
-const strategies = [];
+export type RequestFacade = any;
+export type Panel = any;
-const addStrategy = searchStrategy => {
- if (searchStrategy instanceof AbstractSearchStrategy) {
- strategies.unshift(searchStrategy);
- }
- return strategies;
-};
+export class SearchStrategyRegistry {
+ private strategies: AbstractSearchStrategy[] = [];
-export class SearchStrategiesRegister {
- static init(server) {
- server.expose('AbstractSearchStrategy', AbstractSearchStrategy);
- server.expose('AbstractSearchRequest', AbstractSearchRequest);
- server.expose('DefaultSearchCapabilities', DefaultSearchCapabilities);
- server.expose('addSearchStrategy', searchStrategy => addStrategy(searchStrategy));
+ constructor() {
+ this.addStrategy(new DefaultSearchStrategy());
+ }
- addStrategy(new DefaultSearchStrategy(server));
+ public addStrategy(searchStrategy: AbstractSearchStrategy) {
+ if (searchStrategy instanceof AbstractSearchStrategy) {
+ this.strategies.unshift(searchStrategy);
+ }
+ return this.strategies;
}
- static async getViableStrategy(req, indexPattern) {
- for (const searchStrategy of strategies) {
+ async getViableStrategy(req: RequestFacade, indexPattern: string) {
+ for (const searchStrategy of this.strategies) {
const { isViable, capabilities } = await searchStrategy.checkForViability(req, indexPattern);
if (isViable) {
@@ -55,9 +53,9 @@ export class SearchStrategiesRegister {
}
}
- static async getViableStrategyForPanel(req, panel) {
+ async getViableStrategyForPanel(req: RequestFacade, panel: Panel) {
const indexPattern = extractIndexPatterns(panel).join(',');
- return SearchStrategiesRegister.getViableStrategy(req, indexPattern);
+ return this.getViableStrategy(req, indexPattern);
}
}
diff --git a/src/legacy/core_plugins/vis_type_timeseries/server/lib/search_strategies/strategies/abstract_search_strategy.test.js b/src/plugins/vis_type_timeseries/server/lib/search_strategies/strategies/abstract_search_strategy.test.js
similarity index 100%
rename from src/legacy/core_plugins/vis_type_timeseries/server/lib/search_strategies/strategies/abstract_search_strategy.test.js
rename to src/plugins/vis_type_timeseries/server/lib/search_strategies/strategies/abstract_search_strategy.test.js
diff --git a/src/plugins/vis_type_timeseries/server/lib/search_strategies/strategies/abstract_search_strategy.ts b/src/plugins/vis_type_timeseries/server/lib/search_strategies/strategies/abstract_search_strategy.ts
new file mode 100644
index 0000000000000..4fd4ac251fa3e
--- /dev/null
+++ b/src/plugins/vis_type_timeseries/server/lib/search_strategies/strategies/abstract_search_strategy.ts
@@ -0,0 +1,87 @@
+/*
+ * Licensed to Elasticsearch B.V. under one or more contributor
+ * license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright
+ * ownership. Elasticsearch B.V. licenses this file to you under
+ * the Apache License, Version 2.0 (the "License"); you may
+ * not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import {
+ APICaller,
+ FakeRequest,
+ IUiSettingsClient,
+ SavedObjectsClientContract,
+} from 'kibana/server';
+import { Framework } from '../../../plugin';
+import { IndexPatternsFetcher } from '../../../../../data/server';
+
+/**
+ * ReqFacade is a regular KibanaRequest object extended with additional service
+ * references to ensure backwards compatibility for existing integrations.
+ *
+ * This will be replaced by standard KibanaRequest and RequestContext objects in a later version.
+ */
+export type ReqFacade = FakeRequest & {
+ framework: Framework;
+ payload: unknown;
+ pre: {
+ indexPatternsService?: IndexPatternsFetcher;
+ };
+ getUiSettingsService: () => IUiSettingsClient;
+ getSavedObjectsClient: () => SavedObjectsClientContract;
+ server: {
+ plugins: {
+ elasticsearch: {
+ getCluster: () => {
+ callWithRequest: (req: ReqFacade, endpoint: string, params: any) => Promise;
+ };
+ };
+ };
+ };
+ getEsShardTimeout: () => Promise;
+};
+
+export class AbstractSearchStrategy {
+ public getCallWithRequestInstance: (req: ReqFacade) => APICaller;
+ public getSearchRequest: (req: ReqFacade) => any;
+
+ constructor(
+ server: any,
+ callWithRequestFactory: (server: any, req: ReqFacade) => APICaller,
+ SearchRequest: any
+ ) {
+ this.getCallWithRequestInstance = req => callWithRequestFactory(server, req);
+
+ this.getSearchRequest = req => {
+ const callWithRequest = this.getCallWithRequestInstance(req);
+
+ return new SearchRequest(req, callWithRequest);
+ };
+ }
+
+ async getFieldsForWildcard(req: ReqFacade, indexPattern: string, capabilities: any) {
+ const { indexPatternsService } = req.pre;
+
+ return await indexPatternsService!.getFieldsForWildcard({
+ pattern: indexPattern,
+ });
+ }
+
+ checkForViability(
+ req: ReqFacade,
+ indexPattern: string
+ ): { isViable: boolean; capabilities: any } {
+ throw new TypeError('Must override method');
+ }
+}
diff --git a/src/legacy/core_plugins/vis_type_timeseries/server/lib/search_strategies/strategies/default_search_strategy.js b/src/plugins/vis_type_timeseries/server/lib/search_strategies/strategies/default_search_strategy.js
similarity index 95%
rename from src/legacy/core_plugins/vis_type_timeseries/server/lib/search_strategies/strategies/default_search_strategy.js
rename to src/plugins/vis_type_timeseries/server/lib/search_strategies/strategies/default_search_strategy.js
index fba67f448e784..63f2911ce1118 100644
--- a/src/legacy/core_plugins/vis_type_timeseries/server/lib/search_strategies/strategies/default_search_strategy.js
+++ b/src/plugins/vis_type_timeseries/server/lib/search_strategies/strategies/default_search_strategy.js
@@ -17,7 +17,7 @@
* under the License.
*/
import { AbstractSearchStrategy } from './abstract_search_strategy';
-import { SearchRequest } from '../searh_requests/search_request';
+import { SearchRequest } from '../search_requests/search_request';
import { DefaultSearchCapabilities } from '../default_search_capabilities';
const callWithRequestFactory = (server, request) => {
diff --git a/src/legacy/core_plugins/vis_type_timeseries/server/lib/search_strategies/strategies/default_search_strategy.test.js b/src/plugins/vis_type_timeseries/server/lib/search_strategies/strategies/default_search_strategy.test.js
similarity index 100%
rename from src/legacy/core_plugins/vis_type_timeseries/server/lib/search_strategies/strategies/default_search_strategy.test.js
rename to src/plugins/vis_type_timeseries/server/lib/search_strategies/strategies/default_search_strategy.test.js
diff --git a/src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/annorations/build_request_body.js b/src/plugins/vis_type_timeseries/server/lib/vis_data/annotations/build_request_body.js
similarity index 100%
rename from src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/annorations/build_request_body.js
rename to src/plugins/vis_type_timeseries/server/lib/vis_data/annotations/build_request_body.js
diff --git a/src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/annorations/get_request_params.js b/src/plugins/vis_type_timeseries/server/lib/vis_data/annotations/get_request_params.js
similarity index 100%
rename from src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/annorations/get_request_params.js
rename to src/plugins/vis_type_timeseries/server/lib/vis_data/annotations/get_request_params.js
diff --git a/src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/build_processor_function.test.ts b/src/plugins/vis_type_timeseries/server/lib/vis_data/build_processor_function.test.ts
similarity index 100%
rename from src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/build_processor_function.test.ts
rename to src/plugins/vis_type_timeseries/server/lib/vis_data/build_processor_function.test.ts
diff --git a/src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/build_processor_function.ts b/src/plugins/vis_type_timeseries/server/lib/vis_data/build_processor_function.ts
similarity index 100%
rename from src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/build_processor_function.ts
rename to src/plugins/vis_type_timeseries/server/lib/vis_data/build_processor_function.ts
diff --git a/src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/get_annotations.js b/src/plugins/vis_type_timeseries/server/lib/vis_data/get_annotations.js
similarity index 96%
rename from src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/get_annotations.js
rename to src/plugins/vis_type_timeseries/server/lib/vis_data/get_annotations.js
index 898ff837d4a01..8b8c31912f168 100644
--- a/src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/get_annotations.js
+++ b/src/plugins/vis_type_timeseries/server/lib/vis_data/get_annotations.js
@@ -16,8 +16,8 @@
* specific language governing permissions and limitations
* under the License.
*/
-import { handleAnnotationResponse } from './response_processors/annotations/';
-import { getAnnotationRequestParams } from './annorations/get_request_params';
+import { handleAnnotationResponse } from './response_processors/annotations';
+import { getAnnotationRequestParams } from './annotations/get_request_params';
import { getLastSeriesTimestamp } from './helpers/timestamp';
function validAnnotation(annotation) {
diff --git a/src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/get_interval_and_timefield.js b/src/plugins/vis_type_timeseries/server/lib/vis_data/get_interval_and_timefield.js
similarity index 100%
rename from src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/get_interval_and_timefield.js
rename to src/plugins/vis_type_timeseries/server/lib/vis_data/get_interval_and_timefield.js
diff --git a/src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/get_interval_and_timefield.test.js b/src/plugins/vis_type_timeseries/server/lib/vis_data/get_interval_and_timefield.test.js
similarity index 100%
rename from src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/get_interval_and_timefield.test.js
rename to src/plugins/vis_type_timeseries/server/lib/vis_data/get_interval_and_timefield.test.js
diff --git a/src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/get_panel_data.d.ts b/src/plugins/vis_type_timeseries/server/lib/vis_data/get_panel_data.d.ts
similarity index 100%
rename from src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/get_panel_data.d.ts
rename to src/plugins/vis_type_timeseries/server/lib/vis_data/get_panel_data.d.ts
diff --git a/src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/get_panel_data.js b/src/plugins/vis_type_timeseries/server/lib/vis_data/get_panel_data.js
similarity index 100%
rename from src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/get_panel_data.js
rename to src/plugins/vis_type_timeseries/server/lib/vis_data/get_panel_data.js
diff --git a/src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/get_series_data.js b/src/plugins/vis_type_timeseries/server/lib/vis_data/get_series_data.js
similarity index 91%
rename from src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/get_series_data.js
rename to src/plugins/vis_type_timeseries/server/lib/vis_data/get_series_data.js
index b4eb9e6b108ff..1efeccb4b5701 100644
--- a/src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/get_series_data.js
+++ b/src/plugins/vis_type_timeseries/server/lib/vis_data/get_series_data.js
@@ -20,15 +20,14 @@ import { getSeriesRequestParams } from './series/get_request_params';
import { handleResponseBody } from './series/handle_response_body';
import { handleErrorResponse } from './handle_error_response';
import { getAnnotations } from './get_annotations';
-import { SearchStrategiesRegister } from '../search_strategies/search_strategies_register';
import { getEsQueryConfig } from './helpers/get_es_query_uisettings';
import { getActiveSeries } from './helpers/get_active_series';
export async function getSeriesData(req, panel) {
- const { searchStrategy, capabilities } = await SearchStrategiesRegister.getViableStrategyForPanel(
- req,
- panel
- );
+ const {
+ searchStrategy,
+ capabilities,
+ } = await req.framework.searchStrategyRegistry.getViableStrategyForPanel(req, panel);
const searchRequest = searchStrategy.getSearchRequest(req);
const esQueryConfig = await getEsQueryConfig(req);
const meta = {
diff --git a/src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/get_table_data.js b/src/plugins/vis_type_timeseries/server/lib/vis_data/get_table_data.js
similarity index 90%
rename from src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/get_table_data.js
rename to src/plugins/vis_type_timeseries/server/lib/vis_data/get_table_data.js
index 2c92692d2bd1f..1d1c245907959 100644
--- a/src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/get_table_data.js
+++ b/src/plugins/vis_type_timeseries/server/lib/vis_data/get_table_data.js
@@ -20,16 +20,16 @@ import { buildRequestBody } from './table/build_request_body';
import { handleErrorResponse } from './handle_error_response';
import { get } from 'lodash';
import { processBucket } from './table/process_bucket';
-import { SearchStrategiesRegister } from '../search_strategies/search_strategies_register';
import { getEsQueryConfig } from './helpers/get_es_query_uisettings';
import { getIndexPatternObject } from './helpers/get_index_pattern';
export async function getTableData(req, panel) {
const panelIndexPattern = panel.index_pattern;
- const { searchStrategy, capabilities } = await SearchStrategiesRegister.getViableStrategy(
- req,
- panelIndexPattern
- );
+
+ const {
+ searchStrategy,
+ capabilities,
+ } = await req.framework.searchStrategyRegistry.getViableStrategy(req, panelIndexPattern);
const searchRequest = searchStrategy.getSearchRequest(req);
const esQueryConfig = await getEsQueryConfig(req);
const { indexPatternObject } = await getIndexPatternObject(req, panelIndexPattern);
diff --git a/src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/handle_error_response.js b/src/plugins/vis_type_timeseries/server/lib/vis_data/handle_error_response.js
similarity index 100%
rename from src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/handle_error_response.js
rename to src/plugins/vis_type_timeseries/server/lib/vis_data/handle_error_response.js
diff --git a/src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/helpers/__snapshots__/bucket_transform.test.js.snap b/src/plugins/vis_type_timeseries/server/lib/vis_data/helpers/__snapshots__/bucket_transform.test.js.snap
similarity index 100%
rename from src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/helpers/__snapshots__/bucket_transform.test.js.snap
rename to src/plugins/vis_type_timeseries/server/lib/vis_data/helpers/__snapshots__/bucket_transform.test.js.snap
diff --git a/src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/helpers/bucket_transform.js b/src/plugins/vis_type_timeseries/server/lib/vis_data/helpers/bucket_transform.js
similarity index 100%
rename from src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/helpers/bucket_transform.js
rename to src/plugins/vis_type_timeseries/server/lib/vis_data/helpers/bucket_transform.js
diff --git a/src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/helpers/bucket_transform.test.js b/src/plugins/vis_type_timeseries/server/lib/vis_data/helpers/bucket_transform.test.js
similarity index 100%
rename from src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/helpers/bucket_transform.test.js
rename to src/plugins/vis_type_timeseries/server/lib/vis_data/helpers/bucket_transform.test.js
diff --git a/src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/helpers/calculate_auto.js b/src/plugins/vis_type_timeseries/server/lib/vis_data/helpers/calculate_auto.js
similarity index 100%
rename from src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/helpers/calculate_auto.js
rename to src/plugins/vis_type_timeseries/server/lib/vis_data/helpers/calculate_auto.js
diff --git a/src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/helpers/format_key.js b/src/plugins/vis_type_timeseries/server/lib/vis_data/helpers/format_key.js
similarity index 100%
rename from src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/helpers/format_key.js
rename to src/plugins/vis_type_timeseries/server/lib/vis_data/helpers/format_key.js
diff --git a/src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/helpers/get_active_series.js b/src/plugins/vis_type_timeseries/server/lib/vis_data/helpers/get_active_series.js
similarity index 100%
rename from src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/helpers/get_active_series.js
rename to src/plugins/vis_type_timeseries/server/lib/vis_data/helpers/get_active_series.js
diff --git a/src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/helpers/get_agg_value.js b/src/plugins/vis_type_timeseries/server/lib/vis_data/helpers/get_agg_value.js
similarity index 100%
rename from src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/helpers/get_agg_value.js
rename to src/plugins/vis_type_timeseries/server/lib/vis_data/helpers/get_agg_value.js
diff --git a/src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/helpers/get_agg_value.test.js b/src/plugins/vis_type_timeseries/server/lib/vis_data/helpers/get_agg_value.test.js
similarity index 100%
rename from src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/helpers/get_agg_value.test.js
rename to src/plugins/vis_type_timeseries/server/lib/vis_data/helpers/get_agg_value.test.js
diff --git a/src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/helpers/get_bucket_size.js b/src/plugins/vis_type_timeseries/server/lib/vis_data/helpers/get_bucket_size.js
similarity index 97%
rename from src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/helpers/get_bucket_size.js
rename to src/plugins/vis_type_timeseries/server/lib/vis_data/helpers/get_bucket_size.js
index de23b90b21d6c..3ec5454fcee77 100644
--- a/src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/helpers/get_bucket_size.js
+++ b/src/plugins/vis_type_timeseries/server/lib/vis_data/helpers/get_bucket_size.js
@@ -24,7 +24,7 @@ import {
convertIntervalToUnit,
ASCENDING_UNIT_ORDER,
} from './unit_to_seconds';
-import { getTimerangeDuration } from '../helpers/get_timerange';
+import { getTimerangeDuration } from './get_timerange';
import { INTERVAL_STRING_RE, GTE_INTERVAL_RE } from '../../../../common/interval_regexp';
const calculateBucketData = (timeInterval, capabilities) => {
diff --git a/src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/helpers/get_bucket_size.test.js b/src/plugins/vis_type_timeseries/server/lib/vis_data/helpers/get_bucket_size.test.js
similarity index 100%
rename from src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/helpers/get_bucket_size.test.js
rename to src/plugins/vis_type_timeseries/server/lib/vis_data/helpers/get_bucket_size.test.js
diff --git a/src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/helpers/get_buckets_path.js b/src/plugins/vis_type_timeseries/server/lib/vis_data/helpers/get_buckets_path.js
similarity index 100%
rename from src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/helpers/get_buckets_path.js
rename to src/plugins/vis_type_timeseries/server/lib/vis_data/helpers/get_buckets_path.js
diff --git a/src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/helpers/get_buckets_path.test.js b/src/plugins/vis_type_timeseries/server/lib/vis_data/helpers/get_buckets_path.test.js
similarity index 100%
rename from src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/helpers/get_buckets_path.test.js
rename to src/plugins/vis_type_timeseries/server/lib/vis_data/helpers/get_buckets_path.test.js
diff --git a/src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/helpers/get_default_decoration.js b/src/plugins/vis_type_timeseries/server/lib/vis_data/helpers/get_default_decoration.js
similarity index 100%
rename from src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/helpers/get_default_decoration.js
rename to src/plugins/vis_type_timeseries/server/lib/vis_data/helpers/get_default_decoration.js
diff --git a/src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/helpers/get_default_decoration.test.js b/src/plugins/vis_type_timeseries/server/lib/vis_data/helpers/get_default_decoration.test.js
similarity index 100%
rename from src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/helpers/get_default_decoration.test.js
rename to src/plugins/vis_type_timeseries/server/lib/vis_data/helpers/get_default_decoration.test.js
diff --git a/src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/helpers/get_es_query_uisettings.js b/src/plugins/vis_type_timeseries/server/lib/vis_data/helpers/get_es_query_uisettings.js
similarity index 100%
rename from src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/helpers/get_es_query_uisettings.js
rename to src/plugins/vis_type_timeseries/server/lib/vis_data/helpers/get_es_query_uisettings.js
diff --git a/src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/helpers/get_es_shard_timeout.js b/src/plugins/vis_type_timeseries/server/lib/vis_data/helpers/get_es_shard_timeout.js
similarity index 100%
rename from src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/helpers/get_es_shard_timeout.js
rename to src/plugins/vis_type_timeseries/server/lib/vis_data/helpers/get_es_shard_timeout.js
diff --git a/src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/helpers/get_es_shard_timeout.test.js b/src/plugins/vis_type_timeseries/server/lib/vis_data/helpers/get_es_shard_timeout.test.js
similarity index 100%
rename from src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/helpers/get_es_shard_timeout.test.js
rename to src/plugins/vis_type_timeseries/server/lib/vis_data/helpers/get_es_shard_timeout.test.js
diff --git a/src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/helpers/get_index_pattern.js b/src/plugins/vis_type_timeseries/server/lib/vis_data/helpers/get_index_pattern.js
similarity index 100%
rename from src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/helpers/get_index_pattern.js
rename to src/plugins/vis_type_timeseries/server/lib/vis_data/helpers/get_index_pattern.js
diff --git a/src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/helpers/get_last_metric.js b/src/plugins/vis_type_timeseries/server/lib/vis_data/helpers/get_last_metric.js
similarity index 100%
rename from src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/helpers/get_last_metric.js
rename to src/plugins/vis_type_timeseries/server/lib/vis_data/helpers/get_last_metric.js
diff --git a/src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/helpers/get_last_metric.test.js b/src/plugins/vis_type_timeseries/server/lib/vis_data/helpers/get_last_metric.test.js
similarity index 100%
rename from src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/helpers/get_last_metric.test.js
rename to src/plugins/vis_type_timeseries/server/lib/vis_data/helpers/get_last_metric.test.js
diff --git a/src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/helpers/get_sibling_agg_value.js b/src/plugins/vis_type_timeseries/server/lib/vis_data/helpers/get_sibling_agg_value.js
similarity index 100%
rename from src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/helpers/get_sibling_agg_value.js
rename to src/plugins/vis_type_timeseries/server/lib/vis_data/helpers/get_sibling_agg_value.js
diff --git a/src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/helpers/get_sibling_agg_value.test.js b/src/plugins/vis_type_timeseries/server/lib/vis_data/helpers/get_sibling_agg_value.test.js
similarity index 100%
rename from src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/helpers/get_sibling_agg_value.test.js
rename to src/plugins/vis_type_timeseries/server/lib/vis_data/helpers/get_sibling_agg_value.test.js
diff --git a/src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/helpers/get_split_colors.js b/src/plugins/vis_type_timeseries/server/lib/vis_data/helpers/get_split_colors.js
similarity index 100%
rename from src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/helpers/get_split_colors.js
rename to src/plugins/vis_type_timeseries/server/lib/vis_data/helpers/get_split_colors.js
diff --git a/src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/helpers/get_splits.js b/src/plugins/vis_type_timeseries/server/lib/vis_data/helpers/get_splits.js
similarity index 100%
rename from src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/helpers/get_splits.js
rename to src/plugins/vis_type_timeseries/server/lib/vis_data/helpers/get_splits.js
diff --git a/src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/helpers/get_splits.test.js b/src/plugins/vis_type_timeseries/server/lib/vis_data/helpers/get_splits.test.js
similarity index 100%
rename from src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/helpers/get_splits.test.js
rename to src/plugins/vis_type_timeseries/server/lib/vis_data/helpers/get_splits.test.js
diff --git a/src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/helpers/get_timerange.js b/src/plugins/vis_type_timeseries/server/lib/vis_data/helpers/get_timerange.js
similarity index 100%
rename from src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/helpers/get_timerange.js
rename to src/plugins/vis_type_timeseries/server/lib/vis_data/helpers/get_timerange.js
diff --git a/src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/helpers/get_timerange.test.js b/src/plugins/vis_type_timeseries/server/lib/vis_data/helpers/get_timerange.test.js
similarity index 100%
rename from src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/helpers/get_timerange.test.js
rename to src/plugins/vis_type_timeseries/server/lib/vis_data/helpers/get_timerange.test.js
diff --git a/src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/helpers/get_timerange_mode.js b/src/plugins/vis_type_timeseries/server/lib/vis_data/helpers/get_timerange_mode.js
similarity index 100%
rename from src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/helpers/get_timerange_mode.js
rename to src/plugins/vis_type_timeseries/server/lib/vis_data/helpers/get_timerange_mode.js
diff --git a/src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/helpers/index.js b/src/plugins/vis_type_timeseries/server/lib/vis_data/helpers/index.js
similarity index 100%
rename from src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/helpers/index.js
rename to src/plugins/vis_type_timeseries/server/lib/vis_data/helpers/index.js
diff --git a/src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/helpers/map_bucket.js b/src/plugins/vis_type_timeseries/server/lib/vis_data/helpers/map_bucket.js
similarity index 100%
rename from src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/helpers/map_bucket.js
rename to src/plugins/vis_type_timeseries/server/lib/vis_data/helpers/map_bucket.js
diff --git a/src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/helpers/map_bucket.test.js b/src/plugins/vis_type_timeseries/server/lib/vis_data/helpers/map_bucket.test.js
similarity index 100%
rename from src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/helpers/map_bucket.test.js
rename to src/plugins/vis_type_timeseries/server/lib/vis_data/helpers/map_bucket.test.js
diff --git a/src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/helpers/moving_fn_scripts.js b/src/plugins/vis_type_timeseries/server/lib/vis_data/helpers/moving_fn_scripts.js
similarity index 100%
rename from src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/helpers/moving_fn_scripts.js
rename to src/plugins/vis_type_timeseries/server/lib/vis_data/helpers/moving_fn_scripts.js
diff --git a/src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/helpers/moving_fn_scripts.test.js b/src/plugins/vis_type_timeseries/server/lib/vis_data/helpers/moving_fn_scripts.test.js
similarity index 100%
rename from src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/helpers/moving_fn_scripts.test.js
rename to src/plugins/vis_type_timeseries/server/lib/vis_data/helpers/moving_fn_scripts.test.js
diff --git a/src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/helpers/parse_interval.js b/src/plugins/vis_type_timeseries/server/lib/vis_data/helpers/parse_interval.js
similarity index 100%
rename from src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/helpers/parse_interval.js
rename to src/plugins/vis_type_timeseries/server/lib/vis_data/helpers/parse_interval.js
diff --git a/src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/helpers/parse_settings.js b/src/plugins/vis_type_timeseries/server/lib/vis_data/helpers/parse_settings.js
similarity index 100%
rename from src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/helpers/parse_settings.js
rename to src/plugins/vis_type_timeseries/server/lib/vis_data/helpers/parse_settings.js
diff --git a/src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/helpers/parse_settings.test.js b/src/plugins/vis_type_timeseries/server/lib/vis_data/helpers/parse_settings.test.js
similarity index 100%
rename from src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/helpers/parse_settings.test.js
rename to src/plugins/vis_type_timeseries/server/lib/vis_data/helpers/parse_settings.test.js
diff --git a/src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/helpers/timestamp.js b/src/plugins/vis_type_timeseries/server/lib/vis_data/helpers/timestamp.js
similarity index 100%
rename from src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/helpers/timestamp.js
rename to src/plugins/vis_type_timeseries/server/lib/vis_data/helpers/timestamp.js
diff --git a/src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/helpers/timestamp.test.js b/src/plugins/vis_type_timeseries/server/lib/vis_data/helpers/timestamp.test.js
similarity index 100%
rename from src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/helpers/timestamp.test.js
rename to src/plugins/vis_type_timeseries/server/lib/vis_data/helpers/timestamp.test.js
diff --git a/src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/helpers/unit_to_seconds.js b/src/plugins/vis_type_timeseries/server/lib/vis_data/helpers/unit_to_seconds.js
similarity index 100%
rename from src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/helpers/unit_to_seconds.js
rename to src/plugins/vis_type_timeseries/server/lib/vis_data/helpers/unit_to_seconds.js
diff --git a/src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/helpers/unit_to_seconds.test.js b/src/plugins/vis_type_timeseries/server/lib/vis_data/helpers/unit_to_seconds.test.js
similarity index 100%
rename from src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/helpers/unit_to_seconds.test.js
rename to src/plugins/vis_type_timeseries/server/lib/vis_data/helpers/unit_to_seconds.test.js
diff --git a/src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/offset_time.js b/src/plugins/vis_type_timeseries/server/lib/vis_data/offset_time.js
similarity index 100%
rename from src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/offset_time.js
rename to src/plugins/vis_type_timeseries/server/lib/vis_data/offset_time.js
diff --git a/src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/offset_time.test.js b/src/plugins/vis_type_timeseries/server/lib/vis_data/offset_time.test.js
similarity index 100%
rename from src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/offset_time.test.js
rename to src/plugins/vis_type_timeseries/server/lib/vis_data/offset_time.test.js
diff --git a/src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/request_processors/annotations/date_histogram.js b/src/plugins/vis_type_timeseries/server/lib/vis_data/request_processors/annotations/date_histogram.js
similarity index 94%
rename from src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/request_processors/annotations/date_histogram.js
rename to src/plugins/vis_type_timeseries/server/lib/vis_data/request_processors/annotations/date_histogram.js
index 5a763ce35e35e..995790c590e42 100644
--- a/src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/request_processors/annotations/date_histogram.js
+++ b/src/plugins/vis_type_timeseries/server/lib/vis_data/request_processors/annotations/date_histogram.js
@@ -18,7 +18,7 @@
*/
import _ from 'lodash';
-import { dateHistogramInterval } from '../../../../../../data/server';
+import { dateHistogramInterval } from '../../../../../../../legacy/core_plugins/data/server';
import { getBucketSize } from '../../helpers/get_bucket_size';
import { getTimerange } from '../../helpers/get_timerange';
diff --git a/src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/request_processors/annotations/index.js b/src/plugins/vis_type_timeseries/server/lib/vis_data/request_processors/annotations/index.js
similarity index 100%
rename from src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/request_processors/annotations/index.js
rename to src/plugins/vis_type_timeseries/server/lib/vis_data/request_processors/annotations/index.js
diff --git a/src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/request_processors/annotations/query.js b/src/plugins/vis_type_timeseries/server/lib/vis_data/request_processors/annotations/query.js
similarity index 97%
rename from src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/request_processors/annotations/query.js
rename to src/plugins/vis_type_timeseries/server/lib/vis_data/request_processors/annotations/query.js
index d6514e3bc45d4..a4817dac9bd18 100644
--- a/src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/request_processors/annotations/query.js
+++ b/src/plugins/vis_type_timeseries/server/lib/vis_data/request_processors/annotations/query.js
@@ -19,7 +19,7 @@
import { getBucketSize } from '../../helpers/get_bucket_size';
import { getTimerange } from '../../helpers/get_timerange';
-import { esQuery } from '../../../../../../../../plugins/data/server';
+import { esQuery } from '../../../../../../data/server';
export function query(req, panel, annotation, esQueryConfig, indexPattern, capabilities) {
return next => doc => {
diff --git a/src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/request_processors/annotations/top_hits.js b/src/plugins/vis_type_timeseries/server/lib/vis_data/request_processors/annotations/top_hits.js
similarity index 100%
rename from src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/request_processors/annotations/top_hits.js
rename to src/plugins/vis_type_timeseries/server/lib/vis_data/request_processors/annotations/top_hits.js
diff --git a/src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/request_processors/series/date_histogram.js b/src/plugins/vis_type_timeseries/server/lib/vis_data/request_processors/series/date_histogram.js
similarity index 96%
rename from src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/request_processors/series/date_histogram.js
rename to src/plugins/vis_type_timeseries/server/lib/vis_data/request_processors/series/date_histogram.js
index 3b55e2bf4c151..48da5ac19aa3a 100644
--- a/src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/request_processors/series/date_histogram.js
+++ b/src/plugins/vis_type_timeseries/server/lib/vis_data/request_processors/series/date_histogram.js
@@ -18,7 +18,7 @@
*/
import { set } from 'lodash';
-import { dateHistogramInterval } from '../../../../../../data/server';
+import { dateHistogramInterval } from '../../../../../../../legacy/core_plugins/data/server';
import { getBucketSize } from '../../helpers/get_bucket_size';
import { offsetTime } from '../../offset_time';
import { getIntervalAndTimefield } from '../../get_interval_and_timefield';
diff --git a/src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/request_processors/series/date_histogram.test.js b/src/plugins/vis_type_timeseries/server/lib/vis_data/request_processors/series/date_histogram.test.js
similarity index 100%
rename from src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/request_processors/series/date_histogram.test.js
rename to src/plugins/vis_type_timeseries/server/lib/vis_data/request_processors/series/date_histogram.test.js
diff --git a/src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/request_processors/series/filter_ratios.js b/src/plugins/vis_type_timeseries/server/lib/vis_data/request_processors/series/filter_ratios.js
similarity index 100%
rename from src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/request_processors/series/filter_ratios.js
rename to src/plugins/vis_type_timeseries/server/lib/vis_data/request_processors/series/filter_ratios.js
diff --git a/src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/request_processors/series/filter_ratios.test.js b/src/plugins/vis_type_timeseries/server/lib/vis_data/request_processors/series/filter_ratios.test.js
similarity index 100%
rename from src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/request_processors/series/filter_ratios.test.js
rename to src/plugins/vis_type_timeseries/server/lib/vis_data/request_processors/series/filter_ratios.test.js
diff --git a/src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/request_processors/series/index.js b/src/plugins/vis_type_timeseries/server/lib/vis_data/request_processors/series/index.js
similarity index 100%
rename from src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/request_processors/series/index.js
rename to src/plugins/vis_type_timeseries/server/lib/vis_data/request_processors/series/index.js
diff --git a/src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/request_processors/series/metric_buckets.js b/src/plugins/vis_type_timeseries/server/lib/vis_data/request_processors/series/metric_buckets.js
similarity index 100%
rename from src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/request_processors/series/metric_buckets.js
rename to src/plugins/vis_type_timeseries/server/lib/vis_data/request_processors/series/metric_buckets.js
diff --git a/src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/request_processors/series/metric_buckets.test.js b/src/plugins/vis_type_timeseries/server/lib/vis_data/request_processors/series/metric_buckets.test.js
similarity index 100%
rename from src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/request_processors/series/metric_buckets.test.js
rename to src/plugins/vis_type_timeseries/server/lib/vis_data/request_processors/series/metric_buckets.test.js
diff --git a/src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/request_processors/series/normalize_query.js b/src/plugins/vis_type_timeseries/server/lib/vis_data/request_processors/series/normalize_query.js
similarity index 100%
rename from src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/request_processors/series/normalize_query.js
rename to src/plugins/vis_type_timeseries/server/lib/vis_data/request_processors/series/normalize_query.js
diff --git a/src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/request_processors/series/normalize_query.test.js b/src/plugins/vis_type_timeseries/server/lib/vis_data/request_processors/series/normalize_query.test.js
similarity index 100%
rename from src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/request_processors/series/normalize_query.test.js
rename to src/plugins/vis_type_timeseries/server/lib/vis_data/request_processors/series/normalize_query.test.js
diff --git a/src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/request_processors/series/query.js b/src/plugins/vis_type_timeseries/server/lib/vis_data/request_processors/series/query.js
similarity index 96%
rename from src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/request_processors/series/query.js
rename to src/plugins/vis_type_timeseries/server/lib/vis_data/request_processors/series/query.js
index 53f894322a8e0..e5b81912f286e 100644
--- a/src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/request_processors/series/query.js
+++ b/src/plugins/vis_type_timeseries/server/lib/vis_data/request_processors/series/query.js
@@ -19,7 +19,7 @@
import { offsetTime } from '../../offset_time';
import { getIntervalAndTimefield } from '../../get_interval_and_timefield';
-import { esQuery } from '../../../../../../../../plugins/data/server';
+import { esQuery } from '../../../../../../data/server';
export function query(req, panel, series, esQueryConfig, indexPatternObject) {
return next => doc => {
diff --git a/src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/request_processors/series/query.test.js b/src/plugins/vis_type_timeseries/server/lib/vis_data/request_processors/series/query.test.js
similarity index 100%
rename from src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/request_processors/series/query.test.js
rename to src/plugins/vis_type_timeseries/server/lib/vis_data/request_processors/series/query.test.js
diff --git a/src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/request_processors/series/sibling_buckets.js b/src/plugins/vis_type_timeseries/server/lib/vis_data/request_processors/series/sibling_buckets.js
similarity index 100%
rename from src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/request_processors/series/sibling_buckets.js
rename to src/plugins/vis_type_timeseries/server/lib/vis_data/request_processors/series/sibling_buckets.js
diff --git a/src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/request_processors/series/sibling_buckets.test.js b/src/plugins/vis_type_timeseries/server/lib/vis_data/request_processors/series/sibling_buckets.test.js
similarity index 100%
rename from src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/request_processors/series/sibling_buckets.test.js
rename to src/plugins/vis_type_timeseries/server/lib/vis_data/request_processors/series/sibling_buckets.test.js
diff --git a/src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/request_processors/series/split_by_everything.js b/src/plugins/vis_type_timeseries/server/lib/vis_data/request_processors/series/split_by_everything.js
similarity index 100%
rename from src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/request_processors/series/split_by_everything.js
rename to src/plugins/vis_type_timeseries/server/lib/vis_data/request_processors/series/split_by_everything.js
diff --git a/src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/request_processors/series/split_by_everything.test.js b/src/plugins/vis_type_timeseries/server/lib/vis_data/request_processors/series/split_by_everything.test.js
similarity index 100%
rename from src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/request_processors/series/split_by_everything.test.js
rename to src/plugins/vis_type_timeseries/server/lib/vis_data/request_processors/series/split_by_everything.test.js
diff --git a/src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/request_processors/series/split_by_filter.js b/src/plugins/vis_type_timeseries/server/lib/vis_data/request_processors/series/split_by_filter.js
similarity index 94%
rename from src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/request_processors/series/split_by_filter.js
rename to src/plugins/vis_type_timeseries/server/lib/vis_data/request_processors/series/split_by_filter.js
index 1548c9e17c2e1..80b4ef70a3f08 100644
--- a/src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/request_processors/series/split_by_filter.js
+++ b/src/plugins/vis_type_timeseries/server/lib/vis_data/request_processors/series/split_by_filter.js
@@ -18,7 +18,7 @@
*/
import { set } from 'lodash';
-import { esQuery } from '../../../../../../../../plugins/data/server';
+import { esQuery } from '../../../../../../data/server';
export function splitByFilter(req, panel, series, esQueryConfig, indexPattern) {
return next => doc => {
diff --git a/src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/request_processors/series/split_by_filter.test.js b/src/plugins/vis_type_timeseries/server/lib/vis_data/request_processors/series/split_by_filter.test.js
similarity index 100%
rename from src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/request_processors/series/split_by_filter.test.js
rename to src/plugins/vis_type_timeseries/server/lib/vis_data/request_processors/series/split_by_filter.test.js
diff --git a/src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/request_processors/series/split_by_filters.js b/src/plugins/vis_type_timeseries/server/lib/vis_data/request_processors/series/split_by_filters.js
similarity index 94%
rename from src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/request_processors/series/split_by_filters.js
rename to src/plugins/vis_type_timeseries/server/lib/vis_data/request_processors/series/split_by_filters.js
index 4295bceed43cc..d023c28cdb25e 100644
--- a/src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/request_processors/series/split_by_filters.js
+++ b/src/plugins/vis_type_timeseries/server/lib/vis_data/request_processors/series/split_by_filters.js
@@ -18,7 +18,7 @@
*/
import { set } from 'lodash';
-import { esQuery } from '../../../../../../../../plugins/data/server';
+import { esQuery } from '../../../../../../data/server';
export function splitByFilters(req, panel, series, esQueryConfig, indexPattern) {
return next => doc => {
diff --git a/src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/request_processors/series/split_by_filters.test.js b/src/plugins/vis_type_timeseries/server/lib/vis_data/request_processors/series/split_by_filters.test.js
similarity index 100%
rename from src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/request_processors/series/split_by_filters.test.js
rename to src/plugins/vis_type_timeseries/server/lib/vis_data/request_processors/series/split_by_filters.test.js
diff --git a/src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/request_processors/series/split_by_terms.js b/src/plugins/vis_type_timeseries/server/lib/vis_data/request_processors/series/split_by_terms.js
similarity index 100%
rename from src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/request_processors/series/split_by_terms.js
rename to src/plugins/vis_type_timeseries/server/lib/vis_data/request_processors/series/split_by_terms.js
diff --git a/src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/request_processors/series/split_by_terms.test.js b/src/plugins/vis_type_timeseries/server/lib/vis_data/request_processors/series/split_by_terms.test.js
similarity index 100%
rename from src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/request_processors/series/split_by_terms.test.js
rename to src/plugins/vis_type_timeseries/server/lib/vis_data/request_processors/series/split_by_terms.test.js
diff --git a/src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/request_processors/table/calculate_agg_root.js b/src/plugins/vis_type_timeseries/server/lib/vis_data/request_processors/table/calculate_agg_root.js
similarity index 100%
rename from src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/request_processors/table/calculate_agg_root.js
rename to src/plugins/vis_type_timeseries/server/lib/vis_data/request_processors/table/calculate_agg_root.js
diff --git a/src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/request_processors/table/date_histogram.js b/src/plugins/vis_type_timeseries/server/lib/vis_data/request_processors/table/date_histogram.js
similarity index 96%
rename from src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/request_processors/table/date_histogram.js
rename to src/plugins/vis_type_timeseries/server/lib/vis_data/request_processors/table/date_histogram.js
index 183785fab9be1..f33ce145aa230 100644
--- a/src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/request_processors/table/date_histogram.js
+++ b/src/plugins/vis_type_timeseries/server/lib/vis_data/request_processors/table/date_histogram.js
@@ -18,7 +18,7 @@
*/
import { set } from 'lodash';
-import { dateHistogramInterval } from '../../../../../../data/server';
+import { dateHistogramInterval } from '../../../../../../../legacy/core_plugins/data/server';
import { getBucketSize } from '../../helpers/get_bucket_size';
import { isLastValueTimerangeMode } from '../../helpers/get_timerange_mode';
import { getIntervalAndTimefield } from '../../get_interval_and_timefield';
diff --git a/src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/request_processors/table/filter_ratios.js b/src/plugins/vis_type_timeseries/server/lib/vis_data/request_processors/table/filter_ratios.js
similarity index 100%
rename from src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/request_processors/table/filter_ratios.js
rename to src/plugins/vis_type_timeseries/server/lib/vis_data/request_processors/table/filter_ratios.js
diff --git a/src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/request_processors/table/index.js b/src/plugins/vis_type_timeseries/server/lib/vis_data/request_processors/table/index.js
similarity index 100%
rename from src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/request_processors/table/index.js
rename to src/plugins/vis_type_timeseries/server/lib/vis_data/request_processors/table/index.js
diff --git a/src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/request_processors/table/metric_buckets.js b/src/plugins/vis_type_timeseries/server/lib/vis_data/request_processors/table/metric_buckets.js
similarity index 100%
rename from src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/request_processors/table/metric_buckets.js
rename to src/plugins/vis_type_timeseries/server/lib/vis_data/request_processors/table/metric_buckets.js
diff --git a/src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/request_processors/table/normalize_query.js b/src/plugins/vis_type_timeseries/server/lib/vis_data/request_processors/table/normalize_query.js
similarity index 100%
rename from src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/request_processors/table/normalize_query.js
rename to src/plugins/vis_type_timeseries/server/lib/vis_data/request_processors/table/normalize_query.js
diff --git a/src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/request_processors/table/normalize_query.test.js b/src/plugins/vis_type_timeseries/server/lib/vis_data/request_processors/table/normalize_query.test.js
similarity index 100%
rename from src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/request_processors/table/normalize_query.test.js
rename to src/plugins/vis_type_timeseries/server/lib/vis_data/request_processors/table/normalize_query.test.js
diff --git a/src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/request_processors/table/pivot.js b/src/plugins/vis_type_timeseries/server/lib/vis_data/request_processors/table/pivot.js
similarity index 100%
rename from src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/request_processors/table/pivot.js
rename to src/plugins/vis_type_timeseries/server/lib/vis_data/request_processors/table/pivot.js
diff --git a/src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/request_processors/table/query.js b/src/plugins/vis_type_timeseries/server/lib/vis_data/request_processors/table/query.js
similarity index 96%
rename from src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/request_processors/table/query.js
rename to src/plugins/vis_type_timeseries/server/lib/vis_data/request_processors/table/query.js
index 9d46c212e05bd..d8d948e01cccd 100644
--- a/src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/request_processors/table/query.js
+++ b/src/plugins/vis_type_timeseries/server/lib/vis_data/request_processors/table/query.js
@@ -18,7 +18,7 @@
*/
import { getTimerange } from '../../helpers/get_timerange';
import { getIntervalAndTimefield } from '../../get_interval_and_timefield';
-import { esQuery } from '../../../../../../../../plugins/data/server';
+import { esQuery } from '../../../../../../data/server';
export function query(req, panel, esQueryConfig, indexPatternObject) {
return next => doc => {
diff --git a/src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/request_processors/table/sibling_buckets.js b/src/plugins/vis_type_timeseries/server/lib/vis_data/request_processors/table/sibling_buckets.js
similarity index 100%
rename from src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/request_processors/table/sibling_buckets.js
rename to src/plugins/vis_type_timeseries/server/lib/vis_data/request_processors/table/sibling_buckets.js
diff --git a/src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/request_processors/table/split_by_everything.js b/src/plugins/vis_type_timeseries/server/lib/vis_data/request_processors/table/split_by_everything.js
similarity index 95%
rename from src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/request_processors/table/split_by_everything.js
rename to src/plugins/vis_type_timeseries/server/lib/vis_data/request_processors/table/split_by_everything.js
index 17f99ea431fd3..35036abed320f 100644
--- a/src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/request_processors/table/split_by_everything.js
+++ b/src/plugins/vis_type_timeseries/server/lib/vis_data/request_processors/table/split_by_everything.js
@@ -18,7 +18,7 @@
*/
import { set } from 'lodash';
-import { esQuery } from '../../../../../../../../plugins/data/server';
+import { esQuery } from '../../../../../../data/server';
export function splitByEverything(req, panel, esQueryConfig, indexPattern) {
return next => doc => {
diff --git a/src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/request_processors/table/split_by_terms.js b/src/plugins/vis_type_timeseries/server/lib/vis_data/request_processors/table/split_by_terms.js
similarity index 95%
rename from src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/request_processors/table/split_by_terms.js
rename to src/plugins/vis_type_timeseries/server/lib/vis_data/request_processors/table/split_by_terms.js
index 042e4d98e2767..5b7ae735cd50f 100644
--- a/src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/request_processors/table/split_by_terms.js
+++ b/src/plugins/vis_type_timeseries/server/lib/vis_data/request_processors/table/split_by_terms.js
@@ -18,7 +18,7 @@
*/
import { set } from 'lodash';
-import { esQuery } from '../../../../../../../../plugins/data/server';
+import { esQuery } from '../../../../../../data/server';
export function splitByTerms(req, panel, esQueryConfig, indexPattern) {
return next => doc => {
diff --git a/src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/response_processors/annotations/buckets.js b/src/plugins/vis_type_timeseries/server/lib/vis_data/response_processors/annotations/buckets.js
similarity index 100%
rename from src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/response_processors/annotations/buckets.js
rename to src/plugins/vis_type_timeseries/server/lib/vis_data/response_processors/annotations/buckets.js
diff --git a/src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/response_processors/annotations/filter.js b/src/plugins/vis_type_timeseries/server/lib/vis_data/response_processors/annotations/filter.js
similarity index 100%
rename from src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/response_processors/annotations/filter.js
rename to src/plugins/vis_type_timeseries/server/lib/vis_data/response_processors/annotations/filter.js
diff --git a/src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/response_processors/annotations/filter.test.js b/src/plugins/vis_type_timeseries/server/lib/vis_data/response_processors/annotations/filter.test.js
similarity index 100%
rename from src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/response_processors/annotations/filter.test.js
rename to src/plugins/vis_type_timeseries/server/lib/vis_data/response_processors/annotations/filter.test.js
diff --git a/src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/response_processors/annotations/index.js b/src/plugins/vis_type_timeseries/server/lib/vis_data/response_processors/annotations/index.js
similarity index 100%
rename from src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/response_processors/annotations/index.js
rename to src/plugins/vis_type_timeseries/server/lib/vis_data/response_processors/annotations/index.js
diff --git a/src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/response_processors/series/_series_agg.js b/src/plugins/vis_type_timeseries/server/lib/vis_data/response_processors/series/_series_agg.js
similarity index 100%
rename from src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/response_processors/series/_series_agg.js
rename to src/plugins/vis_type_timeseries/server/lib/vis_data/response_processors/series/_series_agg.js
diff --git a/src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/response_processors/series/_series_agg.test.js b/src/plugins/vis_type_timeseries/server/lib/vis_data/response_processors/series/_series_agg.test.js
similarity index 100%
rename from src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/response_processors/series/_series_agg.test.js
rename to src/plugins/vis_type_timeseries/server/lib/vis_data/response_processors/series/_series_agg.test.js
diff --git a/src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/response_processors/series/drop_last_bucket.js b/src/plugins/vis_type_timeseries/server/lib/vis_data/response_processors/series/drop_last_bucket.js
similarity index 100%
rename from src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/response_processors/series/drop_last_bucket.js
rename to src/plugins/vis_type_timeseries/server/lib/vis_data/response_processors/series/drop_last_bucket.js
diff --git a/src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/response_processors/series/index.js b/src/plugins/vis_type_timeseries/server/lib/vis_data/response_processors/series/index.js
similarity index 100%
rename from src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/response_processors/series/index.js
rename to src/plugins/vis_type_timeseries/server/lib/vis_data/response_processors/series/index.js
diff --git a/src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/response_processors/series/math.js b/src/plugins/vis_type_timeseries/server/lib/vis_data/response_processors/series/math.js
similarity index 100%
rename from src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/response_processors/series/math.js
rename to src/plugins/vis_type_timeseries/server/lib/vis_data/response_processors/series/math.js
diff --git a/src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/response_processors/series/percentile.js b/src/plugins/vis_type_timeseries/server/lib/vis_data/response_processors/series/percentile.js
similarity index 100%
rename from src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/response_processors/series/percentile.js
rename to src/plugins/vis_type_timeseries/server/lib/vis_data/response_processors/series/percentile.js
diff --git a/src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/response_processors/series/percentile.test.js b/src/plugins/vis_type_timeseries/server/lib/vis_data/response_processors/series/percentile.test.js
similarity index 100%
rename from src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/response_processors/series/percentile.test.js
rename to src/plugins/vis_type_timeseries/server/lib/vis_data/response_processors/series/percentile.test.js
diff --git a/src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/response_processors/series/percentile_rank.js b/src/plugins/vis_type_timeseries/server/lib/vis_data/response_processors/series/percentile_rank.js
similarity index 100%
rename from src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/response_processors/series/percentile_rank.js
rename to src/plugins/vis_type_timeseries/server/lib/vis_data/response_processors/series/percentile_rank.js
diff --git a/src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/response_processors/series/series_agg.js b/src/plugins/vis_type_timeseries/server/lib/vis_data/response_processors/series/series_agg.js
similarity index 100%
rename from src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/response_processors/series/series_agg.js
rename to src/plugins/vis_type_timeseries/server/lib/vis_data/response_processors/series/series_agg.js
diff --git a/src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/response_processors/series/series_agg.test.js b/src/plugins/vis_type_timeseries/server/lib/vis_data/response_processors/series/series_agg.test.js
similarity index 100%
rename from src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/response_processors/series/series_agg.test.js
rename to src/plugins/vis_type_timeseries/server/lib/vis_data/response_processors/series/series_agg.test.js
diff --git a/src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/response_processors/series/std_deviation_bands.js b/src/plugins/vis_type_timeseries/server/lib/vis_data/response_processors/series/std_deviation_bands.js
similarity index 100%
rename from src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/response_processors/series/std_deviation_bands.js
rename to src/plugins/vis_type_timeseries/server/lib/vis_data/response_processors/series/std_deviation_bands.js
diff --git a/src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/response_processors/series/std_deviation_bands.test.js b/src/plugins/vis_type_timeseries/server/lib/vis_data/response_processors/series/std_deviation_bands.test.js
similarity index 100%
rename from src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/response_processors/series/std_deviation_bands.test.js
rename to src/plugins/vis_type_timeseries/server/lib/vis_data/response_processors/series/std_deviation_bands.test.js
diff --git a/src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/response_processors/series/std_deviation_sibling.js b/src/plugins/vis_type_timeseries/server/lib/vis_data/response_processors/series/std_deviation_sibling.js
similarity index 100%
rename from src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/response_processors/series/std_deviation_sibling.js
rename to src/plugins/vis_type_timeseries/server/lib/vis_data/response_processors/series/std_deviation_sibling.js
diff --git a/src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/response_processors/series/std_deviation_sibling.test.js b/src/plugins/vis_type_timeseries/server/lib/vis_data/response_processors/series/std_deviation_sibling.test.js
similarity index 100%
rename from src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/response_processors/series/std_deviation_sibling.test.js
rename to src/plugins/vis_type_timeseries/server/lib/vis_data/response_processors/series/std_deviation_sibling.test.js
diff --git a/src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/response_processors/series/std_metric.js b/src/plugins/vis_type_timeseries/server/lib/vis_data/response_processors/series/std_metric.js
similarity index 100%
rename from src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/response_processors/series/std_metric.js
rename to src/plugins/vis_type_timeseries/server/lib/vis_data/response_processors/series/std_metric.js
diff --git a/src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/response_processors/series/std_metric.test.js b/src/plugins/vis_type_timeseries/server/lib/vis_data/response_processors/series/std_metric.test.js
similarity index 100%
rename from src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/response_processors/series/std_metric.test.js
rename to src/plugins/vis_type_timeseries/server/lib/vis_data/response_processors/series/std_metric.test.js
diff --git a/src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/response_processors/series/std_sibling.js b/src/plugins/vis_type_timeseries/server/lib/vis_data/response_processors/series/std_sibling.js
similarity index 100%
rename from src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/response_processors/series/std_sibling.js
rename to src/plugins/vis_type_timeseries/server/lib/vis_data/response_processors/series/std_sibling.js
diff --git a/src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/response_processors/series/std_sibling.test.js b/src/plugins/vis_type_timeseries/server/lib/vis_data/response_processors/series/std_sibling.test.js
similarity index 100%
rename from src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/response_processors/series/std_sibling.test.js
rename to src/plugins/vis_type_timeseries/server/lib/vis_data/response_processors/series/std_sibling.test.js
diff --git a/src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/response_processors/series/time_shift.js b/src/plugins/vis_type_timeseries/server/lib/vis_data/response_processors/series/time_shift.js
similarity index 100%
rename from src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/response_processors/series/time_shift.js
rename to src/plugins/vis_type_timeseries/server/lib/vis_data/response_processors/series/time_shift.js
diff --git a/src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/response_processors/series/time_shift.test.js b/src/plugins/vis_type_timeseries/server/lib/vis_data/response_processors/series/time_shift.test.js
similarity index 100%
rename from src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/response_processors/series/time_shift.test.js
rename to src/plugins/vis_type_timeseries/server/lib/vis_data/response_processors/series/time_shift.test.js
diff --git a/src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/response_processors/table/_series_agg.js b/src/plugins/vis_type_timeseries/server/lib/vis_data/response_processors/table/_series_agg.js
similarity index 100%
rename from src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/response_processors/table/_series_agg.js
rename to src/plugins/vis_type_timeseries/server/lib/vis_data/response_processors/table/_series_agg.js
diff --git a/src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/response_processors/table/drop_last_bucket.js b/src/plugins/vis_type_timeseries/server/lib/vis_data/response_processors/table/drop_last_bucket.js
similarity index 100%
rename from src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/response_processors/table/drop_last_bucket.js
rename to src/plugins/vis_type_timeseries/server/lib/vis_data/response_processors/table/drop_last_bucket.js
diff --git a/src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/response_processors/table/index.js b/src/plugins/vis_type_timeseries/server/lib/vis_data/response_processors/table/index.js
similarity index 100%
rename from src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/response_processors/table/index.js
rename to src/plugins/vis_type_timeseries/server/lib/vis_data/response_processors/table/index.js
diff --git a/src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/response_processors/table/math.js b/src/plugins/vis_type_timeseries/server/lib/vis_data/response_processors/table/math.js
similarity index 100%
rename from src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/response_processors/table/math.js
rename to src/plugins/vis_type_timeseries/server/lib/vis_data/response_processors/table/math.js
diff --git a/src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/response_processors/table/percentile.js b/src/plugins/vis_type_timeseries/server/lib/vis_data/response_processors/table/percentile.js
similarity index 100%
rename from src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/response_processors/table/percentile.js
rename to src/plugins/vis_type_timeseries/server/lib/vis_data/response_processors/table/percentile.js
diff --git a/src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/response_processors/table/percentile_rank.js b/src/plugins/vis_type_timeseries/server/lib/vis_data/response_processors/table/percentile_rank.js
similarity index 100%
rename from src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/response_processors/table/percentile_rank.js
rename to src/plugins/vis_type_timeseries/server/lib/vis_data/response_processors/table/percentile_rank.js
diff --git a/src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/response_processors/table/series_agg.js b/src/plugins/vis_type_timeseries/server/lib/vis_data/response_processors/table/series_agg.js
similarity index 100%
rename from src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/response_processors/table/series_agg.js
rename to src/plugins/vis_type_timeseries/server/lib/vis_data/response_processors/table/series_agg.js
diff --git a/src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/response_processors/table/std_metric.js b/src/plugins/vis_type_timeseries/server/lib/vis_data/response_processors/table/std_metric.js
similarity index 100%
rename from src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/response_processors/table/std_metric.js
rename to src/plugins/vis_type_timeseries/server/lib/vis_data/response_processors/table/std_metric.js
diff --git a/src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/response_processors/table/std_sibling.js b/src/plugins/vis_type_timeseries/server/lib/vis_data/response_processors/table/std_sibling.js
similarity index 100%
rename from src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/response_processors/table/std_sibling.js
rename to src/plugins/vis_type_timeseries/server/lib/vis_data/response_processors/table/std_sibling.js
diff --git a/src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/series/build_request_body.test.ts b/src/plugins/vis_type_timeseries/server/lib/vis_data/series/build_request_body.test.ts
similarity index 100%
rename from src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/series/build_request_body.test.ts
rename to src/plugins/vis_type_timeseries/server/lib/vis_data/series/build_request_body.test.ts
diff --git a/src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/series/build_request_body.ts b/src/plugins/vis_type_timeseries/server/lib/vis_data/series/build_request_body.ts
similarity index 95%
rename from src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/series/build_request_body.ts
rename to src/plugins/vis_type_timeseries/server/lib/vis_data/series/build_request_body.ts
index 85e1f8f7eb12b..9d8f3fca789f0 100644
--- a/src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/series/build_request_body.ts
+++ b/src/plugins/vis_type_timeseries/server/lib/vis_data/series/build_request_body.ts
@@ -19,7 +19,7 @@
import { buildProcessorFunction } from '../build_processor_function';
// @ts-ignore
-import { processors } from '../request_processors/series';
+import { processors } from '../request_processors/series/index';
/**
* Builds series request body
diff --git a/src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/series/get_request_params.js b/src/plugins/vis_type_timeseries/server/lib/vis_data/series/get_request_params.js
similarity index 100%
rename from src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/series/get_request_params.js
rename to src/plugins/vis_type_timeseries/server/lib/vis_data/series/get_request_params.js
diff --git a/src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/series/handle_response_body.js b/src/plugins/vis_type_timeseries/server/lib/vis_data/series/handle_response_body.js
similarity index 100%
rename from src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/series/handle_response_body.js
rename to src/plugins/vis_type_timeseries/server/lib/vis_data/series/handle_response_body.js
diff --git a/src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/table/build_request_body.js b/src/plugins/vis_type_timeseries/server/lib/vis_data/table/build_request_body.js
similarity index 100%
rename from src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/table/build_request_body.js
rename to src/plugins/vis_type_timeseries/server/lib/vis_data/table/build_request_body.js
diff --git a/src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/table/process_bucket.js b/src/plugins/vis_type_timeseries/server/lib/vis_data/table/process_bucket.js
similarity index 100%
rename from src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/table/process_bucket.js
rename to src/plugins/vis_type_timeseries/server/lib/vis_data/table/process_bucket.js
diff --git a/src/plugins/vis_type_timeseries/server/plugin.ts b/src/plugins/vis_type_timeseries/server/plugin.ts
index dcd0cd500bbc3..6ef6362c6e37b 100644
--- a/src/plugins/vis_type_timeseries/server/plugin.ts
+++ b/src/plugins/vis_type_timeseries/server/plugin.ts
@@ -24,19 +24,19 @@ import {
Plugin,
RequestHandlerContext,
Logger,
+ IRouter,
+ FakeRequest,
} from 'src/core/server';
import { Observable } from 'rxjs';
import { Server } from 'hapi';
-import { once } from 'lodash';
import { VisTypeTimeseriesConfig } from '.';
-import {
- init,
- getVisData,
- GetVisData,
- GetVisDataOptions,
-} from '../../../legacy/core_plugins/vis_type_timeseries/server';
-import { ValidationTelemetryService } from './validation_telemetry/validation_telemetry_service';
+import { getVisData, GetVisData, GetVisDataOptions } from './lib/get_vis_data';
+import { ValidationTelemetryService } from './validation_telemetry';
import { UsageCollectionSetup } from '../../usage_collection/server';
+import { visDataRoutes } from './routes/vis';
+// @ts-ignore
+import { fieldsRoutes } from './routes/fields';
+import { SearchStrategyRegistry } from './lib/search_strategies';
export interface LegacySetup {
server: Server;
@@ -47,15 +47,12 @@ interface VisTypeTimeseriesPluginSetupDependencies {
}
export interface VisTypeTimeseriesSetup {
- /** @deprecated */
- __legacy: {
- config$: Observable;
- registerLegacyAPI: (__LEGACY: LegacySetup) => void;
- };
getVisData: (
requestContext: RequestHandlerContext,
+ fakeRequest: FakeRequest,
options: GetVisDataOptions
) => ReturnType;
+ addSearchStrategy: SearchStrategyRegistry['addStrategy'];
}
export interface Framework {
@@ -64,6 +61,8 @@ export interface Framework {
config$: Observable;
globalConfig$: PluginInitializerContext['config']['legacy']['globalConfig$'];
logger: Logger;
+ router: IRouter;
+ searchStrategyRegistry: SearchStrategyRegistry;
}
export class VisTypeTimeseriesPlugin implements Plugin {
@@ -79,6 +78,9 @@ export class VisTypeTimeseriesPlugin implements Plugin {
const config$ = this.initializerContext.config.create();
// Global config contains things like the ES shard timeout
const globalConfig$ = this.initializerContext.config.legacy.globalConfig$;
+ const router = core.http.createRouter();
+
+ const searchStrategyRegistry = new SearchStrategyRegistry();
const framework: Framework = {
core,
@@ -86,23 +88,29 @@ export class VisTypeTimeseriesPlugin implements Plugin {
config$,
globalConfig$,
logger,
+ router,
+ searchStrategyRegistry,
};
- return {
- __legacy: {
- config$,
- registerLegacyAPI: once(async (__LEGACY: LegacySetup) => {
- const validationTelemetrySetup = await this.validationTelementryService.setup(core, {
- ...plugins,
- globalConfig$,
- });
+ (async () => {
+ const validationTelemetry = await this.validationTelementryService.setup(core, {
+ ...plugins,
+ globalConfig$,
+ });
+ visDataRoutes(router, framework, validationTelemetry);
- await init(framework, __LEGACY, validationTelemetrySetup);
- }),
- },
- getVisData: async (requestContext: RequestHandlerContext, options: GetVisDataOptions) => {
- return await getVisData(requestContext, options, framework);
+ fieldsRoutes(framework);
+ })();
+
+ return {
+ getVisData: async (
+ requestContext: RequestHandlerContext,
+ fakeRequest: FakeRequest,
+ options: GetVisDataOptions
+ ) => {
+ return await getVisData(requestContext, { ...fakeRequest, body: options }, framework);
},
+ addSearchStrategy: searchStrategyRegistry.addStrategy.bind(searchStrategyRegistry),
};
}
diff --git a/src/plugins/vis_type_timeseries/server/routes/fields.ts b/src/plugins/vis_type_timeseries/server/routes/fields.ts
new file mode 100644
index 0000000000000..255c85c9eefa7
--- /dev/null
+++ b/src/plugins/vis_type_timeseries/server/routes/fields.ts
@@ -0,0 +1,51 @@
+/*
+ * Licensed to Elasticsearch B.V. under one or more contributor
+ * license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright
+ * ownership. Elasticsearch B.V. licenses this file to you under
+ * the Apache License, Version 2.0 (the "License"); you may
+ * not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import { isBoom } from 'boom';
+import { schema } from '@kbn/config-schema';
+import { getFields } from '../lib/get_fields';
+import { Framework } from '../plugin';
+
+export const fieldsRoutes = (framework: Framework) => {
+ framework.router.get(
+ {
+ path: '/api/metrics/fields',
+ validate: {
+ query: schema.object({ index: schema.string() }),
+ },
+ },
+ async (context, req, res) => {
+ try {
+ return res.ok({ body: await getFields(context, req, framework, req.query.index) });
+ } catch (err) {
+ if (isBoom(err) && err.output.statusCode === 401) {
+ return res.customError({
+ body: err.output.payload,
+ statusCode: err.output.statusCode,
+ headers: err.output.headers,
+ });
+ }
+
+ return res.ok({
+ body: [],
+ });
+ }
+ }
+ );
+};
diff --git a/src/legacy/core_plugins/vis_type_timeseries/server/routes/post_vis_schema.ts b/src/plugins/vis_type_timeseries/server/routes/post_vis_schema.ts
similarity index 100%
rename from src/legacy/core_plugins/vis_type_timeseries/server/routes/post_vis_schema.ts
rename to src/plugins/vis_type_timeseries/server/routes/post_vis_schema.ts
diff --git a/src/legacy/core_plugins/vis_type_timeseries/server/routes/vis.ts b/src/plugins/vis_type_timeseries/server/routes/vis.ts
similarity index 85%
rename from src/legacy/core_plugins/vis_type_timeseries/server/routes/vis.ts
rename to src/plugins/vis_type_timeseries/server/routes/vis.ts
index 32e87f5a3f666..e2d1e4d114ad5 100644
--- a/src/legacy/core_plugins/vis_type_timeseries/server/routes/vis.ts
+++ b/src/plugins/vis_type_timeseries/server/routes/vis.ts
@@ -17,14 +17,11 @@
* under the License.
*/
-import { IRouter } from 'kibana/server';
+import { IRouter, KibanaRequest } from 'kibana/server';
import { schema } from '@kbn/config-schema';
-import { getVisData } from '../lib/get_vis_data';
+import { getVisData, GetVisDataOptions } from '../lib/get_vis_data';
import { visPayloadSchema } from './post_vis_schema';
-import {
- Framework,
- ValidationTelemetryServiceSetup,
-} from '../../../../../plugins/vis_type_timeseries/server';
+import { Framework, ValidationTelemetryServiceSetup } from '../index';
const escapeHatch = schema.object({}, { allowUnknowns: true });
@@ -52,7 +49,11 @@ export const visDataRoutes = (
);
}
try {
- const results = await getVisData(requestContext, request.body, framework);
+ const results = await getVisData(
+ requestContext,
+ request as KibanaRequest<{}, {}, GetVisDataOptions>,
+ framework
+ );
return response.ok({ body: results });
} catch (error) {
return response.internalError({
diff --git a/test/functional/apps/management/_kibana_settings.js b/test/functional/apps/management/_kibana_settings.js
index 2dc5c395a605f..c99368ba4e859 100644
--- a/test/functional/apps/management/_kibana_settings.js
+++ b/test/functional/apps/management/_kibana_settings.js
@@ -22,7 +22,7 @@ import expect from '@kbn/expect';
export default function({ getService, getPageObjects }) {
const kibanaServer = getService('kibanaServer');
const browser = getService('browser');
- const PageObjects = getPageObjects(['settings', 'common', 'dashboard', 'timePicker']);
+ const PageObjects = getPageObjects(['settings', 'common', 'dashboard', 'timePicker', 'header']);
describe('kibana settings', function describeIndexTests() {
before(async function() {
@@ -94,14 +94,21 @@ export default function({ getService, getPageObjects }) {
expect(appState.length).to.be.lessThan(20);
});
- after(
- 'navigate to settings page and turn state:storeInSessionStorage back to false',
- async () => {
- await PageObjects.settings.navigateTo();
- await PageObjects.settings.clickKibanaSettings();
- await PageObjects.settings.toggleAdvancedSettingCheckbox('state:storeInSessionStorage');
- }
- );
+ it("changing 'state:storeInSessionStorage' also takes effect without full page reload", async () => {
+ await PageObjects.dashboard.preserveCrossAppState();
+ await PageObjects.header.clickStackManagement();
+ await PageObjects.settings.clickKibanaSettings();
+ await PageObjects.settings.toggleAdvancedSettingCheckbox('state:storeInSessionStorage');
+ await PageObjects.header.clickDashboard();
+ const currentUrl = await browser.getCurrentUrl();
+ const urlPieces = currentUrl.match(/(.*)?_g=(.*)&_a=(.*)/);
+ const globalState = urlPieces[2];
+ const appState = urlPieces[3];
+ // We don't have to be exact, just need to ensure it's greater than when the hashed variation is being used,
+ // which is less than 20 characters.
+ expect(globalState.length).to.be.greaterThan(20);
+ expect(appState.length).to.be.greaterThan(20);
+ });
});
after(async function() {
diff --git a/x-pack/index.js b/x-pack/index.js
index 83a7b5540334f..9ab6e2ee322d9 100644
--- a/x-pack/index.js
+++ b/x-pack/index.js
@@ -22,7 +22,6 @@ import { maps } from './legacy/plugins/maps';
import { licenseManagement } from './legacy/plugins/license_management';
import { indexManagement } from './legacy/plugins/index_management';
import { indexLifecycleManagement } from './legacy/plugins/index_lifecycle_management';
-import { consoleExtensions } from './legacy/plugins/console_extensions';
import { spaces } from './legacy/plugins/spaces';
import { kueryAutocompleteInitializer } from './legacy/plugins/kuery_autocomplete';
import { canvas } from './legacy/plugins/canvas';
@@ -65,7 +64,6 @@ module.exports = function(kibana) {
canvas(kibana),
licenseManagement(kibana),
indexManagement(kibana),
- consoleExtensions(kibana),
indexLifecycleManagement(kibana),
kueryAutocompleteInitializer(kibana),
infra(kibana),
diff --git a/x-pack/legacy/plugins/apm/public/components/app/ErrorGroupOverview/index.tsx b/x-pack/legacy/plugins/apm/public/components/app/ErrorGroupOverview/index.tsx
index 2e1efabf47b2c..2daf5e55d4e72 100644
--- a/x-pack/legacy/plugins/apm/public/components/app/ErrorGroupOverview/index.tsx
+++ b/x-pack/legacy/plugins/apm/public/components/app/ErrorGroupOverview/index.tsx
@@ -95,39 +95,42 @@ const ErrorGroupOverview: React.FC = () => {
}
return (
-
-
-
-
-
-
-
-
-
-
-
-
+ <>
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
- Errors
-
-
-
-
-
+
+
+ Errors
+
+
+
+
+
+
+
+ >
);
};
diff --git a/x-pack/legacy/plugins/apm/public/components/app/Home/index.tsx b/x-pack/legacy/plugins/apm/public/components/app/Home/index.tsx
index 4c98618d7de8a..5f8fa8bf5dc07 100644
--- a/x-pack/legacy/plugins/apm/public/components/app/Home/index.tsx
+++ b/x-pack/legacy/plugins/apm/public/components/app/Home/index.tsx
@@ -5,27 +5,26 @@
*/
import {
+ EuiButtonEmpty,
EuiFlexGroup,
EuiFlexItem,
- EuiTitle,
- EuiButtonEmpty,
EuiTabs,
- EuiSpacer
+ EuiTitle
} from '@elastic/eui';
import { i18n } from '@kbn/i18n';
import React from 'react';
import { $ElementType } from 'utility-types';
+import { useApmPluginContext } from '../../../hooks/useApmPluginContext';
import { ApmHeader } from '../../shared/ApmHeader';
-import { SetupInstructionsLink } from '../../shared/Links/SetupInstructionsLink';
-import { ServiceOverview } from '../ServiceOverview';
-import { TraceOverview } from '../TraceOverview';
-import { ServiceOverviewLink } from '../../shared/Links/apm/ServiceOverviewLink';
-import { TraceOverviewLink } from '../../shared/Links/apm/TraceOverviewLink';
import { EuiTabLink } from '../../shared/EuiTabLink';
-import { SettingsLink } from '../../shared/Links/apm/SettingsLink';
import { ServiceMapLink } from '../../shared/Links/apm/ServiceMapLink';
+import { ServiceOverviewLink } from '../../shared/Links/apm/ServiceOverviewLink';
+import { SettingsLink } from '../../shared/Links/apm/SettingsLink';
+import { TraceOverviewLink } from '../../shared/Links/apm/TraceOverviewLink';
+import { SetupInstructionsLink } from '../../shared/Links/SetupInstructionsLink';
import { ServiceMap } from '../ServiceMap';
-import { useApmPluginContext } from '../../../hooks/useApmPluginContext';
+import { ServiceOverview } from '../ServiceOverview';
+import { TraceOverview } from '../TraceOverview';
function getHomeTabs({
serviceMapEnabled = false
@@ -116,7 +115,6 @@ export function Home({ tab }: Props) {
))}
-
{selectedTab.render()}
);
diff --git a/x-pack/legacy/plugins/apm/public/components/app/ServiceDetails/ServiceDetailTabs.tsx b/x-pack/legacy/plugins/apm/public/components/app/ServiceDetails/ServiceDetailTabs.tsx
index 75ea02491967e..7ab2f7bac8ae2 100644
--- a/x-pack/legacy/plugins/apm/public/components/app/ServiceDetails/ServiceDetailTabs.tsx
+++ b/x-pack/legacy/plugins/apm/public/components/app/ServiceDetails/ServiceDetailTabs.tsx
@@ -4,24 +4,24 @@
* you may not use this file except in compliance with the Elastic License.
*/
+import { EuiTabs } from '@elastic/eui';
import { i18n } from '@kbn/i18n';
import React from 'react';
-import { EuiTabs, EuiSpacer } from '@elastic/eui';
-import { ErrorGroupOverview } from '../ErrorGroupOverview';
-import { TransactionOverview } from '../TransactionOverview';
-import { ServiceMetrics } from '../ServiceMetrics';
-import { isRumAgentName, isJavaAgentName } from '../../../../common/agent_name';
-import { EuiTabLink } from '../../shared/EuiTabLink';
+import { isJavaAgentName, isRumAgentName } from '../../../../common/agent_name';
+import { useAgentName } from '../../../hooks/useAgentName';
+import { useApmPluginContext } from '../../../hooks/useApmPluginContext';
import { useUrlParams } from '../../../hooks/useUrlParams';
-import { TransactionOverviewLink } from '../../shared/Links/apm/TransactionOverviewLink';
+import { EuiTabLink } from '../../shared/EuiTabLink';
import { ErrorOverviewLink } from '../../shared/Links/apm/ErrorOverviewLink';
import { MetricOverviewLink } from '../../shared/Links/apm/MetricOverviewLink';
+import { ServiceMapLink } from '../../shared/Links/apm/ServiceMapLink';
import { ServiceNodeOverviewLink } from '../../shared/Links/apm/ServiceNodeOverviewLink';
-import { ServiceNodeOverview } from '../ServiceNodeOverview';
-import { useAgentName } from '../../../hooks/useAgentName';
+import { TransactionOverviewLink } from '../../shared/Links/apm/TransactionOverviewLink';
+import { ErrorGroupOverview } from '../ErrorGroupOverview';
import { ServiceMap } from '../ServiceMap';
-import { ServiceMapLink } from '../../shared/Links/apm/ServiceMapLink';
-import { useApmPluginContext } from '../../../hooks/useApmPluginContext';
+import { ServiceMetrics } from '../ServiceMetrics';
+import { ServiceNodeOverview } from '../ServiceNodeOverview';
+import { TransactionOverview } from '../TransactionOverview';
interface Props {
tab: 'transactions' | 'errors' | 'metrics' | 'nodes' | 'service-map';
@@ -124,7 +124,6 @@ export function ServiceDetailTabs({ tab }: Props) {
))}
-
{selectedTab ? selectedTab.render() : null}
>
);
diff --git a/x-pack/legacy/plugins/apm/public/components/app/ServiceMap/Cytoscape.tsx b/x-pack/legacy/plugins/apm/public/components/app/ServiceMap/Cytoscape.tsx
index d69fa5d895b9e..f7d74bee1aa50 100644
--- a/x-pack/legacy/plugins/apm/public/components/app/ServiceMap/Cytoscape.tsx
+++ b/x-pack/legacy/plugins/apm/public/components/app/ServiceMap/Cytoscape.tsx
@@ -25,6 +25,7 @@ export const CytoscapeContext = createContext(
interface CytoscapeProps {
children?: ReactNode;
elements: cytoscape.ElementDefinition[];
+ height: number;
serviceName?: string;
style?: CSSProperties;
}
@@ -54,11 +55,16 @@ function useCytoscape(options: cytoscape.CytoscapeOptions) {
export function Cytoscape({
children,
elements,
+ height,
serviceName,
style
}: CytoscapeProps) {
const [ref, cy] = useCytoscape({ ...cytoscapeOptions, elements });
+ // Add the height to the div style. The height is a separate prop because it
+ // is required and can trigger rendering when changed.
+ const divStyle = { ...style, height };
+
// Trigger a custom "data" event when data changes
useEffect(() => {
if (cy) {
@@ -108,7 +114,7 @@ export function Cytoscape({
return (
-
+
{children}
diff --git a/x-pack/legacy/plugins/apm/public/components/app/ServiceMap/LoadingOverlay.tsx b/x-pack/legacy/plugins/apm/public/components/app/ServiceMap/LoadingOverlay.tsx
index efafdbcecd41c..c08d3acbf1861 100644
--- a/x-pack/legacy/plugins/apm/public/components/app/ServiceMap/LoadingOverlay.tsx
+++ b/x-pack/legacy/plugins/apm/public/components/app/ServiceMap/LoadingOverlay.tsx
@@ -31,16 +31,11 @@ const ProgressBarContainer = styled.div`
`;
interface Props {
- children: React.ReactNode;
isLoading: boolean;
percentageLoaded: number;
}
-export const LoadingOverlay = ({
- children,
- isLoading,
- percentageLoaded
-}: Props) => (
+export const LoadingOverlay = ({ isLoading, percentageLoaded }: Props) => (
{isLoading && (
@@ -61,6 +56,5 @@ export const LoadingOverlay = ({
)}
- {children}
);
diff --git a/x-pack/legacy/plugins/apm/public/components/app/ServiceMap/index.tsx b/x-pack/legacy/plugins/apm/public/components/app/ServiceMap/index.tsx
index a8e6f964f4d0c..24fb0b9e5d8a3 100644
--- a/x-pack/legacy/plugins/apm/public/components/app/ServiceMap/index.tsx
+++ b/x-pack/legacy/plugins/apm/public/components/app/ServiceMap/index.tsx
@@ -30,13 +30,13 @@ import { getCytoscapeElements } from './get_cytoscape_elements';
import { LoadingOverlay } from './LoadingOverlay';
import { PlatinumLicensePrompt } from './PlatinumLicensePrompt';
import { Popover } from './Popover';
+import { useRefHeight } from './useRefHeight';
interface ServiceMapProps {
serviceName?: string;
}
const cytoscapeDivStyle = {
- height: '85vh',
background: `linear-gradient(
90deg,
${theme.euiPageBackgroundColor}
@@ -52,7 +52,8 @@ linear-gradient(
center,
${theme.euiColorLightShade}`,
backgroundSize: `${theme.euiSizeL} ${theme.euiSizeL}`,
- margin: `-${theme.gutterTypes.gutterLarge}`
+ margin: `-${theme.gutterTypes.gutterLarge}`,
+ marginTop: 0
};
const MAX_REQUESTS = 5;
@@ -198,17 +199,27 @@ export function ServiceMap({ serviceName }: ServiceMapProps) {
license?.isActive &&
(license?.type === 'platinum' || license?.type === 'trial');
+ const [wrapperRef, height] = useRefHeight();
+
return isValidPlatinumLicense ? (
-
+
) : (
);
diff --git a/x-pack/legacy/plugins/apm/public/components/app/ServiceMap/useRefHeight.ts b/x-pack/legacy/plugins/apm/public/components/app/ServiceMap/useRefHeight.ts
new file mode 100644
index 0000000000000..b8fba47acd2d6
--- /dev/null
+++ b/x-pack/legacy/plugins/apm/public/components/app/ServiceMap/useRefHeight.ts
@@ -0,0 +1,20 @@
+/*
+ * 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 { MutableRefObject, useRef } from 'react';
+import { useWindowSize } from 'react-use';
+
+export function useRefHeight(): [
+ MutableRefObject,
+ number
+] {
+ const ref = useRef(null);
+ const windowHeight = useWindowSize().height;
+ const topOffset = ref.current?.getBoundingClientRect()?.top ?? 0;
+
+ const height = ref.current ? windowHeight - topOffset : 0;
+
+ return [ref, height];
+}
diff --git a/x-pack/legacy/plugins/apm/public/components/app/ServiceMetrics/index.tsx b/x-pack/legacy/plugins/apm/public/components/app/ServiceMetrics/index.tsx
index d01093be801a2..0fb8c00a2b162 100644
--- a/x-pack/legacy/plugins/apm/public/components/app/ServiceMetrics/index.tsx
+++ b/x-pack/legacy/plugins/apm/public/components/app/ServiceMetrics/index.tsx
@@ -43,24 +43,27 @@ export function ServiceMetrics({ agentName }: ServiceMetricsProps) {
);
return (
-
-
-
-
-
-
-
- {data.charts.map(chart => (
-
-
-
-
-
- ))}
-
-
-
-
-
+ <>
+
+
+
+
+
+
+
+
+ {data.charts.map(chart => (
+
+
+
+
+
+ ))}
+
+
+
+
+
+ >
);
}
diff --git a/x-pack/legacy/plugins/apm/public/components/app/ServiceNodeOverview/index.tsx b/x-pack/legacy/plugins/apm/public/components/app/ServiceNodeOverview/index.tsx
index a118871a5e268..4e57cb47691be 100644
--- a/x-pack/legacy/plugins/apm/public/components/app/ServiceNodeOverview/index.tsx
+++ b/x-pack/legacy/plugins/apm/public/components/app/ServiceNodeOverview/index.tsx
@@ -4,7 +4,13 @@
* you may not use this file except in compliance with the Elastic License.
*/
import React, { useMemo } from 'react';
-import { EuiFlexGroup, EuiFlexItem, EuiPanel, EuiToolTip } from '@elastic/eui';
+import {
+ EuiFlexGroup,
+ EuiFlexItem,
+ EuiPanel,
+ EuiToolTip,
+ EuiSpacer
+} from '@elastic/eui';
import { i18n } from '@kbn/i18n';
import styled from 'styled-components';
import { UNIDENTIFIED_SERVICE_NODES_LABEL } from '../../../../common/i18n';
@@ -150,25 +156,31 @@ const ServiceNodeOverview = () => {
];
return (
-
-
-
-
-
-
-
-
-
-
+ <>
+
+
+
+
+
+
+
+
+
+
+
+ >
);
};
diff --git a/x-pack/legacy/plugins/apm/public/components/app/ServiceOverview/index.tsx b/x-pack/legacy/plugins/apm/public/components/app/ServiceOverview/index.tsx
index 05ccc691ecdba..b522736c80f9b 100644
--- a/x-pack/legacy/plugins/apm/public/components/app/ServiceOverview/index.tsx
+++ b/x-pack/legacy/plugins/apm/public/components/app/ServiceOverview/index.tsx
@@ -4,7 +4,7 @@
* you may not use this file except in compliance with the Elastic License.
*/
-import { EuiPanel, EuiFlexGroup, EuiFlexItem } from '@elastic/eui';
+import { EuiPanel, EuiFlexGroup, EuiFlexItem, EuiSpacer } from '@elastic/eui';
import { EuiLink } from '@elastic/eui';
import { i18n } from '@kbn/i18n';
import React, { useEffect, useMemo } from 'react';
@@ -94,23 +94,26 @@ export function ServiceOverview() {
);
return (
-
-
-
-
-
-
-
- }
- />
-
-
-
+ <>
+
+
+
+
+
+
+
+
+ }
+ />
+
+
+
+ >
);
}
diff --git a/x-pack/legacy/plugins/apm/public/components/app/TraceOverview/index.tsx b/x-pack/legacy/plugins/apm/public/components/app/TraceOverview/index.tsx
index cf701d02aa5cb..dd3e2d13826dc 100644
--- a/x-pack/legacy/plugins/apm/public/components/app/TraceOverview/index.tsx
+++ b/x-pack/legacy/plugins/apm/public/components/app/TraceOverview/index.tsx
@@ -4,7 +4,7 @@
* you may not use this file except in compliance with the Elastic License.
*/
-import { EuiPanel, EuiFlexGroup, EuiFlexItem } from '@elastic/eui';
+import { EuiPanel, EuiFlexGroup, EuiFlexItem, EuiSpacer } from '@elastic/eui';
import React, { useMemo } from 'react';
import { FETCH_STATUS, useFetcher } from '../../../hooks/useFetcher';
import { TraceList } from './TraceList';
@@ -47,15 +47,21 @@ export function TraceOverview() {
}, []);
return (
-
-
-
-
-
-
-
-
-
-
+ <>
+
+
+
+
+
+
+
+
+
+
+
+ >
);
}
diff --git a/x-pack/legacy/plugins/apm/public/components/app/TransactionDetails/WaterfallWithSummmary/WaterfallContainer/Waterfall/SpanFlyout/index.tsx b/x-pack/legacy/plugins/apm/public/components/app/TransactionDetails/WaterfallWithSummmary/WaterfallContainer/Waterfall/SpanFlyout/index.tsx
index 4863d6519de07..6f93762e11a82 100644
--- a/x-pack/legacy/plugins/apm/public/components/app/TransactionDetails/WaterfallWithSummmary/WaterfallContainer/Waterfall/SpanFlyout/index.tsx
+++ b/x-pack/legacy/plugins/apm/public/components/app/TransactionDetails/WaterfallWithSummmary/WaterfallContainer/Waterfall/SpanFlyout/index.tsx
@@ -34,6 +34,7 @@ import { DatabaseContext } from './DatabaseContext';
import { StickySpanProperties } from './StickySpanProperties';
import { HttpInfoSummaryItem } from '../../../../../../shared/Summary/HttpInfoSummaryItem';
import { SpanMetadata } from '../../../../../../shared/MetadataTable/SpanMetadata';
+import { SyncBadge } from '../SyncBadge';
function formatType(type: string) {
switch (type) {
@@ -188,6 +189,7 @@ export function SpanFlyout({
{spanTypes.spanAction}
)}
+
>
]}
/>
diff --git a/x-pack/legacy/plugins/apm/public/components/app/TransactionDetails/WaterfallWithSummmary/WaterfallContainer/Waterfall/SyncBadge.stories.tsx b/x-pack/legacy/plugins/apm/public/components/app/TransactionDetails/WaterfallWithSummmary/WaterfallContainer/Waterfall/SyncBadge.stories.tsx
new file mode 100644
index 0000000000000..c7d3f6cc6f0c6
--- /dev/null
+++ b/x-pack/legacy/plugins/apm/public/components/app/TransactionDetails/WaterfallWithSummmary/WaterfallContainer/Waterfall/SyncBadge.stories.tsx
@@ -0,0 +1,44 @@
+/*
+ * 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 { storiesOf } from '@storybook/react';
+import React from 'react';
+import { SyncBadge } from './SyncBadge';
+
+storiesOf('app/TransactionDetails/SyncBadge', module)
+ .add(
+ 'sync=true',
+ () => {
+ return ;
+ },
+ {
+ info: {
+ source: false
+ }
+ }
+ )
+ .add(
+ 'sync=false',
+ () => {
+ return ;
+ },
+ {
+ info: {
+ source: false
+ }
+ }
+ )
+ .add(
+ 'sync=undefined',
+ () => {
+ return ;
+ },
+ {
+ info: {
+ source: false
+ }
+ }
+ );
diff --git a/x-pack/legacy/plugins/apm/public/components/app/TransactionDetails/WaterfallWithSummmary/WaterfallContainer/Waterfall/SyncBadge.tsx b/x-pack/legacy/plugins/apm/public/components/app/TransactionDetails/WaterfallWithSummmary/WaterfallContainer/Waterfall/SyncBadge.tsx
new file mode 100644
index 0000000000000..764f15f943ad2
--- /dev/null
+++ b/x-pack/legacy/plugins/apm/public/components/app/TransactionDetails/WaterfallWithSummmary/WaterfallContainer/Waterfall/SyncBadge.tsx
@@ -0,0 +1,46 @@
+/*
+ * 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 { EuiBadge } from '@elastic/eui';
+import { i18n } from '@kbn/i18n';
+import React from 'react';
+import styled from 'styled-components';
+import { px, units } from '../../../../../../style/variables';
+
+const SpanBadge = styled(EuiBadge)`
+ display: inline-block;
+ margin-right: ${px(units.quarter)};
+`;
+
+interface SyncBadgeProps {
+ /**
+ * Is the request synchronous? True will show blocking, false will show async.
+ */
+ sync?: boolean;
+}
+
+export function SyncBadge({ sync }: SyncBadgeProps) {
+ switch (sync) {
+ case true:
+ return (
+
+ {i18n.translate('xpack.apm.transactionDetails.syncBadgeBlocking', {
+ defaultMessage: 'blocking'
+ })}
+
+ );
+ case false:
+ return (
+
+ {i18n.translate('xpack.apm.transactionDetails.syncBadgeAsync', {
+ defaultMessage: 'async'
+ })}
+
+ );
+ default:
+ return null;
+ }
+}
diff --git a/x-pack/legacy/plugins/apm/public/components/app/TransactionDetails/WaterfallWithSummmary/WaterfallContainer/Waterfall/WaterfallItem.tsx b/x-pack/legacy/plugins/apm/public/components/app/TransactionDetails/WaterfallWithSummmary/WaterfallContainer/Waterfall/WaterfallItem.tsx
index 8a82547d717db..f57ccc3c34467 100644
--- a/x-pack/legacy/plugins/apm/public/components/app/TransactionDetails/WaterfallWithSummmary/WaterfallContainer/Waterfall/WaterfallItem.tsx
+++ b/x-pack/legacy/plugins/apm/public/components/app/TransactionDetails/WaterfallWithSummmary/WaterfallContainer/Waterfall/WaterfallItem.tsx
@@ -17,6 +17,7 @@ import { ErrorCount } from '../../ErrorCount';
import { IWaterfallItem } from './waterfall_helpers/waterfall_helpers';
import { ErrorOverviewLink } from '../../../../../shared/Links/apm/ErrorOverviewLink';
import { TRACE_ID } from '../../../../../../../common/elasticsearch_fieldnames';
+import { SyncBadge } from './SyncBadge';
type ItemType = 'transaction' | 'span' | 'error';
@@ -231,6 +232,7 @@ export function WaterfallItem({
) : null}
+ {item.docType === 'span' && }
);
diff --git a/x-pack/legacy/plugins/apm/public/components/app/TransactionOverview/index.tsx b/x-pack/legacy/plugins/apm/public/components/app/TransactionOverview/index.tsx
index 439e3d80eef4f..2cf01f8b40a09 100644
--- a/x-pack/legacy/plugins/apm/public/components/app/TransactionOverview/index.tsx
+++ b/x-pack/legacy/plugins/apm/public/components/app/TransactionOverview/index.tsx
@@ -119,41 +119,44 @@ export function TransactionOverview() {
}
return (
-
-
-
-
-
-
-
-
-
-
-
+ <>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
- Transactions
-
-
-
-
-
-
+
+
+ Transactions
+
+
+
+
+
+
+ >
);
}
diff --git a/x-pack/legacy/plugins/apm/public/new-platform/plugin.tsx b/x-pack/legacy/plugins/apm/public/new-platform/plugin.tsx
index de6cbc7d7a335..45d533348f80b 100644
--- a/x-pack/legacy/plugins/apm/public/new-platform/plugin.tsx
+++ b/x-pack/legacy/plugins/apm/public/new-platform/plugin.tsx
@@ -40,7 +40,7 @@ import { setReadonlyBadge } from './updateBadge';
export const REACT_APP_ROOT_ID = 'react-apm-root';
-const MainContainer = styled.main`
+const MainContainer = styled.div`
min-width: ${px(unit * 50)};
padding: ${px(units.plus)};
height: 100%;
@@ -48,7 +48,7 @@ const MainContainer = styled.main`
const App = () => {
return (
-
+
diff --git a/x-pack/legacy/plugins/canvas/public/components/router/index.js b/x-pack/legacy/plugins/canvas/public/components/router/index.js
deleted file mode 100644
index 430d6a5343662..0000000000000
--- a/x-pack/legacy/plugins/canvas/public/components/router/index.js
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * 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 { connect } from 'react-redux';
-import { setFullscreen } from '../../state/actions/transient';
-import {
- enableAutoplay,
- setRefreshInterval,
- setAutoplayInterval,
-} from '../../state/actions/workpad';
-import { Router as Component } from './router';
-
-const mapDispatchToState = {
- enableAutoplay,
- setAutoplayInterval,
- setFullscreen,
- setRefreshInterval,
-};
-
-export const Router = connect(null, mapDispatchToState)(Component);
diff --git a/x-pack/legacy/plugins/canvas/public/components/router/index.ts b/x-pack/legacy/plugins/canvas/public/components/router/index.ts
new file mode 100644
index 0000000000000..5e014870f5158
--- /dev/null
+++ b/x-pack/legacy/plugins/canvas/public/components/router/index.ts
@@ -0,0 +1,63 @@
+/*
+ * 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 { connect } from 'react-redux';
+// @ts-ignore untyped local
+import { setFullscreen } from '../../state/actions/transient';
+import {
+ enableAutoplay,
+ setRefreshInterval,
+ setAutoplayInterval,
+ // @ts-ignore untyped local
+} from '../../state/actions/workpad';
+// @ts-ignore untyped local
+import { Router as Component } from './router';
+import { State } from '../../../types';
+
+const mapDispatchToProps = {
+ enableAutoplay,
+ setAutoplayInterval,
+ setFullscreen,
+ setRefreshInterval,
+};
+
+const mapStateToProps = (state: State) => ({
+ refreshInterval: state.transient.refresh.interval,
+ autoplayInterval: state.transient.autoplay.interval,
+ autoplay: state.transient.autoplay.enabled,
+ fullscreen: state.transient.fullScreen,
+});
+
+export const Router = connect(
+ mapStateToProps,
+ mapDispatchToProps,
+ (stateProps, dispatchProps, ownProps) => {
+ return {
+ ...ownProps,
+ ...dispatchProps,
+ setRefreshInterval: (interval: number) => {
+ if (interval !== stateProps.refreshInterval) {
+ dispatchProps.setRefreshInterval(interval);
+ }
+ },
+ setAutoplayInterval: (interval: number) => {
+ if (interval !== stateProps.autoplayInterval) {
+ dispatchProps.setRefreshInterval(interval);
+ }
+ },
+ enableAutoplay: (autoplay: boolean) => {
+ if (autoplay !== stateProps.autoplay) {
+ dispatchProps.enableAutoplay(autoplay);
+ }
+ },
+ setFullscreen: (fullscreen: boolean) => {
+ if (fullscreen !== stateProps.fullscreen) {
+ dispatchProps.setFullscreen(fullscreen);
+ }
+ },
+ };
+ }
+)(Component);
diff --git a/x-pack/legacy/plugins/canvas/public/legacy_start.ts b/x-pack/legacy/plugins/canvas/public/legacy_start.ts
index 972427e166afc..21bf5aaa6d818 100644
--- a/x-pack/legacy/plugins/canvas/public/legacy_start.ts
+++ b/x-pack/legacy/plugins/canvas/public/legacy_start.ts
@@ -16,6 +16,12 @@ import 'uiExports/spyModes';
import 'uiExports/embeddableFactories';
import 'uiExports/interpreter';
+// TODO: These dependencies should be moved into plugin startup methods
+// Load the interpreter so that the kbnInterpreter global will be available when plugins load
+import 'plugins/interpreter/interpreter';
+// Load our app component to initialize registries
+import './components/app';
+
// load application code
import 'uiExports/canvas';
diff --git a/x-pack/legacy/plugins/canvas/public/lib/app_state.ts b/x-pack/legacy/plugins/canvas/public/lib/app_state.ts
index 955125b713140..c93e505c595fd 100644
--- a/x-pack/legacy/plugins/canvas/public/lib/app_state.ts
+++ b/x-pack/legacy/plugins/canvas/public/lib/app_state.ts
@@ -13,7 +13,7 @@ import { getWindow } from './get_window';
import { historyProvider } from './history_provider';
// @ts-ignore untyped local
import { routerProvider } from './router_provider';
-import { createTimeInterval, isValidTimeInterval } from './time_interval';
+import { createTimeInterval, isValidTimeInterval, getTimeInterval } from './time_interval';
import { AppState, AppStateKeys } from '../../types';
export function getDefaultAppState(): AppState {
@@ -112,7 +112,12 @@ export function setRefreshInterval(payload: string) {
const appValue = appState[AppStateKeys.REFRESH_INTERVAL];
if (payload !== appValue) {
- appState[AppStateKeys.REFRESH_INTERVAL] = payload;
- routerProvider().updateAppState(appState);
+ if (getTimeInterval(payload)) {
+ appState[AppStateKeys.REFRESH_INTERVAL] = payload;
+ routerProvider().updateAppState(appState);
+ } else {
+ delete appState[AppStateKeys.REFRESH_INTERVAL];
+ routerProvider().updateAppState(appState);
+ }
}
}
diff --git a/x-pack/legacy/plugins/console_extensions/index.js b/x-pack/legacy/plugins/console_extensions/index.js
deleted file mode 100644
index fd1b48f0fd6b1..0000000000000
--- a/x-pack/legacy/plugins/console_extensions/index.js
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * 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 { join } from 'path';
-import { processors } from './spec/ingest';
-
-export function consoleExtensions(kibana) {
- return new kibana.Plugin({
- id: 'console_extensions',
- require: ['kibana', 'console'],
- isEnabled(config) {
- return (
- config.get('console_extensions.enabled') &&
- config.has('console.enabled') &&
- config.get('console.enabled')
- );
- },
-
- config(Joi) {
- return Joi.object({
- enabled: Joi.boolean().default(true),
- }).default();
- },
-
- init: server => {
- if (
- server.plugins.console &&
- server.plugins.console.addExtensionSpecFilePath &&
- server.plugins.console.addProcessorDefinition
- ) {
- const { addExtensionSpecFilePath, addProcessorDefinition } = server.plugins.console;
-
- addExtensionSpecFilePath(join(__dirname, 'spec/'));
-
- processors.forEach(processor => addProcessorDefinition(processor));
- } else {
- console.warn(
- 'Missing server.plugins.console.addExtensionSpecFilePath extension point.',
- 'Cannot add xpack APIs to autocomplete.'
- );
- }
- },
- });
-}
diff --git a/x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/__jest__/client_integration/helpers/mappings_editor.helpers.ts b/x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/__jest__/client_integration/helpers/mappings_editor.helpers.ts
index b8b67a0f36bd2..dcee956130a29 100644
--- a/x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/__jest__/client_integration/helpers/mappings_editor.helpers.ts
+++ b/x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/__jest__/client_integration/helpers/mappings_editor.helpers.ts
@@ -13,4 +13,4 @@ export const setup = (props: any) =>
wrapComponent: false,
},
defaultProps: props,
- });
+ })();
diff --git a/x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/__jest__/client_integration/mappings_editor.test.tsx b/x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/__jest__/client_integration/mappings_editor.test.tsx
index 9e390e785c7d5..723c105d403b8 100644
--- a/x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/__jest__/client_integration/mappings_editor.test.tsx
+++ b/x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/__jest__/client_integration/mappings_editor.test.tsx
@@ -28,7 +28,7 @@ describe(' ', () => {
},
},
};
- const testBed = await setup({ onUpdate: mockOnUpdate, defaultValue })();
+ const testBed = await setup({ onUpdate: mockOnUpdate, defaultValue });
const { exists } = testBed;
expect(exists('mappingsEditor')).toBe(true);
@@ -44,7 +44,7 @@ describe(' ', () => {
},
},
};
- const testBed = await setup({ onUpdate: mockOnUpdate, defaultValue })();
+ const testBed = await setup({ onUpdate: mockOnUpdate, defaultValue });
const { exists } = testBed;
expect(exists('mappingsEditor')).toBe(true);
diff --git a/x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/components/load_mappings/load_mappings_provider.test.tsx b/x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/components/load_mappings/load_mappings_provider.test.tsx
new file mode 100644
index 0000000000000..a9433d3a7530f
--- /dev/null
+++ b/x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/components/load_mappings/load_mappings_provider.test.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 React from 'react';
+import { act } from 'react-dom/test-utils';
+
+jest.mock('@elastic/eui', () => ({
+ ...jest.requireActual('@elastic/eui'),
+ // Mocking EuiCodeEditor, which uses React Ace under the hood
+ EuiCodeEditor: (props: any) => (
+ {
+ props.onChange(syntheticEvent.jsonString);
+ }}
+ />
+ ),
+}));
+
+import { registerTestBed, nextTick, TestBed } from '../../../../../../../../../test_utils';
+import { LoadMappingsProvider } from './load_mappings_provider';
+
+const ComponentToTest = ({ onJson }: { onJson: () => void }) => (
+
+ {openModal => (
+
+ Load JSON
+
+ )}
+
+);
+
+const setup = (props: any) =>
+ registerTestBed(ComponentToTest, {
+ memoryRouter: { wrapComponent: false },
+ defaultProps: props,
+ })();
+
+const openModalWithJsonContent = ({ find, component }: TestBed) => async (json: any) => {
+ find('load-json-button').simulate('click');
+ component.update();
+
+ // Set the mappings to load
+ // @ts-ignore
+ await act(async () => {
+ find('mockCodeEditor').simulate('change', {
+ jsonString: JSON.stringify(json),
+ });
+ await nextTick(300); // There is a debounce in the JsonEditor that we need to wait for
+ });
+};
+
+describe(' ', () => {
+ test('it should forward valid mapping definition', async () => {
+ const mappingsToLoad = {
+ properties: {
+ title: {
+ type: 'text',
+ },
+ },
+ };
+
+ const onJson = jest.fn();
+ const testBed = await setup({ onJson });
+
+ // Open the modal and add the JSON
+ await openModalWithJsonContent(testBed)(mappingsToLoad);
+
+ // Confirm
+ testBed.find('confirmModalConfirmButton').simulate('click');
+
+ const [jsonReturned] = onJson.mock.calls[0];
+ expect(jsonReturned).toEqual({ ...mappingsToLoad, dynamic_templates: [] });
+ });
+});
diff --git a/x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/components/load_mappings/load_mappings_provider.tsx b/x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/components/load_mappings/load_mappings_provider.tsx
index a55bd96dce3d0..6bc360a1ec70e 100644
--- a/x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/components/load_mappings/load_mappings_provider.tsx
+++ b/x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/components/load_mappings/load_mappings_provider.tsx
@@ -25,7 +25,7 @@ type OpenJsonModalFunc = () => void;
interface Props {
onJson(json: { [key: string]: any }): void;
- children: (deleteProperty: OpenJsonModalFunc) => React.ReactNode;
+ children: (openModal: OpenJsonModalFunc) => React.ReactNode;
}
interface State {
diff --git a/x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/lib/extract_mappings_definition.ts b/x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/lib/extract_mappings_definition.ts
index eae3c5b15759c..817b0f4a4d3d0 100644
--- a/x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/lib/extract_mappings_definition.ts
+++ b/x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/lib/extract_mappings_definition.ts
@@ -6,15 +6,10 @@
import { isPlainObject } from 'lodash';
import { GenericObject } from '../types';
-import {
- validateMappingsConfiguration,
- mappingsConfigurationSchemaKeys,
-} from './mappings_validator';
-
-const ALLOWED_PARAMETERS = [...mappingsConfigurationSchemaKeys, 'dynamic_templates', 'properties'];
+import { validateMappingsConfiguration, VALID_MAPPINGS_PARAMETERS } from './mappings_validator';
const isMappingDefinition = (obj: GenericObject): boolean => {
- const areAllKeysValid = Object.keys(obj).every(key => ALLOWED_PARAMETERS.includes(key));
+ const areAllKeysValid = Object.keys(obj).every(key => VALID_MAPPINGS_PARAMETERS.includes(key));
if (!areAllKeysValid) {
return false;
diff --git a/x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/lib/mappings_validator.test.ts b/x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/lib/mappings_validator.test.ts
index f1e6efb06c649..d67c267dda6ae 100644
--- a/x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/lib/mappings_validator.test.ts
+++ b/x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/lib/mappings_validator.test.ts
@@ -18,6 +18,24 @@ describe('Mappings configuration validator', () => {
});
});
+ it('should detect valid mappings configuration', () => {
+ const mappings = {
+ _source: {
+ includes: [],
+ excludes: [],
+ enabled: true,
+ },
+ _meta: {},
+ _routing: {
+ required: false,
+ },
+ dynamic: true,
+ };
+
+ const { errors } = validateMappings(mappings);
+ expect(errors).toBe(undefined);
+ });
+
it('should strip out unknown configuration', () => {
const mappings = {
dynamic: true,
@@ -30,6 +48,7 @@ describe('Mappings configuration validator', () => {
excludes: ['abc'],
},
properties: { title: { type: 'text' } },
+ dynamic_templates: [],
unknown: 123,
};
@@ -37,7 +56,7 @@ describe('Mappings configuration validator', () => {
const { unknown, ...expected } = mappings;
expect(value).toEqual(expected);
- expect(errors).toBe(undefined);
+ expect(errors).toEqual([{ code: 'ERR_CONFIG', configName: 'unknown' }]);
});
it('should strip out invalid configuration and returns the errors for each of them', () => {
@@ -47,9 +66,8 @@ describe('Mappings configuration validator', () => {
dynamic_date_formats: false, // wrong format
_source: {
enabled: true,
- includes: 'abc',
+ unknownProp: 'abc', // invalid
excludes: ['abc'],
- wrong: 123, // parameter not allowed
},
properties: 'abc',
};
@@ -59,10 +77,10 @@ describe('Mappings configuration validator', () => {
expect(value).toEqual({
dynamic: true,
properties: {},
+ dynamic_templates: [],
});
expect(errors).not.toBe(undefined);
- expect(errors!.length).toBe(3);
expect(errors!).toEqual([
{ code: 'ERR_CONFIG', configName: '_source' },
{ code: 'ERR_CONFIG', configName: 'dynamic_date_formats' },
diff --git a/x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/lib/mappings_validator.ts b/x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/lib/mappings_validator.ts
index 6ccbfeb50dcf4..78d638e398593 100644
--- a/x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/lib/mappings_validator.ts
+++ b/x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/lib/mappings_validator.ts
@@ -196,23 +196,30 @@ export const validateProperties = (properties = {}): PropertiesValidatorResponse
* Single source of truth to validate the *configuration* of the mappings.
* Whenever a user loads a JSON object it will be validate against this Joi schema.
*/
-export const mappingsConfigurationSchema = t.partial({
- dynamic: t.union([t.literal(true), t.literal(false), t.literal('strict')]),
- date_detection: t.boolean,
- numeric_detection: t.boolean,
- dynamic_date_formats: t.array(t.string),
- _source: t.partial({
- enabled: t.boolean,
- includes: t.array(t.string),
- excludes: t.array(t.string),
- }),
- _meta: t.UnknownRecord,
- _routing: t.partial({
- required: t.boolean,
- }),
-});
-
-export const mappingsConfigurationSchemaKeys = Object.keys(mappingsConfigurationSchema.props);
+export const mappingsConfigurationSchema = t.exact(
+ t.partial({
+ dynamic: t.union([t.literal(true), t.literal(false), t.literal('strict')]),
+ date_detection: t.boolean,
+ numeric_detection: t.boolean,
+ dynamic_date_formats: t.array(t.string),
+ _source: t.exact(
+ t.partial({
+ enabled: t.boolean,
+ includes: t.array(t.string),
+ excludes: t.array(t.string),
+ })
+ ),
+ _meta: t.UnknownRecord,
+ _routing: t.interface({
+ required: t.boolean,
+ }),
+ })
+);
+
+const mappingsConfigurationSchemaKeys = Object.keys(mappingsConfigurationSchema.type.props);
+const sourceConfigurationSchemaKeys = Object.keys(
+ mappingsConfigurationSchema.type.props._source.type.props
+);
export const validateMappingsConfiguration = (
mappingsConfiguration: any
@@ -222,8 +229,20 @@ export const validateMappingsConfiguration = (
let copyOfMappingsConfig = { ...mappingsConfiguration };
const result = mappingsConfigurationSchema.decode(mappingsConfiguration);
+ const isSchemaInvalid = isLeft(result);
- if (isLeft(result)) {
+ const unknownConfigurationParameters = Object.keys(mappingsConfiguration).filter(
+ key => mappingsConfigurationSchemaKeys.includes(key) === false
+ );
+
+ const unknownSourceConfigurationParameters =
+ mappingsConfiguration._source !== undefined
+ ? Object.keys(mappingsConfiguration._source).filter(
+ key => sourceConfigurationSchemaKeys.includes(key) === false
+ )
+ : [];
+
+ if (isSchemaInvalid) {
/**
* To keep the logic simple we will strip out the parameters that contain errors
*/
@@ -235,6 +254,15 @@ export const validateMappingsConfiguration = (
});
}
+ if (unknownConfigurationParameters.length > 0) {
+ unknownConfigurationParameters.forEach(configName => configurationRemoved.add(configName));
+ }
+
+ if (unknownSourceConfigurationParameters.length > 0) {
+ configurationRemoved.add('_source');
+ delete copyOfMappingsConfig._source;
+ }
+
copyOfMappingsConfig = pick(copyOfMappingsConfig, mappingsConfigurationSchemaKeys);
const errors: MappingsValidationError[] = toArray(ordString)(configurationRemoved)
@@ -252,7 +280,7 @@ export const validateMappings = (mappings: any = {}): MappingsValidatorResponse
return { value: {} };
}
- const { properties, dynamic_templates, ...mappingsConfiguration } = mappings;
+ const { properties, dynamic_templates: dynamicTemplates, ...mappingsConfiguration } = mappings;
const { value: parsedConfiguration, errors: configurationErrors } = validateMappingsConfiguration(
mappingsConfiguration
@@ -265,8 +293,14 @@ export const validateMappings = (mappings: any = {}): MappingsValidatorResponse
value: {
...parsedConfiguration,
properties: parsedProperties,
- dynamic_templates,
+ dynamic_templates: dynamicTemplates ?? [],
},
errors: errors.length ? errors : undefined,
};
};
+
+export const VALID_MAPPINGS_PARAMETERS = [
+ ...mappingsConfigurationSchemaKeys,
+ 'dynamic_templates',
+ 'properties',
+];
diff --git a/x-pack/legacy/plugins/infra/server/lib/adapters/framework/kibana_framework_adapter.ts b/x-pack/legacy/plugins/infra/server/lib/adapters/framework/kibana_framework_adapter.ts
index 4409667d8390a..4b1aa774a523f 100644
--- a/x-pack/legacy/plugins/infra/server/lib/adapters/framework/kibana_framework_adapter.ts
+++ b/x-pack/legacy/plugins/infra/server/lib/adapters/framework/kibana_framework_adapter.ts
@@ -241,6 +241,7 @@ export class KibanaFramework {
public async makeTSVBRequest(
requestContext: RequestHandlerContext,
+ rawRequest: KibanaRequest,
model: TSVBMetricModel,
timerange: { min: number; max: number },
filters: any[]
@@ -254,6 +255,6 @@ export class KibanaFramework {
panels: [model],
filters,
};
- return getVisData(requestContext, options);
+ return getVisData(requestContext, rawRequest, options);
}
}
diff --git a/x-pack/legacy/plugins/infra/server/lib/adapters/metrics/kibana_metrics_adapter.ts b/x-pack/legacy/plugins/infra/server/lib/adapters/metrics/kibana_metrics_adapter.ts
index eb5ac05644a22..5a5f9d0f8f529 100644
--- a/x-pack/legacy/plugins/infra/server/lib/adapters/metrics/kibana_metrics_adapter.ts
+++ b/x-pack/legacy/plugins/infra/server/lib/adapters/metrics/kibana_metrics_adapter.ts
@@ -51,7 +51,7 @@ export class KibanaMetricsAdapter implements InfraMetricsAdapter {
}
const requests = options.metrics.map(metricId =>
- this.makeTSVBRequest(metricId, options, nodeField, requestContext)
+ this.makeTSVBRequest(metricId, options, nodeField, requestContext, rawRequest)
);
return Promise.all(requests)
@@ -93,7 +93,8 @@ export class KibanaMetricsAdapter implements InfraMetricsAdapter {
metricId: InventoryMetric,
options: InfraMetricsRequestOptions,
nodeField: string,
- requestContext: RequestHandlerContext
+ requestContext: RequestHandlerContext,
+ rawRequest: KibanaRequest
) {
const createTSVBModel = get(metrics, ['tsvb', metricId]) as TSVBMetricModelCreator | undefined;
if (!createTSVBModel) {
@@ -152,6 +153,6 @@ export class KibanaMetricsAdapter implements InfraMetricsAdapter {
? [{ match: { [model.map_field_to]: id } }]
: [{ match: { [nodeField]: id } }];
- return this.framework.makeTSVBRequest(requestContext, model, timerange, filters);
+ return this.framework.makeTSVBRequest(requestContext, rawRequest, model, timerange, filters);
}
}
diff --git a/x-pack/legacy/plugins/infra/server/routes/metrics_explorer/lib/populate_series_with_tsvb_data.ts b/x-pack/legacy/plugins/infra/server/routes/metrics_explorer/lib/populate_series_with_tsvb_data.ts
index 8ab3fdccbe72b..347feca67aa99 100644
--- a/x-pack/legacy/plugins/infra/server/routes/metrics_explorer/lib/populate_series_with_tsvb_data.ts
+++ b/x-pack/legacy/plugins/infra/server/routes/metrics_explorer/lib/populate_series_with_tsvb_data.ts
@@ -76,7 +76,13 @@ export const populateSeriesWithTSVBData = (
}
// Get TSVB results using the model, timerange and filters
- const tsvbResults = await framework.makeTSVBRequest(requestContext, model, timerange, filters);
+ const tsvbResults = await framework.makeTSVBRequest(
+ requestContext,
+ request,
+ model,
+ timerange,
+ filters
+ );
// If there is no data `custom` will not exist.
if (!tsvbResults.custom) {
diff --git a/x-pack/legacy/plugins/maps/public/components/single_field_select.js b/x-pack/legacy/plugins/maps/public/components/single_field_select.js
index ba9ef1f22c54c..7351ce7691a82 100644
--- a/x-pack/legacy/plugins/maps/public/components/single_field_select.js
+++ b/x-pack/legacy/plugins/maps/public/components/single_field_select.js
@@ -8,63 +8,50 @@ import _ from 'lodash';
import PropTypes from 'prop-types';
import React from 'react';
-import { EuiComboBox } from '@elastic/eui';
+import { EuiComboBox, EuiHighlight } from '@elastic/eui';
+import { FieldIcon } from '../../../../../../src/plugins/kibana_react/public';
-const sortByLabel = (a, b) => {
- if (a.label < b.label) return -1;
- if (a.label > b.label) return 1;
- return 0;
-};
-
-// Creates grouped options by grouping fields by field type
-export const getGroupedFieldOptions = (fields, filterField) => {
+function fieldsToOptions(fields) {
if (!fields) {
- return;
+ return [];
}
- const fieldsByTypeMap = new Map();
-
- fields.filter(filterField).forEach(field => {
- const fieldLabel = 'label' in field ? field.label : field.name;
- if (fieldsByTypeMap.has(field.type)) {
- const fieldsList = fieldsByTypeMap.get(field.type);
- fieldsList.push({ value: field.name, label: fieldLabel });
- fieldsByTypeMap.set(field.type, fieldsList);
- } else {
- fieldsByTypeMap.set(field.type, [{ value: field.name, label: fieldLabel }]);
- }
- });
-
- const groupedFieldOptions = [];
- fieldsByTypeMap.forEach((fieldsList, fieldType) => {
- const sortedOptions = fieldsList.sort(sortByLabel).map(({ value, label }) => {
- return { value: value, label: label };
+ return fields
+ .map(field => {
+ return {
+ value: field,
+ label: 'label' in field ? field.label : field.name,
+ };
+ })
+ .sort((a, b) => {
+ return a.label.toLowerCase().localeCompare(b.label.toLowerCase());
});
+}
- groupedFieldOptions.push({
- label: fieldType,
- options: sortedOptions,
- });
- });
-
- groupedFieldOptions.sort(sortByLabel);
-
- return groupedFieldOptions;
-};
+function renderOption(option, searchValue, contentClassName) {
+ return (
+
+
+
+ {option.label}
+
+ );
+}
-export function SingleFieldSelect({ fields, filterField, onChange, value, placeholder, ...rest }) {
+export function SingleFieldSelect({ fields, onChange, value, placeholder, ...rest }) {
const onSelection = selectedOptions => {
- onChange(_.get(selectedOptions, '0.value'));
+ onChange(_.get(selectedOptions, '0.value.name'));
};
return (
);
@@ -75,11 +62,4 @@ SingleFieldSelect.propTypes = {
fields: PropTypes.array,
onChange: PropTypes.func.isRequired,
value: PropTypes.string, // fieldName
- filterField: PropTypes.func,
-};
-
-SingleFieldSelect.defaultProps = {
- filterField: () => {
- return true;
- },
};
diff --git a/x-pack/legacy/plugins/maps/public/connected_components/layer_panel/join_editor/resources/join_expression.js b/x-pack/legacy/plugins/maps/public/connected_components/layer_panel/join_editor/resources/join_expression.js
index 76827e71df9ec..777c8ae0923fe 100644
--- a/x-pack/legacy/plugins/maps/public/connected_components/layer_panel/join_editor/resources/join_expression.js
+++ b/x-pack/legacy/plugins/maps/public/connected_components/layer_panel/join_editor/resources/join_expression.js
@@ -23,7 +23,6 @@ import { getTermsFields } from '../../../../index_pattern_util';
import { indexPatternService } from '../../../../kibana_services';
import { npStart } from 'ui/new_platform';
-import { isNestedField } from '../../../../../../../../../src/plugins/data/public';
const { IndexPatternSelect } = npStart.plugins.data.ui;
export class JoinExpression extends Component {
@@ -134,10 +133,6 @@ export class JoinExpression extends Component {
return null;
}
- const filterStringOrNumberFields = field => {
- return (field.type === 'string' && !isNestedField(field)) || field.type === 'number';
- };
-
return (
diff --git a/x-pack/legacy/plugins/maps/public/index_pattern_util.js b/x-pack/legacy/plugins/maps/public/index_pattern_util.js
index 10837bc2f0d0c..96d4a4b19fbfa 100644
--- a/x-pack/legacy/plugins/maps/public/index_pattern_util.js
+++ b/x-pack/legacy/plugins/maps/public/index_pattern_util.js
@@ -6,6 +6,7 @@
import { indexPatternService } from './kibana_services';
import { isNestedField } from '../../../../../src/plugins/data/public';
+import { ES_GEO_FIELD_TYPE } from '../common/constants';
export async function getIndexPatternsFromIds(indexPatternIds = []) {
const promises = [];
@@ -29,6 +30,18 @@ export function getTermsFields(fields) {
});
}
+export const AGGREGATABLE_GEO_FIELD_TYPES = [ES_GEO_FIELD_TYPE.GEO_POINT];
+
+export function getAggregatableGeoFields(fields) {
+ return fields.filter(field => {
+ return (
+ field.aggregatable &&
+ !isNestedField(field) &&
+ AGGREGATABLE_GEO_FIELD_TYPES.includes(field.type)
+ );
+ });
+}
+
// Returns filtered fields list containing only fields that exist in _source.
export function getSourceFields(fields) {
return fields.filter(field => {
diff --git a/x-pack/legacy/plugins/maps/public/layers/sources/es_geo_grid_source/create_source_editor.js b/x-pack/legacy/plugins/maps/public/layers/sources/es_geo_grid_source/create_source_editor.js
index c32b857b49171..bd074386edb3f 100644
--- a/x-pack/legacy/plugins/maps/public/layers/sources/es_geo_grid_source/create_source_editor.js
+++ b/x-pack/legacy/plugins/maps/public/layers/sources/es_geo_grid_source/create_source_editor.js
@@ -15,16 +15,14 @@ import { NoIndexPatternCallout } from '../../../components/no_index_pattern_call
import { i18n } from '@kbn/i18n';
import { EuiFormRow, EuiComboBox, EuiSpacer } from '@elastic/eui';
-import { ES_GEO_FIELD_TYPE } from '../../../../common/constants';
-import { isNestedField } from '../../../../../../../../src/plugins/data/public';
+import {
+ AGGREGATABLE_GEO_FIELD_TYPES,
+ getAggregatableGeoFields,
+} from '../../../index_pattern_util';
import { npStart } from 'ui/new_platform';
const { IndexPatternSelect } = npStart.plugins.data.ui;
-function filterGeoField({ type }) {
- return [ES_GEO_FIELD_TYPE.GEO_POINT].includes(type);
-}
-
const requestTypeOptions = [
{
label: i18n.translate('xpack.maps.source.esGeoGrid.gridRectangleDropdownOption', {
@@ -116,9 +114,7 @@ export class CreateSourceEditor extends Component {
});
//make default selection
- const geoFields = indexPattern.fields
- .filter(field => !isNestedField(field))
- .filter(filterGeoField);
+ const geoFields = getAggregatableGeoFields(indexPattern.fields);
if (geoFields[0]) {
this._onGeoFieldSelect(geoFields[0].name);
}
@@ -173,10 +169,9 @@ export class CreateSourceEditor extends Component {
})}
value={this.state.geoField}
onChange={this._onGeoFieldSelect}
- filterField={filterGeoField}
fields={
this.state.indexPattern
- ? this.state.indexPattern.fields.filter(field => !isNestedField(field))
+ ? getAggregatableGeoFields(this.state.indexPattern.fields)
: undefined
}
/>
@@ -223,7 +218,7 @@ export class CreateSourceEditor extends Component {
placeholder={i18n.translate('xpack.maps.source.esGeoGrid.indexPatternPlaceholder', {
defaultMessage: 'Select index pattern',
})}
- fieldTypes={[ES_GEO_FIELD_TYPE.GEO_POINT]}
+ fieldTypes={AGGREGATABLE_GEO_FIELD_TYPES}
onNoIndexPatterns={this._onNoIndexPatterns}
/>
diff --git a/x-pack/legacy/plugins/maps/public/layers/sources/es_pew_pew_source/create_source_editor.js b/x-pack/legacy/plugins/maps/public/layers/sources/es_pew_pew_source/create_source_editor.js
index 85d63c9da8a31..5e4727cd7ab0c 100644
--- a/x-pack/legacy/plugins/maps/public/layers/sources/es_pew_pew_source/create_source_editor.js
+++ b/x-pack/legacy/plugins/maps/public/layers/sources/es_pew_pew_source/create_source_editor.js
@@ -14,16 +14,13 @@ import { i18n } from '@kbn/i18n';
import { FormattedMessage } from '@kbn/i18n/react';
import { EuiFormRow, EuiCallOut } from '@elastic/eui';
-import { ES_GEO_FIELD_TYPE } from '../../../../common/constants';
-import { isNestedField } from '../../../../../../../../src/plugins/data/public';
+import {
+ AGGREGATABLE_GEO_FIELD_TYPES,
+ getAggregatableGeoFields,
+} from '../../../index_pattern_util';
import { npStart } from 'ui/new_platform';
const { IndexPatternSelect } = npStart.plugins.data.ui;
-const GEO_FIELD_TYPES = [ES_GEO_FIELD_TYPE.GEO_POINT];
-
-function filterGeoField({ type }) {
- return GEO_FIELD_TYPES.includes(type);
-}
export class CreateSourceEditor extends Component {
static propTypes = {
@@ -92,10 +89,7 @@ export class CreateSourceEditor extends Component {
return;
}
- const geoFields = indexPattern.fields
- .filter(field => !isNestedField(field))
- .filter(filterGeoField);
-
+ const geoFields = getAggregatableGeoFields(indexPattern.fields);
this.setState({
isLoadingIndexPattern: false,
indexPattern: indexPattern,
@@ -136,6 +130,9 @@ export class CreateSourceEditor extends Component {
return null;
}
+ const fields = this.state.indexPattern
+ ? getAggregatableGeoFields(this.state.indexPattern.fields)
+ : undefined;
return (
@@ -165,12 +161,7 @@ export class CreateSourceEditor extends Component {
})}
value={this.state.destGeoField}
onChange={this._onDestGeoSelect}
- filterField={filterGeoField}
- fields={
- this.state.indexPattern
- ? this.state.indexPattern.fields.filter(field => !isNestedField(field))
- : undefined
- }
+ fields={fields}
/>
@@ -190,7 +181,7 @@ export class CreateSourceEditor extends Component {
placeholder={i18n.translate('xpack.maps.source.pewPew.indexPatternPlaceholder', {
defaultMessage: 'Select index pattern',
})}
- fieldTypes={GEO_FIELD_TYPES}
+ fieldTypes={AGGREGATABLE_GEO_FIELD_TYPES}
/>
);
diff --git a/x-pack/legacy/plugins/maps/public/layers/sources/es_search_source/__snapshots__/update_source_editor.test.js.snap b/x-pack/legacy/plugins/maps/public/layers/sources/es_search_source/__snapshots__/update_source_editor.test.js.snap
index 9afe22a5f4550..80368fd5d5e3e 100644
--- a/x-pack/legacy/plugins/maps/public/layers/sources/es_search_source/__snapshots__/update_source_editor.test.js.snap
+++ b/x-pack/legacy/plugins/maps/public/layers/sources/es_search_source/__snapshots__/update_source_editor.test.js.snap
@@ -53,7 +53,6 @@ exports[`should enable sort order select when sort field provided 1`] = `
@@ -230,7 +228,6 @@ exports[`should render top hits form when useTopHits is true 1`] = `
diff --git a/x-pack/legacy/plugins/maps/public/layers/sources/es_search_source/create_source_editor.js b/x-pack/legacy/plugins/maps/public/layers/sources/es_search_source/create_source_editor.js
index 69e4c09eed118..ad55a279f9cd7 100644
--- a/x-pack/legacy/plugins/maps/public/layers/sources/es_search_source/create_source_editor.js
+++ b/x-pack/legacy/plugins/maps/public/layers/sources/es_search_source/create_source_editor.js
@@ -26,8 +26,13 @@ import { isNestedField } from '../../../../../../../../src/plugins/data/public';
import { npStart } from 'ui/new_platform';
const { IndexPatternSelect } = npStart.plugins.data.ui;
-function filterGeoField(field) {
- return [ES_GEO_FIELD_TYPE.GEO_POINT, ES_GEO_FIELD_TYPE.GEO_SHAPE].includes(field.type);
+function getGeoFields(fields) {
+ return fields.filter(field => {
+ return (
+ !isNestedField(field) &&
+ [ES_GEO_FIELD_TYPE.GEO_POINT, ES_GEO_FIELD_TYPE.GEO_SHAPE].includes(field.type)
+ );
+ });
}
const RESET_INDEX_PATTERN_STATE = {
indexPattern: undefined,
@@ -125,9 +130,7 @@ export class CreateSourceEditor extends Component {
});
//make default selection
- const geoFields = indexPattern.fields
- .filter(field => !isNestedField(field))
- .filter(filterGeoField);
+ const geoFields = getGeoFields(indexPattern.fields);
if (geoFields[0]) {
this.onGeoFieldSelect(geoFields[0].name);
}
@@ -180,11 +183,8 @@ export class CreateSourceEditor extends Component {
})}
value={this.state.geoField}
onChange={this.onGeoFieldSelect}
- filterField={filterGeoField}
fields={
- this.state.indexPattern
- ? this.state.indexPattern.fields.filter(field => !isNestedField(field))
- : undefined
+ this.state.indexPattern ? getGeoFields(this.state.indexPattern.fields) : undefined
}
/>
diff --git a/x-pack/legacy/plugins/ml/public/application/util/url_state.test.ts b/x-pack/legacy/plugins/ml/public/application/util/url_state.test.ts
index 91bbef2dba6c2..0813f2e3da97f 100644
--- a/x-pack/legacy/plugins/ml/public/application/util/url_state.test.ts
+++ b/x-pack/legacy/plugins/ml/public/application/util/url_state.test.ts
@@ -75,7 +75,7 @@ describe('useUrlState', () => {
expect(mockHistoryPush).toHaveBeenCalledWith({
search:
- '_a=%28mlExplorerFilter%3A%28%29%2CmlExplorerSwimlane%3A%28viewByFieldName%3Aaction%29%2Cquery%3A%28%29%29&_g=%28ml%3A%28jobIds%3A%21%28dec-2%29%29%2CrefreshInterval%3A%28display%3AOff%2Cpause%3A%21f%2Cvalue%3A0%29%2Ctime%3A%28from%3A%272019-01-01T00%3A03%3A40.000Z%27%2Cmode%3Aabsolute%2Cto%3A%272019-08-30T11%3A55%3A07.000Z%27%29%29&savedSearchId=%27571aaf70-4c88-11e8-b3d7-01146121b73d%27',
+ '_a=%28mlExplorerFilter%3A%28%29%2CmlExplorerSwimlane%3A%28viewByFieldName%3Aaction%29%2Cquery%3A%28%29%29&_g=%28ml%3A%28jobIds%3A%21%28dec-2%29%29%2CrefreshInterval%3A%28display%3AOff%2Cpause%3A%21f%2Cvalue%3A0%29%2Ctime%3A%28from%3A%272019-01-01T00%3A03%3A40.000Z%27%2Cmode%3Aabsolute%2Cto%3A%272019-08-30T11%3A55%3A07.000Z%27%29%29&savedSearchId=571aaf70-4c88-11e8-b3d7-01146121b73d',
});
});
});
diff --git a/x-pack/legacy/plugins/ml/public/application/util/url_state.ts b/x-pack/legacy/plugins/ml/public/application/util/url_state.ts
index 546944b1a33bf..e7d5a94e2694f 100644
--- a/x-pack/legacy/plugins/ml/public/application/util/url_state.ts
+++ b/x-pack/legacy/plugins/ml/public/application/util/url_state.ts
@@ -18,14 +18,26 @@ import { getNestedProperty } from './object_utils';
export type SetUrlState = (attribute: string | Dictionary, value?: any) => void;
export type UrlState = [Dictionary, SetUrlState];
-const decodedParams = new Set(['_a', '_g']);
+/**
+ * Set of URL query parameters that require the rison serialization.
+ */
+const risonSerializedParams = new Set(['_a', '_g']);
+
+/**
+ * Checks if the URL query parameter requires rison serialization.
+ * @param queryParam
+ */
+function isRisonSerializationRequired(queryParam: string): boolean {
+ return risonSerializedParams.has(queryParam);
+}
+
export function getUrlState(search: string): Dictionary {
const urlState: Dictionary = {};
const parsedQueryString = queryString.parse(search);
try {
Object.keys(parsedQueryString).forEach(a => {
- if (decodedParams.has(a)) {
+ if (isRisonSerializationRequired(a)) {
urlState[a] = decode(parsedQueryString[a]) as Dictionary;
} else {
urlState[a] = parsedQueryString[a];
@@ -75,7 +87,11 @@ export const useUrlState = (accessor: string): UrlState => {
const oldLocationSearch = queryString.stringify(parsedQueryString, { encode: false });
Object.keys(urlState).forEach(a => {
- parsedQueryString[a] = encode(urlState[a]);
+ if (isRisonSerializationRequired(a)) {
+ parsedQueryString[a] = encode(urlState[a]);
+ } else {
+ parsedQueryString[a] = urlState[a];
+ }
});
const newLocationSearch = queryString.stringify(parsedQueryString, { encode: false });
diff --git a/x-pack/legacy/plugins/ml/server/models/calendar/calendar_manager.js b/x-pack/legacy/plugins/ml/server/models/calendar/calendar_manager.ts
similarity index 53%
rename from x-pack/legacy/plugins/ml/server/models/calendar/calendar_manager.js
rename to x-pack/legacy/plugins/ml/server/models/calendar/calendar_manager.ts
index e74a81e92420f..2487943b5efc0 100644
--- a/x-pack/legacy/plugins/ml/server/models/calendar/calendar_manager.js
+++ b/x-pack/legacy/plugins/ml/server/models/calendar/calendar_manager.ts
@@ -4,23 +4,44 @@
* you may not use this file except in compliance with the Elastic License.
*/
-import _ from 'lodash';
+import { difference } from 'lodash';
import Boom from 'boom';
-import { EventManager } from './event_manager';
+import { EventManager, CalendarEvent } from './event_manager';
+
+interface BasicCalendar {
+ job_ids: string[];
+ description?: string;
+ events: CalendarEvent[];
+}
+
+export interface Calendar extends BasicCalendar {
+ calendar_id: string;
+}
+
+export interface FormCalendar extends BasicCalendar {
+ calendarId: string;
+}
export class CalendarManager {
- constructor(callWithRequest) {
- this.callWithRequest = callWithRequest;
- this.eventManager = new EventManager(callWithRequest);
+ private _client: any;
+ private _eventManager: any;
+
+ constructor(isLegacy: boolean, client: any) {
+ const actualClient = isLegacy === true ? client : client.ml!.mlClient.callAsCurrentUser;
+ this._client = actualClient;
+ this._eventManager = new EventManager(actualClient);
}
- async getCalendar(calendarId) {
+ async getCalendar(calendarId: string) {
try {
- const resp = await this.callWithRequest('ml.calendars', { calendarId });
+ const resp = await this._client('ml.calendars', {
+ calendarId,
+ });
+
const calendars = resp.calendars;
if (calendars.length) {
const calendar = calendars[0];
- calendar.events = await this.eventManager.getCalendarEvents(calendarId);
+ calendar.events = await this._eventManager.getCalendarEvents(calendarId);
return calendar;
} else {
throw Boom.notFound(`Calendar with the id "${calendarId}" not found`);
@@ -32,9 +53,10 @@ export class CalendarManager {
async getAllCalendars() {
try {
- const calendarsResp = await this.callWithRequest('ml.calendars');
- const events = await this.eventManager.getAllEvents();
- const calendars = calendarsResp.calendars;
+ const calendarsResp = await this._client('ml.calendars');
+
+ const events: CalendarEvent[] = await this._eventManager.getAllEvents();
+ const calendars: Calendar[] = calendarsResp.calendars;
calendars.forEach(cal => (cal.events = []));
// loop events and combine with related calendars
@@ -55,24 +77,28 @@ export class CalendarManager {
* @param calendarIds
* @returns {Promise<*>}
*/
- async getCalendarsByIds(calendarIds) {
+ async getCalendarsByIds(calendarIds: string) {
try {
- const calendars = await this.getAllCalendars();
+ const calendars: Calendar[] = await this.getAllCalendars();
return calendars.filter(calendar => calendarIds.includes(calendar.calendar_id));
} catch (error) {
throw Boom.badRequest(error);
}
}
- async newCalendar(calendar) {
+ async newCalendar(calendar: FormCalendar) {
const calendarId = calendar.calendarId;
const events = calendar.events;
delete calendar.calendarId;
delete calendar.events;
try {
- await this.callWithRequest('ml.addCalendar', { calendarId, body: calendar });
+ await this._client('ml.addCalendar', {
+ calendarId,
+ body: calendar,
+ });
+
if (events.length) {
- await this.eventManager.addEvents(calendarId, events);
+ await this._eventManager.addEvents(calendarId, events);
}
// return the newly created calendar
@@ -82,38 +108,38 @@ export class CalendarManager {
}
}
- async updateCalendar(calendarId, calendar) {
- const origCalendar = await this.getCalendar(calendarId);
+ async updateCalendar(calendarId: string, calendar: Calendar) {
+ const origCalendar: Calendar = await this.getCalendar(calendarId);
try {
// update job_ids
- const jobsToAdd = _.difference(calendar.job_ids, origCalendar.job_ids);
- const jobsToRemove = _.difference(origCalendar.job_ids, calendar.job_ids);
+ const jobsToAdd = difference(calendar.job_ids, origCalendar.job_ids);
+ const jobsToRemove = difference(origCalendar.job_ids, calendar.job_ids);
// workout the differences between the original events list and the new one
// if an event has no event_id, it must be new
const eventsToAdd = calendar.events.filter(
- event => origCalendar.events.find(e => this.eventManager.isEqual(e, event)) === undefined
+ event => origCalendar.events.find(e => this._eventManager.isEqual(e, event)) === undefined
);
// if an event in the original calendar cannot be found, it must have been deleted
- const eventsToRemove = origCalendar.events.filter(
- event => calendar.events.find(e => this.eventManager.isEqual(e, event)) === undefined
+ const eventsToRemove: CalendarEvent[] = origCalendar.events.filter(
+ event => calendar.events.find(e => this._eventManager.isEqual(e, event)) === undefined
);
// note, both of the loops below could be removed if the add and delete endpoints
// allowed multiple job_ids
- //add all new jobs
+ // add all new jobs
if (jobsToAdd.length) {
- await this.callWithRequest('ml.addJobToCalendar', {
+ await this._client('ml.addJobToCalendar', {
calendarId,
jobId: jobsToAdd.join(','),
});
}
- //remove all removed jobs
+ // remove all removed jobs
if (jobsToRemove.length) {
- await this.callWithRequest('ml.removeJobFromCalendar', {
+ await this._client('ml.removeJobFromCalendar', {
calendarId,
jobId: jobsToRemove.join(','),
});
@@ -121,13 +147,13 @@ export class CalendarManager {
// add all new events
if (eventsToAdd.length !== 0) {
- await this.eventManager.addEvents(calendarId, eventsToAdd);
+ await this._eventManager.addEvents(calendarId, eventsToAdd);
}
// remove all removed events
await Promise.all(
eventsToRemove.map(async event => {
- await this.eventManager.deleteEvent(calendarId, event.event_id);
+ await this._eventManager.deleteEvent(calendarId, event.event_id);
})
);
} catch (error) {
@@ -138,7 +164,7 @@ export class CalendarManager {
return await this.getCalendar(calendarId);
}
- async deleteCalendar(calendarId) {
- return this.callWithRequest('ml.deleteCalendar', { calendarId });
+ async deleteCalendar(calendarId: string) {
+ return this._client('ml.deleteCalendar', { calendarId });
}
}
diff --git a/x-pack/legacy/plugins/ml/server/models/calendar/event_manager.js b/x-pack/legacy/plugins/ml/server/models/calendar/event_manager.ts
similarity index 51%
rename from x-pack/legacy/plugins/ml/server/models/calendar/event_manager.js
rename to x-pack/legacy/plugins/ml/server/models/calendar/event_manager.ts
index 8bdb5dcf4a3e3..19f2eda466179 100644
--- a/x-pack/legacy/plugins/ml/server/models/calendar/event_manager.js
+++ b/x-pack/legacy/plugins/ml/server/models/calendar/event_manager.ts
@@ -6,14 +6,24 @@
import Boom from 'boom';
+export interface CalendarEvent {
+ calendar_id?: string;
+ event_id?: string;
+ description: string;
+ start_time: number;
+ end_time: number;
+}
+
export class EventManager {
- constructor(callWithRequest) {
- this.callWithRequest = callWithRequest;
+ private _client: any;
+ constructor(client: any) {
+ this._client = client;
}
- async getCalendarEvents(calendarId) {
+ async getCalendarEvents(calendarId: string) {
try {
- const resp = await this.callWithRequest('ml.events', { calendarId });
+ const resp = await this._client('ml.events', { calendarId });
+
return resp.events;
} catch (error) {
throw Boom.badRequest(error);
@@ -21,31 +31,38 @@ export class EventManager {
}
// jobId is optional
- async getAllEvents(jobId) {
+ async getAllEvents(jobId?: string) {
const calendarId = '_all';
try {
- const resp = await this.callWithRequest('ml.events', { calendarId, jobId });
+ const resp = await this._client('ml.events', {
+ calendarId,
+ jobId,
+ });
+
return resp.events;
} catch (error) {
throw Boom.badRequest(error);
}
}
- async addEvents(calendarId, events) {
+ async addEvents(calendarId: string, events: CalendarEvent[]) {
const body = { events };
try {
- return await this.callWithRequest('ml.addEvent', { calendarId, body });
+ return await this._client('ml.addEvent', {
+ calendarId,
+ body,
+ });
} catch (error) {
throw Boom.badRequest(error);
}
}
- async deleteEvent(calendarId, eventId) {
- return this.callWithRequest('ml.deleteEvent', { calendarId, eventId });
+ async deleteEvent(calendarId: string, eventId: string) {
+ return this._client('ml.deleteEvent', { calendarId, eventId });
}
- isEqual(ev1, ev2) {
+ isEqual(ev1: CalendarEvent, ev2: CalendarEvent) {
return (
ev1.event_id === ev2.event_id &&
ev1.description === ev2.description &&
diff --git a/x-pack/legacy/plugins/uptime/server/lib/adapters/saved_objects/index.ts b/x-pack/legacy/plugins/ml/server/models/calendar/index.ts
similarity index 67%
rename from x-pack/legacy/plugins/uptime/server/lib/adapters/saved_objects/index.ts
rename to x-pack/legacy/plugins/ml/server/models/calendar/index.ts
index bd86daba1bcb6..2364c3ac73811 100644
--- a/x-pack/legacy/plugins/uptime/server/lib/adapters/saved_objects/index.ts
+++ b/x-pack/legacy/plugins/ml/server/models/calendar/index.ts
@@ -4,5 +4,4 @@
* you may not use this file except in compliance with the Elastic License.
*/
-export { savedObjectsAdapter } from './kibana_saved_objects_adapter';
-export { UMSavedObjectsAdapter } from './types';
+export { CalendarManager, Calendar, FormCalendar } from './calendar_manager';
diff --git a/x-pack/legacy/plugins/ml/server/models/job_service/groups.js b/x-pack/legacy/plugins/ml/server/models/job_service/groups.js
index 91f82f04a9a0c..58237b2a8a730 100644
--- a/x-pack/legacy/plugins/ml/server/models/job_service/groups.js
+++ b/x-pack/legacy/plugins/ml/server/models/job_service/groups.js
@@ -7,7 +7,7 @@
import { CalendarManager } from '../calendar';
export function groupsProvider(callWithRequest) {
- const calMngr = new CalendarManager(callWithRequest);
+ const calMngr = new CalendarManager(true, callWithRequest);
async function getAllGroups() {
const groups = {};
diff --git a/x-pack/legacy/plugins/ml/server/models/job_service/jobs.js b/x-pack/legacy/plugins/ml/server/models/job_service/jobs.js
index b4b476c1f926e..e60593c9f0ed5 100644
--- a/x-pack/legacy/plugins/ml/server/models/job_service/jobs.js
+++ b/x-pack/legacy/plugins/ml/server/models/job_service/jobs.js
@@ -22,7 +22,7 @@ export function jobsProvider(callWithRequest) {
const { forceDeleteDatafeed, getDatafeedIdsByJobId } = datafeedsProvider(callWithRequest);
const { getAuditMessagesSummary } = jobAuditMessagesProvider(callWithRequest);
const { getLatestBucketTimestampByJob } = resultsServiceProvider(callWithRequest);
- const calMngr = new CalendarManager(callWithRequest);
+ const calMngr = new CalendarManager(true, callWithRequest);
async function forceDeleteJob(jobId) {
return callWithRequest('ml.deleteJob', { jobId, force: true });
diff --git a/x-pack/legacy/plugins/ml/server/new_platform/calendars_schema.ts b/x-pack/legacy/plugins/ml/server/new_platform/calendars_schema.ts
new file mode 100644
index 0000000000000..f5e59d983a9aa
--- /dev/null
+++ b/x-pack/legacy/plugins/ml/server/new_platform/calendars_schema.ts
@@ -0,0 +1,25 @@
+/*
+ * 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 { schema } from '@kbn/config-schema';
+
+export const calendarSchema = {
+ calendar_id: schema.maybe(schema.string()),
+ calendarId: schema.string(),
+ job_ids: schema.arrayOf(schema.maybe(schema.string())),
+ description: schema.maybe(schema.string()),
+ events: schema.arrayOf(
+ schema.maybe(
+ schema.object({
+ event_id: schema.maybe(schema.string()),
+ calendar_id: schema.maybe(schema.string()),
+ description: schema.maybe(schema.string()),
+ start_time: schema.any(),
+ end_time: schema.any(),
+ })
+ )
+ ),
+};
diff --git a/x-pack/legacy/plugins/ml/server/new_platform/plugin.ts b/x-pack/legacy/plugins/ml/server/new_platform/plugin.ts
index 681b2ff20c8aa..2b9219b2226f5 100644
--- a/x-pack/legacy/plugins/ml/server/new_platform/plugin.ts
+++ b/x-pack/legacy/plugins/ml/server/new_platform/plugin.ts
@@ -41,13 +41,11 @@ import { makeMlUsageCollector } from '../lib/ml_telemetry';
import { notificationRoutes } from '../routes/notification_settings';
// @ts-ignore: could not find declaration file for module
import { systemRoutes } from '../routes/system';
-// @ts-ignore: could not find declaration file for module
import { dataFrameAnalyticsRoutes } from '../routes/data_frame_analytics';
// @ts-ignore: could not find declaration file for module
import { dataRecognizer } from '../routes/modules';
// @ts-ignore: could not find declaration file for module
import { dataVisualizerRoutes } from '../routes/data_visualizer';
-// @ts-ignore: could not find declaration file for module
import { calendars } from '../routes/calendars';
// @ts-ignore: could not find declaration file for module
import { fieldsService } from '../routes/fields_service';
diff --git a/x-pack/legacy/plugins/ml/server/routes/calendars.js b/x-pack/legacy/plugins/ml/server/routes/calendars.js
deleted file mode 100644
index 7a0f341ef9666..0000000000000
--- a/x-pack/legacy/plugins/ml/server/routes/calendars.js
+++ /dev/null
@@ -1,110 +0,0 @@
-/*
- * 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 { callWithRequestFactory } from '../client/call_with_request_factory';
-import { wrapError } from '../client/errors';
-import { CalendarManager } from '../models/calendar';
-
-function getAllCalendars(callWithRequest) {
- const cal = new CalendarManager(callWithRequest);
- return cal.getAllCalendars();
-}
-
-function getCalendar(callWithRequest, calendarId) {
- const cal = new CalendarManager(callWithRequest);
- return cal.getCalendar(calendarId);
-}
-
-function newCalendar(callWithRequest, calendar) {
- const cal = new CalendarManager(callWithRequest);
- return cal.newCalendar(calendar);
-}
-
-function updateCalendar(callWithRequest, calendarId, calendar) {
- const cal = new CalendarManager(callWithRequest);
- return cal.updateCalendar(calendarId, calendar);
-}
-
-function deleteCalendar(callWithRequest, calendarId) {
- const cal = new CalendarManager(callWithRequest);
- return cal.deleteCalendar(calendarId);
-}
-
-function getCalendarsByIds(callWithRequest, calendarIds) {
- const cal = new CalendarManager(callWithRequest);
- return cal.getCalendarsByIds(calendarIds);
-}
-
-export function calendars({ commonRouteConfig, elasticsearchPlugin, route }) {
- route({
- method: 'GET',
- path: '/api/ml/calendars',
- handler(request) {
- const callWithRequest = callWithRequestFactory(elasticsearchPlugin, request);
- return getAllCalendars(callWithRequest).catch(resp => wrapError(resp));
- },
- config: {
- ...commonRouteConfig,
- },
- });
-
- route({
- method: 'GET',
- path: '/api/ml/calendars/{calendarIds}',
- handler(request) {
- const callWithRequest = callWithRequestFactory(elasticsearchPlugin, request);
- const calendarIds = request.params.calendarIds.split(',');
- if (calendarIds.length === 1) {
- return getCalendar(callWithRequest, calendarIds[0]).catch(resp => wrapError(resp));
- } else {
- return getCalendarsByIds(callWithRequest, calendarIds).catch(resp => wrapError(resp));
- }
- },
- config: {
- ...commonRouteConfig,
- },
- });
-
- route({
- method: 'PUT',
- path: '/api/ml/calendars',
- handler(request) {
- const callWithRequest = callWithRequestFactory(elasticsearchPlugin, request);
- const body = request.payload;
- return newCalendar(callWithRequest, body).catch(resp => wrapError(resp));
- },
- config: {
- ...commonRouteConfig,
- },
- });
-
- route({
- method: 'PUT',
- path: '/api/ml/calendars/{calendarId}',
- handler(request) {
- const callWithRequest = callWithRequestFactory(elasticsearchPlugin, request);
- const calendarId = request.params.calendarId;
- const body = request.payload;
- return updateCalendar(callWithRequest, calendarId, body).catch(resp => wrapError(resp));
- },
- config: {
- ...commonRouteConfig,
- },
- });
-
- route({
- method: 'DELETE',
- path: '/api/ml/calendars/{calendarId}',
- handler(request) {
- const callWithRequest = callWithRequestFactory(elasticsearchPlugin, request);
- const calendarId = request.params.calendarId;
- return deleteCalendar(callWithRequest, calendarId).catch(resp => wrapError(resp));
- },
- config: {
- ...commonRouteConfig,
- },
- });
-}
diff --git a/x-pack/legacy/plugins/ml/server/routes/calendars.ts b/x-pack/legacy/plugins/ml/server/routes/calendars.ts
new file mode 100644
index 0000000000000..19d614a4e6a22
--- /dev/null
+++ b/x-pack/legacy/plugins/ml/server/routes/calendars.ts
@@ -0,0 +1,155 @@
+/*
+ * 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 { RequestHandlerContext } from 'src/core/server';
+import { schema } from '@kbn/config-schema';
+import { licensePreRoutingFactory } from '../new_platform/licence_check_pre_routing_factory';
+import { wrapError } from '../client/error_wrapper';
+import { RouteInitialization } from '../new_platform/plugin';
+import { calendarSchema } from '../new_platform/calendars_schema';
+import { CalendarManager, Calendar, FormCalendar } from '../models/calendar';
+
+function getAllCalendars(context: RequestHandlerContext) {
+ const cal = new CalendarManager(false, context);
+ return cal.getAllCalendars();
+}
+
+function getCalendar(context: RequestHandlerContext, calendarId: string) {
+ const cal = new CalendarManager(false, context);
+ return cal.getCalendar(calendarId);
+}
+
+function newCalendar(context: RequestHandlerContext, calendar: FormCalendar) {
+ const cal = new CalendarManager(false, context);
+ return cal.newCalendar(calendar);
+}
+
+function updateCalendar(context: RequestHandlerContext, calendarId: string, calendar: Calendar) {
+ const cal = new CalendarManager(false, context);
+ return cal.updateCalendar(calendarId, calendar);
+}
+
+function deleteCalendar(context: RequestHandlerContext, calendarId: string) {
+ const cal = new CalendarManager(false, context);
+ return cal.deleteCalendar(calendarId);
+}
+
+function getCalendarsByIds(context: RequestHandlerContext, calendarIds: string) {
+ const cal = new CalendarManager(false, context);
+ return cal.getCalendarsByIds(calendarIds);
+}
+
+export function calendars({ xpackMainPlugin, router }: RouteInitialization) {
+ router.get(
+ {
+ path: '/api/ml/calendars',
+ validate: false,
+ },
+ licensePreRoutingFactory(xpackMainPlugin, async (context, request, response) => {
+ try {
+ const resp = await getAllCalendars(context);
+
+ return response.ok({
+ body: resp,
+ });
+ } catch (e) {
+ return response.customError(wrapError(e));
+ }
+ })
+ );
+
+ router.get(
+ {
+ path: '/api/ml/calendars/{calendarIds}',
+ validate: {
+ params: schema.object({ calendarIds: schema.string() }),
+ },
+ },
+ licensePreRoutingFactory(xpackMainPlugin, async (context, request, response) => {
+ let returnValue;
+ try {
+ const calendarIds = request.params.calendarIds.split(',');
+
+ if (calendarIds.length === 1) {
+ returnValue = await getCalendar(context, calendarIds[0]);
+ } else {
+ returnValue = await getCalendarsByIds(context, calendarIds);
+ }
+
+ return response.ok({
+ body: returnValue,
+ });
+ } catch (e) {
+ return response.customError(wrapError(e));
+ }
+ })
+ );
+
+ router.put(
+ {
+ path: '/api/ml/calendars',
+ validate: {
+ body: schema.object({ ...calendarSchema }),
+ },
+ },
+ licensePreRoutingFactory(xpackMainPlugin, async (context, request, response) => {
+ try {
+ const body = request.body;
+ const resp = await newCalendar(context, body);
+
+ return response.ok({
+ body: resp,
+ });
+ } catch (e) {
+ return response.customError(wrapError(e));
+ }
+ })
+ );
+
+ router.put(
+ {
+ path: '/api/ml/calendars/{calendarId}',
+ validate: {
+ params: schema.object({ calendarId: schema.string() }),
+ body: schema.object({ ...calendarSchema }),
+ },
+ },
+ licensePreRoutingFactory(xpackMainPlugin, async (context, request, response) => {
+ try {
+ const { calendarId } = request.params;
+ const body = request.body;
+ const resp = await updateCalendar(context, calendarId, body);
+
+ return response.ok({
+ body: resp,
+ });
+ } catch (e) {
+ return response.customError(wrapError(e));
+ }
+ })
+ );
+
+ router.delete(
+ {
+ path: '/api/ml/calendars/{calendarId}',
+ validate: {
+ params: schema.object({ calendarId: schema.string() }),
+ },
+ },
+ licensePreRoutingFactory(xpackMainPlugin, async (context, request, response) => {
+ try {
+ const { calendarId } = request.params;
+ const resp = await deleteCalendar(context, calendarId);
+
+ return response.ok({
+ body: resp,
+ });
+ } catch (e) {
+ return response.customError(wrapError(e));
+ }
+ })
+ );
+}
diff --git a/x-pack/legacy/plugins/monitoring/config.js b/x-pack/legacy/plugins/monitoring/config.js
index 91c1ee99a0b2e..778b656c056f2 100644
--- a/x-pack/legacy/plugins/monitoring/config.js
+++ b/x-pack/legacy/plugins/monitoring/config.js
@@ -15,12 +15,12 @@ export const config = Joi => {
const DEFAULT_REQUEST_HEADERS = ['authorization'];
return Joi.object({
- ccs: Joi.object({
- enabled: Joi.boolean().default(true),
- }).default(),
enabled: Joi.boolean().default(true),
ui: Joi.object({
enabled: Joi.boolean().default(true),
+ ccs: Joi.object({
+ enabled: Joi.boolean().default(true),
+ }).default(),
container: Joi.object({
elasticsearch: Joi.object({
enabled: Joi.boolean().default(false),
@@ -29,6 +29,51 @@ export const config = Joi => {
enabled: Joi.boolean().default(false),
}).default(),
}).default(),
+ max_bucket_size: Joi.number().default(10000),
+ min_interval_seconds: Joi.number().default(10),
+ show_license_expiration: Joi.boolean().default(true),
+ elasticsearch: Joi.object({
+ customHeaders: Joi.object().default({}),
+ logQueries: Joi.boolean().default(false),
+ requestHeadersWhitelist: Joi.array()
+ .items()
+ .single()
+ .default(DEFAULT_REQUEST_HEADERS),
+ sniffOnStart: Joi.boolean().default(false),
+ sniffInterval: Joi.number()
+ .allow(false)
+ .default(false),
+ sniffOnConnectionFault: Joi.boolean().default(false),
+ hosts: Joi.array()
+ .items(Joi.string().uri({ scheme: ['http', 'https'] }))
+ .single(), // if empty, use Kibana's connection config
+ username: Joi.string(),
+ password: Joi.string(),
+ requestTimeout: Joi.number().default(30000),
+ pingTimeout: Joi.number().default(30000),
+ ssl: Joi.object({
+ verificationMode: Joi.string()
+ .valid('none', 'certificate', 'full')
+ .default('full'),
+ certificateAuthorities: Joi.array()
+ .single()
+ .items(Joi.string()),
+ certificate: Joi.string(),
+ key: Joi.string(),
+ keyPassphrase: Joi.string(),
+ keystore: Joi.object({
+ path: Joi.string(),
+ password: Joi.string(),
+ }).default(),
+ truststore: Joi.object({
+ path: Joi.string(),
+ password: Joi.string(),
+ }).default(),
+ alwaysPresentCertificate: Joi.boolean().default(false),
+ }).default(),
+ apiVersion: Joi.string().default('master'),
+ logFetchCount: Joi.number().default(10),
+ }).default(),
}).default(),
kibana: Joi.object({
collection: Joi.object({
@@ -46,56 +91,11 @@ export const config = Joi => {
xpack_api_polling_frequency_millis: Joi.number().default(
XPACK_INFO_API_DEFAULT_POLL_FREQUENCY_IN_MILLIS
),
- max_bucket_size: Joi.number().default(10000),
- min_interval_seconds: Joi.number().default(10),
- show_license_expiration: Joi.boolean().default(true),
agent: Joi.object({
interval: Joi.string()
.regex(/[\d\.]+[yMwdhms]/)
.default('10s'),
}).default(),
- elasticsearch: Joi.object({
- customHeaders: Joi.object().default({}),
- logQueries: Joi.boolean().default(false),
- requestHeadersWhitelist: Joi.array()
- .items()
- .single()
- .default(DEFAULT_REQUEST_HEADERS),
- sniffOnStart: Joi.boolean().default(false),
- sniffInterval: Joi.number()
- .allow(false)
- .default(false),
- sniffOnConnectionFault: Joi.boolean().default(false),
- hosts: Joi.array()
- .items(Joi.string().uri({ scheme: ['http', 'https'] }))
- .single(), // if empty, use Kibana's connection config
- username: Joi.string(),
- password: Joi.string(),
- requestTimeout: Joi.number().default(30000),
- pingTimeout: Joi.number().default(30000),
- ssl: Joi.object({
- verificationMode: Joi.string()
- .valid('none', 'certificate', 'full')
- .default('full'),
- certificateAuthorities: Joi.array()
- .single()
- .items(Joi.string()),
- certificate: Joi.string(),
- key: Joi.string(),
- keyPassphrase: Joi.string(),
- keystore: Joi.object({
- path: Joi.string(),
- password: Joi.string(),
- }).default(),
- truststore: Joi.object({
- path: Joi.string(),
- password: Joi.string(),
- }).default(),
- alwaysPresentCertificate: Joi.boolean().default(false),
- }).default(),
- apiVersion: Joi.string().default('master'),
- logFetchCount: Joi.number().default(10),
- }).default(),
tests: Joi.object({
cloud_detector: Joi.object({
enabled: Joi.boolean().default(true),
diff --git a/x-pack/legacy/plugins/monitoring/deprecations.js b/x-pack/legacy/plugins/monitoring/deprecations.js
index c3b2b70690f33..6e35e86dd9d71 100644
--- a/x-pack/legacy/plugins/monitoring/deprecations.js
+++ b/x-pack/legacy/plugins/monitoring/deprecations.js
@@ -28,7 +28,7 @@ export const deprecations = () => {
}
},
(settings, log) => {
- const fromPath = 'xpack.monitoring.elasticsearch';
+ const fromPath = 'monitoring.elasticsearch';
const es = get(settings, 'elasticsearch');
if (es) {
if (es.username === 'elastic') {
@@ -39,7 +39,7 @@ export const deprecations = () => {
}
},
(settings, log) => {
- const fromPath = 'xpack.monitoring.elasticsearch.ssl';
+ const fromPath = 'monitoring.elasticsearch.ssl';
const ssl = get(settings, 'elasticsearch.ssl');
if (ssl) {
if (ssl.key !== undefined && ssl.certificate === undefined) {
diff --git a/x-pack/legacy/plugins/monitoring/index.js b/x-pack/legacy/plugins/monitoring/index.js
index 8e0201bea710b..ca595836133c2 100644
--- a/x-pack/legacy/plugins/monitoring/index.js
+++ b/x-pack/legacy/plugins/monitoring/index.js
@@ -20,31 +20,31 @@ export const monitoring = kibana =>
new kibana.Plugin({
require: ['kibana', 'elasticsearch', 'xpack_main'],
id: 'monitoring',
- configPrefix: 'xpack.monitoring',
+ configPrefix: 'monitoring',
publicDir: resolve(__dirname, 'public'),
init(server) {
const configs = [
- 'xpack.monitoring.ui.enabled',
- 'xpack.monitoring.kibana.collection.enabled',
- 'xpack.monitoring.max_bucket_size',
- 'xpack.monitoring.min_interval_seconds',
+ 'monitoring.ui.enabled',
+ 'monitoring.kibana.collection.enabled',
+ 'monitoring.ui.max_bucket_size',
+ 'monitoring.ui.min_interval_seconds',
'kibana.index',
- 'xpack.monitoring.show_license_expiration',
- 'xpack.monitoring.ui.container.elasticsearch.enabled',
- 'xpack.monitoring.ui.container.logstash.enabled',
- 'xpack.monitoring.tests.cloud_detector.enabled',
- 'xpack.monitoring.kibana.collection.interval',
- 'xpack.monitoring.elasticsearch.hosts',
- 'xpack.monitoring.elasticsearch',
- 'xpack.monitoring.xpack_api_polling_frequency_millis',
+ 'monitoring.ui.show_license_expiration',
+ 'monitoring.ui.container.elasticsearch.enabled',
+ 'monitoring.ui.container.logstash.enabled',
+ 'monitoring.tests.cloud_detector.enabled',
+ 'monitoring.kibana.collection.interval',
+ 'monitoring.ui.elasticsearch.hosts',
+ 'monitoring.ui.elasticsearch',
+ 'monitoring.xpack_api_polling_frequency_millis',
'server.uuid',
'server.name',
'server.host',
'server.port',
- 'xpack.monitoring.cluster_alerts.email_notifications.enabled',
- 'xpack.monitoring.cluster_alerts.email_notifications.email_address',
- 'xpack.monitoring.ccs.enabled',
- 'xpack.monitoring.elasticsearch.logFetchCount',
+ 'monitoring.cluster_alerts.email_notifications.enabled',
+ 'monitoring.cluster_alerts.email_notifications.email_address',
+ 'monitoring.ui.ccs.enabled',
+ 'monitoring.ui.elasticsearch.logFetchCount',
];
const serverConfig = server.config();
diff --git a/x-pack/legacy/plugins/monitoring/public/components/metricbeat_migration/flyout/__snapshots__/flyout.test.js.snap b/x-pack/legacy/plugins/monitoring/public/components/metricbeat_migration/flyout/__snapshots__/flyout.test.js.snap
index 7f48f3386b180..eb1c65c6a696d 100644
--- a/x-pack/legacy/plugins/monitoring/public/components/metricbeat_migration/flyout/__snapshots__/flyout.test.js.snap
+++ b/x-pack/legacy/plugins/monitoring/public/components/metricbeat_migration/flyout/__snapshots__/flyout.test.js.snap
@@ -1174,7 +1174,7 @@ exports[`Flyout kibana part two should show instructions to disable internal col
isCopyable={true}
language="bash"
>
- xpack.monitoring.kibana.collection.enabled: false
+ monitoring.kibana.collection.enabled: false
- xpack.monitoring.enabled
+ monitoring.enabled
,
"defaultValue":
true
@@ -2091,7 +2091,7 @@ exports[`Flyout should show a restart warning for restarting the primary Kibana
isCopyable={true}
language="bash"
>
- xpack.monitoring.kibana.collection.enabled: false
+ monitoring.kibana.collection.enabled: false
- xpack.monitoring.enabled
+ monitoring.enabled
,
"defaultValue":
true
diff --git a/x-pack/legacy/plugins/monitoring/public/components/metricbeat_migration/instruction_steps/kibana/disable_internal_collection_instructions.js b/x-pack/legacy/plugins/monitoring/public/components/metricbeat_migration/instruction_steps/kibana/disable_internal_collection_instructions.js
index 9326156c1ac36..5f7f97b74e871 100644
--- a/x-pack/legacy/plugins/monitoring/public/components/metricbeat_migration/instruction_steps/kibana/disable_internal_collection_instructions.js
+++ b/x-pack/legacy/plugins/monitoring/public/components/metricbeat_migration/instruction_steps/kibana/disable_internal_collection_instructions.js
@@ -61,7 +61,7 @@ export function getKibanaInstructionsForDisablingInternalCollection(product, met
- xpack.monitoring.kibana.collection.enabled: false
+ monitoring.kibana.collection.enabled: false
@@ -70,7 +70,7 @@ export function getKibanaInstructionsForDisablingInternalCollection(product, met
id="xpack.monitoring.metricbeatMigration.kibanaInstructions.disableInternalCollection.note"
defaultMessage="For {config}, leave the default value of ({defaultValue})."
values={{
- config: xpack.monitoring.enabled ,
+ config: monitoring.enabled ,
defaultValue: true ,
}}
/>
diff --git a/x-pack/legacy/plugins/monitoring/server/cluster_alerts/alerts_cluster_search.js b/x-pack/legacy/plugins/monitoring/server/cluster_alerts/alerts_cluster_search.js
index 0c9fb4bd04ee7..eff9875d794ad 100644
--- a/x-pack/legacy/plugins/monitoring/server/cluster_alerts/alerts_cluster_search.js
+++ b/x-pack/legacy/plugins/monitoring/server/cluster_alerts/alerts_cluster_search.js
@@ -157,7 +157,7 @@ export function alertsClusterSearch(req, alertsIndex, cluster, checkLicense, opt
if (prodLicenseInfo.clusterAlerts.enabled) {
const config = req.server.config();
- const size = options.size || config.get('xpack.monitoring.max_bucket_size');
+ const size = options.size || config.get('monitoring.ui.max_bucket_size');
const params = {
index: alertsIndex,
diff --git a/x-pack/legacy/plugins/monitoring/server/cluster_alerts/verify_monitoring_license.js b/x-pack/legacy/plugins/monitoring/server/cluster_alerts/verify_monitoring_license.js
index 9cc67e11c28d5..e94f4e08fbdb1 100644
--- a/x-pack/legacy/plugins/monitoring/server/cluster_alerts/verify_monitoring_license.js
+++ b/x-pack/legacy/plugins/monitoring/server/cluster_alerts/verify_monitoring_license.js
@@ -19,7 +19,7 @@ export function verifyMonitoringLicense(server) {
const config = server.config();
// if cluster alerts are enabled, then ensure that we can use it according to the license
- if (config.get('xpack.monitoring.cluster_alerts.enabled')) {
+ if (config.get('monitoring.cluster_alerts.enabled')) {
const xpackInfo = get(server.plugins.monitoring, 'info');
if (xpackInfo) {
const monitoringCluster = xpackInfo.feature('monitoring').getLicenseCheckResults();
diff --git a/x-pack/legacy/plugins/monitoring/server/es_client/__tests__/instantiate_client.js b/x-pack/legacy/plugins/monitoring/server/es_client/__tests__/instantiate_client.js
index 6844bd5febf8e..88cf9734d5f57 100644
--- a/x-pack/legacy/plugins/monitoring/server/es_client/__tests__/instantiate_client.js
+++ b/x-pack/legacy/plugins/monitoring/server/es_client/__tests__/instantiate_client.js
@@ -11,8 +11,8 @@ import { exposeClient, hasMonitoringCluster } from '../instantiate_client';
function getMockServerFromConnectionUrl(monitoringClusterUrl) {
const server = {
- xpack: {
- monitoring: {
+ monitoring: {
+ ui: {
elasticsearch: {
hosts: monitoringClusterUrl ? [monitoringClusterUrl] : [],
username: 'monitoring-user-internal-test',
@@ -27,7 +27,7 @@ function getMockServerFromConnectionUrl(monitoringClusterUrl) {
};
return {
- elasticsearchConfig: server.xpack.monitoring.elasticsearch,
+ elasticsearchConfig: server.monitoring.ui.elasticsearch,
elasticsearchPlugin: {
getCluster: sinon
.stub()
diff --git a/x-pack/legacy/plugins/monitoring/server/es_client/parse_elasticsearch_config.test.ts b/x-pack/legacy/plugins/monitoring/server/es_client/parse_elasticsearch_config.test.ts
index c6f4e0fa68504..8d9b5335732c0 100644
--- a/x-pack/legacy/plugins/monitoring/server/es_client/parse_elasticsearch_config.test.ts
+++ b/x-pack/legacy/plugins/monitoring/server/es_client/parse_elasticsearch_config.test.ts
@@ -168,14 +168,14 @@ describe('throws when config is invalid', () => {
it('throws if key and keystore.path are both specified', () => {
const value = { ssl: { key: 'foo', keystore: { path: 'bar' } } };
expect(() => parse(value)).toThrowErrorMatchingInlineSnapshot(
- `"[config validation of [xpack.monitoring.elasticsearch].ssl]: cannot use [key] when [keystore.path] is specified"`
+ `"[config validation of [monitoring.ui.elasticsearch].ssl]: cannot use [key] when [keystore.path] is specified"`
);
});
it('throws if certificate and keystore.path are both specified', () => {
const value = { ssl: { certificate: 'foo', keystore: { path: 'bar' } } };
expect(() => parse(value)).toThrowErrorMatchingInlineSnapshot(
- `"[config validation of [xpack.monitoring.elasticsearch].ssl]: cannot use [certificate] when [keystore.path] is specified"`
+ `"[config validation of [monitoring.ui.elasticsearch].ssl]: cannot use [certificate] when [keystore.path] is specified"`
);
});
});
diff --git a/x-pack/legacy/plugins/monitoring/server/es_client/parse_elasticsearch_config.ts b/x-pack/legacy/plugins/monitoring/server/es_client/parse_elasticsearch_config.ts
index 70e6235602b5b..728b3433bf06c 100644
--- a/x-pack/legacy/plugins/monitoring/server/es_client/parse_elasticsearch_config.ts
+++ b/x-pack/legacy/plugins/monitoring/server/es_client/parse_elasticsearch_config.ts
@@ -7,7 +7,7 @@
import { readFileSync } from 'fs';
import { readPkcs12Truststore, readPkcs12Keystore } from '../../../../../../src/core/utils';
-const KEY = 'xpack.monitoring.elasticsearch';
+const KEY = 'monitoring.ui.elasticsearch';
/*
* Parse a config object's Elasticsearch configuration, reading any
diff --git a/x-pack/legacy/plugins/monitoring/server/init_monitoring_xpack_info.js b/x-pack/legacy/plugins/monitoring/server/init_monitoring_xpack_info.js
index b43430ead23b0..ba07f512de896 100644
--- a/x-pack/legacy/plugins/monitoring/server/init_monitoring_xpack_info.js
+++ b/x-pack/legacy/plugins/monitoring/server/init_monitoring_xpack_info.js
@@ -15,7 +15,7 @@ export const initMonitoringXpackInfo = async ({ config, xpackMainPlugin, expose,
const xpackInfo = hasMonitoringCluster(config)
? xpackMainPlugin.createXPackInfo({
clusterSource: 'monitoring',
- pollFrequencyInMillis: config.get('xpack.monitoring.xpack_api_polling_frequency_millis'),
+ pollFrequencyInMillis: config.get('monitoring.xpack_api_polling_frequency_millis'),
})
: xpackMainPlugin.info;
diff --git a/x-pack/legacy/plugins/monitoring/server/kibana_monitoring/bulk_uploader.js b/x-pack/legacy/plugins/monitoring/server/kibana_monitoring/bulk_uploader.js
index 5e0d8aa4be1fd..cf68ec073bebc 100644
--- a/x-pack/legacy/plugins/monitoring/server/kibana_monitoring/bulk_uploader.js
+++ b/x-pack/legacy/plugins/monitoring/server/kibana_monitoring/bulk_uploader.js
@@ -24,7 +24,7 @@ const LOGGING_TAGS = [LOGGING_TAG, KIBANA_MONITORING_LOGGING_TAG];
* NOTE: internal collection will be removed in 7.0
*
* Depends on
- * - 'xpack.monitoring.kibana.collection.enabled' config
+ * - 'monitoring.kibana.collection.enabled' config
* - monitoring enabled in ES (checked against xpack_main.info license info change)
* The dependencies are handled upstream
* - Ops Events - essentially Kibana's /api/status
diff --git a/x-pack/legacy/plugins/monitoring/server/kibana_monitoring/collectors/__tests__/get_default_admin_email.js b/x-pack/legacy/plugins/monitoring/server/kibana_monitoring/collectors/__tests__/get_default_admin_email.js
index 96dc461c03fd3..10f52a82a830c 100644
--- a/x-pack/legacy/plugins/monitoring/server/kibana_monitoring/collectors/__tests__/get_default_admin_email.js
+++ b/x-pack/legacy/plugins/monitoring/server/kibana_monitoring/collectors/__tests__/get_default_admin_email.js
@@ -14,14 +14,10 @@ describe('getSettingsCollector / getDefaultAdminEmail', () => {
function setup({ enabled = true, adminEmail = null } = {}) {
const config = { get: sinon.stub() };
- config.get
- .withArgs('xpack.monitoring.cluster_alerts.email_notifications.enabled')
- .returns(enabled);
+ config.get.withArgs('monitoring.cluster_alerts.email_notifications.enabled').returns(enabled);
if (adminEmail) {
- config.get
- .withArgs(`xpack.monitoring.${CLUSTER_ALERTS_ADDRESS_CONFIG_KEY}`)
- .returns(adminEmail);
+ config.get.withArgs(`monitoring.${CLUSTER_ALERTS_ADDRESS_CONFIG_KEY}`).returns(adminEmail);
}
config.get.withArgs('kibana.index').returns('.kibana');
@@ -31,7 +27,7 @@ describe('getSettingsCollector / getDefaultAdminEmail', () => {
return config;
}
- describe('xpack.monitoring.cluster_alerts.email_notifications.enabled = false', () => {
+ describe('monitoring.cluster_alerts.email_notifications.enabled = false', () => {
it('returns null when email is defined', async () => {
const config = setup({ enabled: false });
expect(await getDefaultAdminEmail(config)).to.be(null);
@@ -43,7 +39,7 @@ describe('getSettingsCollector / getDefaultAdminEmail', () => {
});
});
- describe('xpack.monitoring.cluster_alerts.email_notifications.enabled = true', () => {
+ describe('monitoring.cluster_alerts.email_notifications.enabled = true', () => {
it('returns value when email is defined', async () => {
const config = setup({ adminEmail: 'hello@world' });
expect(await getDefaultAdminEmail(config)).to.be('hello@world');
diff --git a/x-pack/legacy/plugins/monitoring/server/kibana_monitoring/collectors/get_settings_collector.js b/x-pack/legacy/plugins/monitoring/server/kibana_monitoring/collectors/get_settings_collector.js
index d0e1d32a2baa4..f51e7d22a0c7c 100644
--- a/x-pack/legacy/plugins/monitoring/server/kibana_monitoring/collectors/get_settings_collector.js
+++ b/x-pack/legacy/plugins/monitoring/server/kibana_monitoring/collectors/get_settings_collector.js
@@ -11,11 +11,11 @@ import { CLUSTER_ALERTS_ADDRESS_CONFIG_KEY, KIBANA_SETTINGS_TYPE } from '../../.
* If so, get email from kibana.yml
*/
export async function getDefaultAdminEmail(config) {
- if (!config.get('xpack.monitoring.cluster_alerts.email_notifications.enabled')) {
+ if (!config.get('monitoring.cluster_alerts.email_notifications.enabled')) {
return null;
}
- const emailAddressConfigKey = `xpack.monitoring.${CLUSTER_ALERTS_ADDRESS_CONFIG_KEY}`;
+ const emailAddressConfigKey = `monitoring.${CLUSTER_ALERTS_ADDRESS_CONFIG_KEY}`;
const configuredEmailAddress = config.get(emailAddressConfigKey);
return configuredEmailAddress || null;
diff --git a/x-pack/legacy/plugins/monitoring/server/kibana_monitoring/collectors/ops_buffer/ops_buffer.js b/x-pack/legacy/plugins/monitoring/server/kibana_monitoring/collectors/ops_buffer/ops_buffer.js
index d58f6f3254c76..699a364433b3e 100644
--- a/x-pack/legacy/plugins/monitoring/server/kibana_monitoring/collectors/ops_buffer/ops_buffer.js
+++ b/x-pack/legacy/plugins/monitoring/server/kibana_monitoring/collectors/ops_buffer/ops_buffer.js
@@ -17,7 +17,7 @@ export function opsBuffer({ config, log, getOSInfo }) {
// determine the cloud service in the background
const cloudDetector = new CloudDetector();
- if (config.get('xpack.monitoring.tests.cloud_detector.enabled')) {
+ if (config.get('monitoring.tests.cloud_detector.enabled')) {
cloudDetector.detectCloudService();
}
diff --git a/x-pack/legacy/plugins/monitoring/server/kibana_monitoring/init.js b/x-pack/legacy/plugins/monitoring/server/kibana_monitoring/init.js
index bf79ddc210902..3c02e2be58dec 100644
--- a/x-pack/legacy/plugins/monitoring/server/kibana_monitoring/init.js
+++ b/x-pack/legacy/plugins/monitoring/server/kibana_monitoring/init.js
@@ -16,7 +16,7 @@ import { BulkUploader } from './bulk_uploader';
* @param {Object} server HapiJS server instance
*/
export function initBulkUploader({ config, ...params }) {
- const interval = config.get('xpack.monitoring.kibana.collection.interval');
+ const interval = config.get('monitoring.kibana.collection.interval');
return new BulkUploader({
interval,
config,
diff --git a/x-pack/legacy/plugins/monitoring/server/lib/__tests__/ccs_utils.js b/x-pack/legacy/plugins/monitoring/server/lib/__tests__/ccs_utils.js
index 844dfc96bb19b..2d310962238fd 100644
--- a/x-pack/legacy/plugins/monitoring/server/lib/__tests__/ccs_utils.js
+++ b/x-pack/legacy/plugins/monitoring/server/lib/__tests__/ccs_utils.js
@@ -17,7 +17,7 @@ describe('ccs_utils', () => {
const get = sinon.stub();
const config = { get };
- get.withArgs('xpack.monitoring.ccs.enabled').returns(false);
+ get.withArgs('monitoring.ui.ccs.enabled').returns(false);
// falsy string values should be ignored
const allPattern = prefixIndexPattern(config, indexPattern, '*');
@@ -32,7 +32,7 @@ describe('ccs_utils', () => {
const get = sinon.stub();
const config = { get };
- get.withArgs('xpack.monitoring.ccs.enabled').returns(true);
+ get.withArgs('monitoring.ui.ccs.enabled').returns(true);
// falsy string values should be ignored
const undefinedPattern = prefixIndexPattern(config, indexPattern);
@@ -49,7 +49,7 @@ describe('ccs_utils', () => {
const get = sinon.stub();
const config = { get };
- get.withArgs('xpack.monitoring.ccs.enabled').returns(true);
+ get.withArgs('monitoring.ui.ccs.enabled').returns(true);
const abcPattern = prefixIndexPattern(config, indexPattern, 'aBc');
const underscorePattern = prefixIndexPattern(config, indexPattern, 'cluster_one');
@@ -67,7 +67,7 @@ describe('ccs_utils', () => {
const get = sinon.stub();
const config = { get };
- get.withArgs('xpack.monitoring.ccs.enabled').returns(true);
+ get.withArgs('monitoring.ui.ccs.enabled').returns(true);
const pattern = prefixIndexPattern(config, indexPattern, '*');
diff --git a/x-pack/legacy/plugins/monitoring/server/lib/apm/get_apms.js b/x-pack/legacy/plugins/monitoring/server/lib/apm/get_apms.js
index ef8db59620f1a..40070a6b0d0f2 100644
--- a/x-pack/legacy/plugins/monitoring/server/lib/apm/get_apms.js
+++ b/x-pack/legacy/plugins/monitoring/server/lib/apm/get_apms.js
@@ -84,7 +84,7 @@ export async function getApms(req, apmIndexPattern, clusterUuid) {
const params = {
index: apmIndexPattern,
- size: config.get('xpack.monitoring.max_bucket_size'), // FIXME
+ size: config.get('monitoring.ui.max_bucket_size'), // FIXME
ignoreUnavailable: true,
filterPath: [
// only filter path can filter for inner_hits
diff --git a/x-pack/legacy/plugins/monitoring/server/lib/apm/get_apms_for_clusters.js b/x-pack/legacy/plugins/monitoring/server/lib/apm/get_apms_for_clusters.js
index 95ccb81f696be..a24936dc0f832 100644
--- a/x-pack/legacy/plugins/monitoring/server/lib/apm/get_apms_for_clusters.js
+++ b/x-pack/legacy/plugins/monitoring/server/lib/apm/get_apms_for_clusters.js
@@ -35,7 +35,7 @@ export function getApmsForClusters(req, apmIndexPattern, clusters) {
const start = req.payload.timeRange.min;
const end = req.payload.timeRange.max;
const config = req.server.config();
- const maxBucketSize = config.get('xpack.monitoring.max_bucket_size');
+ const maxBucketSize = config.get('monitoring.ui.max_bucket_size');
return Promise.all(
clusters.map(async cluster => {
diff --git a/x-pack/legacy/plugins/monitoring/server/lib/apm/get_stats.js b/x-pack/legacy/plugins/monitoring/server/lib/apm/get_stats.js
index 54a0609d945de..bfaec4f8a1294 100644
--- a/x-pack/legacy/plugins/monitoring/server/lib/apm/get_stats.js
+++ b/x-pack/legacy/plugins/monitoring/server/lib/apm/get_stats.js
@@ -28,7 +28,7 @@ export async function getStats(req, apmIndexPattern, clusterUuid) {
const config = req.server.config();
const start = moment.utc(req.payload.timeRange.min).valueOf();
const end = moment.utc(req.payload.timeRange.max).valueOf();
- const maxBucketSize = config.get('xpack.monitoring.max_bucket_size');
+ const maxBucketSize = config.get('monitoring.ui.max_bucket_size');
const params = {
index: apmIndexPattern,
diff --git a/x-pack/legacy/plugins/monitoring/server/lib/beats/get_beats.js b/x-pack/legacy/plugins/monitoring/server/lib/beats/get_beats.js
index 5857ec32b2259..ef878e4892557 100644
--- a/x-pack/legacy/plugins/monitoring/server/lib/beats/get_beats.js
+++ b/x-pack/legacy/plugins/monitoring/server/lib/beats/get_beats.js
@@ -83,7 +83,7 @@ export async function getBeats(req, beatsIndexPattern, clusterUuid) {
const params = {
index: beatsIndexPattern,
- size: config.get('xpack.monitoring.max_bucket_size'), // FIXME
+ size: config.get('monitoring.ui.max_bucket_size'), // FIXME
ignoreUnavailable: true,
filterPath: [
// only filter path can filter for inner_hits
diff --git a/x-pack/legacy/plugins/monitoring/server/lib/beats/get_beats_for_clusters.js b/x-pack/legacy/plugins/monitoring/server/lib/beats/get_beats_for_clusters.js
index 82a738755931d..624abb894e508 100644
--- a/x-pack/legacy/plugins/monitoring/server/lib/beats/get_beats_for_clusters.js
+++ b/x-pack/legacy/plugins/monitoring/server/lib/beats/get_beats_for_clusters.js
@@ -34,7 +34,7 @@ export function getBeatsForClusters(req, beatsIndexPattern, clusters) {
const start = req.payload.timeRange.min;
const end = req.payload.timeRange.max;
const config = req.server.config();
- const maxBucketSize = config.get('xpack.monitoring.max_bucket_size');
+ const maxBucketSize = config.get('monitoring.ui.max_bucket_size');
return Promise.all(
clusters.map(async cluster => {
diff --git a/x-pack/legacy/plugins/monitoring/server/lib/beats/get_latest_stats.js b/x-pack/legacy/plugins/monitoring/server/lib/beats/get_latest_stats.js
index d326c84634e12..1139489728dbf 100644
--- a/x-pack/legacy/plugins/monitoring/server/lib/beats/get_latest_stats.js
+++ b/x-pack/legacy/plugins/monitoring/server/lib/beats/get_latest_stats.js
@@ -71,7 +71,7 @@ export function getLatestStats(req, beatsIndexPattern, clusterUuid) {
uuids: {
terms: {
field: 'beats_stats.beat.uuid',
- size: config.get('xpack.monitoring.max_bucket_size'),
+ size: config.get('monitoring.ui.max_bucket_size'),
},
},
},
diff --git a/x-pack/legacy/plugins/monitoring/server/lib/beats/get_stats.js b/x-pack/legacy/plugins/monitoring/server/lib/beats/get_stats.js
index 80851a8498c26..0f90750a293fb 100644
--- a/x-pack/legacy/plugins/monitoring/server/lib/beats/get_stats.js
+++ b/x-pack/legacy/plugins/monitoring/server/lib/beats/get_stats.js
@@ -28,7 +28,7 @@ export async function getStats(req, beatsIndexPattern, clusterUuid) {
const config = req.server.config();
const start = moment.utc(req.payload.timeRange.min).valueOf();
const end = moment.utc(req.payload.timeRange.max).valueOf();
- const maxBucketSize = config.get('xpack.monitoring.max_bucket_size');
+ const maxBucketSize = config.get('monitoring.ui.max_bucket_size');
const params = {
index: beatsIndexPattern,
diff --git a/x-pack/legacy/plugins/monitoring/server/lib/ccs_utils.js b/x-pack/legacy/plugins/monitoring/server/lib/ccs_utils.js
index 5b3980d9619a8..3409462156a07 100644
--- a/x-pack/legacy/plugins/monitoring/server/lib/ccs_utils.js
+++ b/x-pack/legacy/plugins/monitoring/server/lib/ccs_utils.js
@@ -16,7 +16,7 @@
* @return {String} The index pattern with the {@code cluster} prefix appropriately prepended.
*/
export function prefixIndexPattern(config, indexPattern, ccs) {
- const ccsEnabled = config.get('xpack.monitoring.ccs.enabled');
+ const ccsEnabled = config.get('monitoring.ui.ccs.enabled');
if (!ccsEnabled || !ccs) {
return indexPattern;
diff --git a/x-pack/legacy/plugins/monitoring/server/lib/cluster/get_clusters_from_request.js b/x-pack/legacy/plugins/monitoring/server/lib/cluster/get_clusters_from_request.js
index d3456eeb2fe4e..2b080a5c333fc 100644
--- a/x-pack/legacy/plugins/monitoring/server/lib/cluster/get_clusters_from_request.js
+++ b/x-pack/legacy/plugins/monitoring/server/lib/cluster/get_clusters_from_request.js
@@ -55,7 +55,7 @@ export async function getClustersFromRequest(
} = indexPatterns;
const config = req.server.config();
- const size = config.get('xpack.monitoring.max_bucket_size');
+ const size = config.get('monitoring.ui.max_bucket_size');
const isStandaloneCluster = clusterUuid === STANDALONE_CLUSTER_CLUSTER_UUID;
let clusters = [];
diff --git a/x-pack/legacy/plugins/monitoring/server/lib/cluster/get_clusters_stats.js b/x-pack/legacy/plugins/monitoring/server/lib/cluster/get_clusters_stats.js
index c323cb381aaf2..54dc58a374c2c 100644
--- a/x-pack/legacy/plugins/monitoring/server/lib/cluster/get_clusters_stats.js
+++ b/x-pack/legacy/plugins/monitoring/server/lib/cluster/get_clusters_stats.js
@@ -46,7 +46,7 @@ function fetchClusterStats(req, esIndexPattern, clusterUuid) {
const metric = ElasticsearchMetric.getMetricFields();
const params = {
index: esIndexPattern,
- size: config.get('xpack.monitoring.max_bucket_size'),
+ size: config.get('monitoring.ui.max_bucket_size'),
ignoreUnavailable: true,
filterPath: [
'hits.hits._index',
diff --git a/x-pack/legacy/plugins/monitoring/server/lib/details/__test__/get_metrics.test.js b/x-pack/legacy/plugins/monitoring/server/lib/details/__test__/get_metrics.test.js
index b7c387e74ec96..fbe6c8ec4cfa3 100644
--- a/x-pack/legacy/plugins/monitoring/server/lib/details/__test__/get_metrics.test.js
+++ b/x-pack/legacy/plugins/monitoring/server/lib/details/__test__/get_metrics.test.js
@@ -20,7 +20,7 @@ function getMockReq(metricsBuckets = []) {
get: sinon.stub(),
};
- config.get.withArgs('xpack.monitoring.min_interval_seconds').returns(10);
+ config.get.withArgs('monitoring.ui.min_interval_seconds').returns(10);
return {
server: {
diff --git a/x-pack/legacy/plugins/monitoring/server/lib/details/get_metrics.js b/x-pack/legacy/plugins/monitoring/server/lib/details/get_metrics.js
index 798a94abbe484..0c4736e91ea10 100644
--- a/x-pack/legacy/plugins/monitoring/server/lib/details/get_metrics.js
+++ b/x-pack/legacy/plugins/monitoring/server/lib/details/get_metrics.js
@@ -28,7 +28,7 @@ export async function getMetrics(
// TODO: Pass in req parameters as explicit function parameters
let min = moment.utc(req.payload.timeRange.min).valueOf();
const max = moment.utc(req.payload.timeRange.max).valueOf();
- const minIntervalSeconds = config.get('xpack.monitoring.min_interval_seconds');
+ const minIntervalSeconds = config.get('monitoring.ui.min_interval_seconds');
const bucketSize = calculateTimeseriesInterval(min, max, minIntervalSeconds);
const timezone = await getTimezone(req);
diff --git a/x-pack/legacy/plugins/monitoring/server/lib/elasticsearch/get_ml_jobs.js b/x-pack/legacy/plugins/monitoring/server/lib/elasticsearch/get_ml_jobs.js
index 658ee96c1f084..8aef402f881e8 100644
--- a/x-pack/legacy/plugins/monitoring/server/lib/elasticsearch/get_ml_jobs.js
+++ b/x-pack/legacy/plugins/monitoring/server/lib/elasticsearch/get_ml_jobs.js
@@ -23,7 +23,7 @@ export function getMlJobs(req, esIndexPattern) {
checkParam(esIndexPattern, 'esIndexPattern in getMlJobs');
const config = req.server.config();
- const maxBucketSize = config.get('xpack.monitoring.max_bucket_size');
+ const maxBucketSize = config.get('monitoring.ui.max_bucket_size');
const start = req.payload.timeRange.min; // no wrapping in moment :)
const end = req.payload.timeRange.max;
const clusterUuid = req.params.clusterUuid;
diff --git a/x-pack/legacy/plugins/monitoring/server/lib/elasticsearch/indices/get_indices.js b/x-pack/legacy/plugins/monitoring/server/lib/elasticsearch/indices/get_indices.js
index 6fe8ccfd89043..938a9b9d55e43 100644
--- a/x-pack/legacy/plugins/monitoring/server/lib/elasticsearch/indices/get_indices.js
+++ b/x-pack/legacy/plugins/monitoring/server/lib/elasticsearch/indices/get_indices.js
@@ -97,7 +97,7 @@ export function getIndices(req, esIndexPattern, showSystemIndices = false, shard
const params = {
index: esIndexPattern,
// TODO: composite aggregation
- size: config.get('xpack.monitoring.max_bucket_size'),
+ size: config.get('monitoring.ui.max_bucket_size'),
ignoreUnavailable: true,
filterPath: [
// only filter path can filter for inner_hits
diff --git a/x-pack/legacy/plugins/monitoring/server/lib/elasticsearch/nodes/get_nodes/get_nodes.js b/x-pack/legacy/plugins/monitoring/server/lib/elasticsearch/nodes/get_nodes/get_nodes.js
index 7581a32590971..c248ad743e0ec 100644
--- a/x-pack/legacy/plugins/monitoring/server/lib/elasticsearch/nodes/get_nodes/get_nodes.js
+++ b/x-pack/legacy/plugins/monitoring/server/lib/elasticsearch/nodes/get_nodes/get_nodes.js
@@ -44,7 +44,7 @@ export async function getNodes(req, esIndexPattern, pageOfNodes, clusterStats, n
const min = start;
const bucketSize = Math.max(
- config.get('xpack.monitoring.min_interval_seconds'),
+ config.get('monitoring.ui.min_interval_seconds'),
calculateAuto(100, duration).asSeconds()
);
@@ -59,7 +59,7 @@ export async function getNodes(req, esIndexPattern, pageOfNodes, clusterStats, n
const params = {
index: esIndexPattern,
- size: config.get('xpack.monitoring.max_bucket_size'),
+ size: config.get('monitoring.ui.max_bucket_size'),
ignoreUnavailable: true,
body: {
query: createQuery({
@@ -78,7 +78,7 @@ export async function getNodes(req, esIndexPattern, pageOfNodes, clusterStats, n
terms: {
field: `source_node.uuid`,
include: uuidsToInclude,
- size: config.get('xpack.monitoring.max_bucket_size'),
+ size: config.get('monitoring.ui.max_bucket_size'),
},
aggs: {
by_date: {
diff --git a/x-pack/legacy/plugins/monitoring/server/lib/elasticsearch/nodes/get_nodes/get_paginated_nodes.js b/x-pack/legacy/plugins/monitoring/server/lib/elasticsearch/nodes/get_nodes/get_paginated_nodes.js
index 51c61046e9cda..e18d328e8725b 100644
--- a/x-pack/legacy/plugins/monitoring/server/lib/elasticsearch/nodes/get_nodes/get_paginated_nodes.js
+++ b/x-pack/legacy/plugins/monitoring/server/lib/elasticsearch/nodes/get_nodes/get_paginated_nodes.js
@@ -38,7 +38,7 @@ export async function getPaginatedNodes(
{ clusterStats, nodesShardCount }
) {
const config = req.server.config();
- const size = config.get('xpack.monitoring.max_bucket_size');
+ const size = config.get('monitoring.ui.max_bucket_size');
const nodes = await getNodeIds(req, esIndexPattern, { clusterUuid }, size);
// Add `isOnline` and shards from the cluster state and shard stats
@@ -63,7 +63,7 @@ export async function getPaginatedNodes(
const groupBy = {
field: `source_node.uuid`,
include: nodes.map(node => node.uuid),
- size: config.get('xpack.monitoring.max_bucket_size'),
+ size: config.get('monitoring.ui.max_bucket_size'),
};
const metricSeriesData = await getMetrics(
req,
diff --git a/x-pack/legacy/plugins/monitoring/server/lib/elasticsearch/shards/get_indices_unassigned_shard_stats.js b/x-pack/legacy/plugins/monitoring/server/lib/elasticsearch/shards/get_indices_unassigned_shard_stats.js
index e8d484e7021f4..c77bcc4f62e61 100644
--- a/x-pack/legacy/plugins/monitoring/server/lib/elasticsearch/shards/get_indices_unassigned_shard_stats.js
+++ b/x-pack/legacy/plugins/monitoring/server/lib/elasticsearch/shards/get_indices_unassigned_shard_stats.js
@@ -12,7 +12,7 @@ import { calculateIndicesTotals } from './calculate_shard_stat_indices_totals';
async function getUnassignedShardData(req, esIndexPattern, cluster) {
const config = req.server.config();
- const maxBucketSize = config.get('xpack.monitoring.max_bucket_size');
+ const maxBucketSize = config.get('monitoring.ui.max_bucket_size');
const metric = ElasticsearchMetric.getMetricFields();
const params = {
diff --git a/x-pack/legacy/plugins/monitoring/server/lib/elasticsearch/shards/get_nodes_shard_count.js b/x-pack/legacy/plugins/monitoring/server/lib/elasticsearch/shards/get_nodes_shard_count.js
index c11bd4aead693..7823884dc749d 100644
--- a/x-pack/legacy/plugins/monitoring/server/lib/elasticsearch/shards/get_nodes_shard_count.js
+++ b/x-pack/legacy/plugins/monitoring/server/lib/elasticsearch/shards/get_nodes_shard_count.js
@@ -11,7 +11,7 @@ import { ElasticsearchMetric } from '../../metrics';
async function getShardCountPerNode(req, esIndexPattern, cluster) {
const config = req.server.config();
- const maxBucketSize = config.get('xpack.monitoring.max_bucket_size');
+ const maxBucketSize = config.get('monitoring.ui.max_bucket_size');
const metric = ElasticsearchMetric.getMetricFields();
const params = {
diff --git a/x-pack/legacy/plugins/monitoring/server/lib/elasticsearch/shards/get_shard_allocation.js b/x-pack/legacy/plugins/monitoring/server/lib/elasticsearch/shards/get_shard_allocation.js
index 3be5650b7d3bc..40412c03b0ef9 100644
--- a/x-pack/legacy/plugins/monitoring/server/lib/elasticsearch/shards/get_shard_allocation.js
+++ b/x-pack/legacy/plugins/monitoring/server/lib/elasticsearch/shards/get_shard_allocation.js
@@ -55,7 +55,7 @@ export function getShardAllocation(
const metric = ElasticsearchMetric.getMetricFields();
const params = {
index: esIndexPattern,
- size: config.get('xpack.monitoring.max_bucket_size'),
+ size: config.get('monitoring.ui.max_bucket_size'),
ignoreUnavailable: true,
body: {
query: createQuery({ type: 'shards', clusterUuid, metric, filters }),
diff --git a/x-pack/legacy/plugins/monitoring/server/lib/elasticsearch/shards/get_shard_stat_aggs.js b/x-pack/legacy/plugins/monitoring/server/lib/elasticsearch/shards/get_shard_stat_aggs.js
index eddd50612cdb1..8c4834e5d5e40 100644
--- a/x-pack/legacy/plugins/monitoring/server/lib/elasticsearch/shards/get_shard_stat_aggs.js
+++ b/x-pack/legacy/plugins/monitoring/server/lib/elasticsearch/shards/get_shard_stat_aggs.js
@@ -9,7 +9,7 @@
* @param {Boolean} includeNodes - whether to add the aggs for node shards
*/
export function getShardAggs(config, includeNodes, includeIndices) {
- const maxBucketSize = config.get('xpack.monitoring.max_bucket_size');
+ const maxBucketSize = config.get('monitoring.ui.max_bucket_size');
const aggSize = 10;
const indicesAgg = {
terms: {
diff --git a/x-pack/legacy/plugins/monitoring/server/lib/kibana/get_kibanas.js b/x-pack/legacy/plugins/monitoring/server/lib/kibana/get_kibanas.js
index af6563bae682d..c272c38f00d55 100644
--- a/x-pack/legacy/plugins/monitoring/server/lib/kibana/get_kibanas.js
+++ b/x-pack/legacy/plugins/monitoring/server/lib/kibana/get_kibanas.js
@@ -31,7 +31,7 @@ export function getKibanas(req, kbnIndexPattern, { clusterUuid }) {
const params = {
index: kbnIndexPattern,
- size: config.get('xpack.monitoring.max_bucket_size'),
+ size: config.get('monitoring.ui.max_bucket_size'),
ignoreUnavailable: true,
body: {
query: createQuery({
diff --git a/x-pack/legacy/plugins/monitoring/server/lib/kibana/get_kibanas_for_clusters.js b/x-pack/legacy/plugins/monitoring/server/lib/kibana/get_kibanas_for_clusters.js
index dbf1c41dcf4e5..e50e8bda3c907 100644
--- a/x-pack/legacy/plugins/monitoring/server/lib/kibana/get_kibanas_for_clusters.js
+++ b/x-pack/legacy/plugins/monitoring/server/lib/kibana/get_kibanas_for_clusters.js
@@ -49,7 +49,7 @@ export function getKibanasForClusters(req, kbnIndexPattern, clusters) {
kibana_uuids: {
terms: {
field: 'kibana_stats.kibana.uuid',
- size: config.get('xpack.monitoring.max_bucket_size'),
+ size: config.get('monitoring.ui.max_bucket_size'),
},
aggs: {
latest_report: {
diff --git a/x-pack/legacy/plugins/monitoring/server/lib/logs/get_logs.js b/x-pack/legacy/plugins/monitoring/server/lib/logs/get_logs.js
index 7a20d7737c5e8..b876e3ba05d70 100644
--- a/x-pack/legacy/plugins/monitoring/server/lib/logs/get_logs.js
+++ b/x-pack/legacy/plugins/monitoring/server/lib/logs/get_logs.js
@@ -70,7 +70,7 @@ export async function getLogs(
const params = {
index: filebeatIndexPattern,
- size: Math.min(50, config.get('xpack.monitoring.elasticsearch.logFetchCount')),
+ size: Math.min(50, config.get('monitoring.ui.elasticsearch.logFetchCount')),
filterPath: [
'hits.hits._source.message',
'hits.hits._source.log.level',
diff --git a/x-pack/legacy/plugins/monitoring/server/lib/logstash/get_logstash_for_clusters.js b/x-pack/legacy/plugins/monitoring/server/lib/logstash/get_logstash_for_clusters.js
index d0de2c3f5df3a..55baa3cf10b50 100644
--- a/x-pack/legacy/plugins/monitoring/server/lib/logstash/get_logstash_for_clusters.js
+++ b/x-pack/legacy/plugins/monitoring/server/lib/logstash/get_logstash_for_clusters.js
@@ -60,7 +60,7 @@ export function getLogstashForClusters(req, lsIndexPattern, clusters) {
logstash_uuids: {
terms: {
field: 'logstash_stats.logstash.uuid',
- size: config.get('xpack.monitoring.max_bucket_size'),
+ size: config.get('monitoring.ui.max_bucket_size'),
},
aggs: {
latest_report: {
@@ -119,7 +119,7 @@ export function getLogstashForClusters(req, lsIndexPattern, clusters) {
logstash_versions: {
terms: {
field: 'logstash_stats.logstash.version',
- size: config.get('xpack.monitoring.max_bucket_size'),
+ size: config.get('monitoring.ui.max_bucket_size'),
},
},
pipelines_nested: {
@@ -135,7 +135,7 @@ export function getLogstashForClusters(req, lsIndexPattern, clusters) {
queue_types: {
terms: {
field: 'logstash_stats.pipelines.queue.type',
- size: config.get('xpack.monitoring.max_bucket_size'),
+ size: config.get('monitoring.ui.max_bucket_size'),
},
aggs: {
num_pipelines: {
diff --git a/x-pack/legacy/plugins/monitoring/server/lib/logstash/get_nodes.js b/x-pack/legacy/plugins/monitoring/server/lib/logstash/get_nodes.js
index 93b70d7b79f0a..06696abdb031f 100644
--- a/x-pack/legacy/plugins/monitoring/server/lib/logstash/get_nodes.js
+++ b/x-pack/legacy/plugins/monitoring/server/lib/logstash/get_nodes.js
@@ -31,7 +31,7 @@ export function getNodes(req, lsIndexPattern, { clusterUuid }) {
const params = {
index: lsIndexPattern,
- size: config.get('xpack.monitoring.max_bucket_size'), // FIXME
+ size: config.get('monitoring.ui.max_bucket_size'), // FIXME
ignoreUnavailable: true,
body: {
query: createQuery({
diff --git a/x-pack/legacy/plugins/monitoring/server/lib/logstash/get_paginated_pipelines.js b/x-pack/legacy/plugins/monitoring/server/lib/logstash/get_paginated_pipelines.js
index ef9ef90e8f310..ffc7e9ce1d6c2 100644
--- a/x-pack/legacy/plugins/monitoring/server/lib/logstash/get_paginated_pipelines.js
+++ b/x-pack/legacy/plugins/monitoring/server/lib/logstash/get_paginated_pipelines.js
@@ -37,7 +37,7 @@ export async function getPaginatedPipelines(
queryText
) {
const config = req.server.config();
- const size = config.get('xpack.monitoring.max_bucket_size');
+ const size = config.get('monitoring.ui.max_bucket_size');
const pipelines = await getLogstashPipelineIds(
req,
lsIndexPattern,
diff --git a/x-pack/legacy/plugins/monitoring/server/lib/logstash/get_pipeline.js b/x-pack/legacy/plugins/monitoring/server/lib/logstash/get_pipeline.js
index eeeffd74e91f7..35a4295de298b 100644
--- a/x-pack/legacy/plugins/monitoring/server/lib/logstash/get_pipeline.js
+++ b/x-pack/legacy/plugins/monitoring/server/lib/logstash/get_pipeline.js
@@ -111,7 +111,7 @@ export async function getPipeline(req, config, lsIndexPattern, clusterUuid, pipe
};
// Determine metrics' timeseries interval based on version's timespan
- const minIntervalSeconds = config.get('xpack.monitoring.min_interval_seconds');
+ const minIntervalSeconds = config.get('monitoring.ui.min_interval_seconds');
const timeseriesInterval = calculateTimeseriesInterval(
version.firstSeen,
version.lastSeen,
diff --git a/x-pack/legacy/plugins/monitoring/server/lib/logstash/get_pipeline_stats_aggregation.js b/x-pack/legacy/plugins/monitoring/server/lib/logstash/get_pipeline_stats_aggregation.js
index 1858674a01b86..d9c03819b0098 100644
--- a/x-pack/legacy/plugins/monitoring/server/lib/logstash/get_pipeline_stats_aggregation.js
+++ b/x-pack/legacy/plugins/monitoring/server/lib/logstash/get_pipeline_stats_aggregation.js
@@ -171,7 +171,7 @@ export function getPipelineStatsAggregation(
logstashIndexPattern,
pipelineId,
version,
- config.get('xpack.monitoring.max_bucket_size'),
+ config.get('monitoring.ui.max_bucket_size'),
callWithRequest,
req
);
diff --git a/x-pack/legacy/plugins/monitoring/server/lib/logstash/get_pipeline_versions.js b/x-pack/legacy/plugins/monitoring/server/lib/logstash/get_pipeline_versions.js
index 7dfa8d4a163ce..7521389c379ea 100644
--- a/x-pack/legacy/plugins/monitoring/server/lib/logstash/get_pipeline_versions.js
+++ b/x-pack/legacy/plugins/monitoring/server/lib/logstash/get_pipeline_versions.js
@@ -37,7 +37,7 @@ function fetchPipelineVersions(...args) {
by_pipeline_hash: {
terms: {
field: 'logstash_stats.pipelines.hash',
- size: config.get('xpack.monitoring.max_bucket_size'),
+ size: config.get('monitoring.ui.max_bucket_size'),
order: { 'path_to_root>first_seen': 'desc' },
},
aggs: {
diff --git a/x-pack/legacy/plugins/monitoring/server/lib/logstash/get_pipeline_vertex.js b/x-pack/legacy/plugins/monitoring/server/lib/logstash/get_pipeline_vertex.js
index 49c2dff2d6080..134dd88b36ce6 100644
--- a/x-pack/legacy/plugins/monitoring/server/lib/logstash/get_pipeline_vertex.js
+++ b/x-pack/legacy/plugins/monitoring/server/lib/logstash/get_pipeline_vertex.js
@@ -130,7 +130,7 @@ export async function getPipelineVertex(
};
// Determine metrics' timeseries interval based on version's timespan
- const minIntervalSeconds = config.get('xpack.monitoring.min_interval_seconds');
+ const minIntervalSeconds = config.get('monitoring.ui.min_interval_seconds');
const timeseriesInterval = calculateTimeseriesInterval(
version.firstSeen,
version.lastSeen,
diff --git a/x-pack/legacy/plugins/monitoring/server/lib/logstash/get_pipeline_vertex_stats_aggregation.js b/x-pack/legacy/plugins/monitoring/server/lib/logstash/get_pipeline_vertex_stats_aggregation.js
index c91182188b213..425ca5731926c 100644
--- a/x-pack/legacy/plugins/monitoring/server/lib/logstash/get_pipeline_vertex_stats_aggregation.js
+++ b/x-pack/legacy/plugins/monitoring/server/lib/logstash/get_pipeline_vertex_stats_aggregation.js
@@ -216,7 +216,7 @@ export function getPipelineVertexStatsAggregation(
version,
vertexId,
timeSeriesIntervalInSeconds,
- config.get('xpack.monitoring.max_bucket_size'),
+ config.get('monitoring.ui.max_bucket_size'),
callWithRequest,
req
);
diff --git a/x-pack/legacy/plugins/monitoring/server/plugin.js b/x-pack/legacy/plugins/monitoring/server/plugin.js
index 163bc43945be1..ef346e95ad075 100644
--- a/x-pack/legacy/plugins/monitoring/server/plugin.js
+++ b/x-pack/legacy/plugins/monitoring/server/plugin.js
@@ -48,7 +48,7 @@ export class Plugin {
/*
* End-user-facing services
*/
- const uiEnabled = config.get('xpack.monitoring.ui.enabled');
+ const uiEnabled = config.get('monitoring.ui.enabled');
if (uiEnabled) {
await instantiateClient({
@@ -98,7 +98,7 @@ export class Plugin {
kbnServerStatus: kbnServer.status,
kbnServerVersion: kbnServer.version,
});
- const kibanaCollectionEnabled = config.get('xpack.monitoring.kibana.collection.enabled');
+ const kibanaCollectionEnabled = config.get('monitoring.kibana.collection.enabled');
if (kibanaCollectionEnabled) {
/*
@@ -125,14 +125,12 @@ export class Plugin {
core.injectUiAppVars('monitoring', () => {
const config = core.config();
return {
- maxBucketSize: config.get('xpack.monitoring.max_bucket_size'),
- minIntervalSeconds: config.get('xpack.monitoring.min_interval_seconds'),
+ maxBucketSize: config.get('monitoring.ui.max_bucket_size'),
+ minIntervalSeconds: config.get('monitoring.ui.min_interval_seconds'),
kbnIndex: config.get('kibana.index'),
- showLicenseExpiration: config.get('xpack.monitoring.show_license_expiration'),
- showCgroupMetricsElasticsearch: config.get(
- 'xpack.monitoring.ui.container.elasticsearch.enabled'
- ),
- showCgroupMetricsLogstash: config.get('xpack.monitoring.ui.container.logstash.enabled'), // Note, not currently used, but see https://github.com/elastic/x-pack-kibana/issues/1559 part 2
+ showLicenseExpiration: config.get('monitoring.ui.show_license_expiration'),
+ showCgroupMetricsElasticsearch: config.get('monitoring.ui.container.elasticsearch.enabled'),
+ showCgroupMetricsLogstash: config.get('monitoring.ui.container.logstash.enabled'), // Note, not currently used, but see https://github.com/elastic/x-pack-kibana/issues/1559 part 2
};
});
}
diff --git a/x-pack/legacy/plugins/monitoring/server/routes/api/v1/elasticsearch/ccr.js b/x-pack/legacy/plugins/monitoring/server/routes/api/v1/elasticsearch/ccr.js
index 2d4bded9fc4c8..fcdf4ad8a706c 100644
--- a/x-pack/legacy/plugins/monitoring/server/routes/api/v1/elasticsearch/ccr.js
+++ b/x-pack/legacy/plugins/monitoring/server/routes/api/v1/elasticsearch/ccr.js
@@ -26,7 +26,7 @@ function getBucketScript(max, min) {
function buildRequest(req, config, esIndexPattern) {
const min = moment.utc(req.payload.timeRange.min).valueOf();
const max = moment.utc(req.payload.timeRange.max).valueOf();
- const maxBucketSize = config.get('xpack.monitoring.max_bucket_size');
+ const maxBucketSize = config.get('monitoring.ui.max_bucket_size');
const aggs = {
ops_synced_max: {
max: {
diff --git a/x-pack/legacy/plugins/monitoring/server/routes/api/v1/elasticsearch/node_detail.js b/x-pack/legacy/plugins/monitoring/server/routes/api/v1/elasticsearch/node_detail.js
index 10226d74ed001..25ead723e3ddb 100644
--- a/x-pack/legacy/plugins/monitoring/server/routes/api/v1/elasticsearch/node_detail.js
+++ b/x-pack/legacy/plugins/monitoring/server/routes/api/v1/elasticsearch/node_detail.js
@@ -61,7 +61,7 @@ export function esNodeRoute(server) {
metricSet = metricSetOverview;
// set the cgroup option if needed
const showCgroupMetricsElasticsearch = config.get(
- 'xpack.monitoring.ui.container.elasticsearch.enabled'
+ 'monitoring.ui.container.elasticsearch.enabled'
);
const metricCpu = metricSet.find(m => m.name === 'node_cpu_metric');
if (showCgroupMetricsElasticsearch) {
diff --git a/x-pack/legacy/plugins/monitoring/server/routes/api/v1/logstash/node.js b/x-pack/legacy/plugins/monitoring/server/routes/api/v1/logstash/node.js
index d5ce9d1686f8a..bd3ae5f5c2679 100644
--- a/x-pack/legacy/plugins/monitoring/server/routes/api/v1/logstash/node.js
+++ b/x-pack/legacy/plugins/monitoring/server/routes/api/v1/logstash/node.js
@@ -60,9 +60,7 @@ export function logstashNodeRoute(server) {
} else {
metricSet = metricSetOverview;
// set the cgroup option if needed
- const showCgroupMetricsLogstash = config.get(
- 'xpack.monitoring.ui.container.logstash.enabled'
- );
+ const showCgroupMetricsLogstash = config.get('monitoring.ui.container.logstash.enabled');
const metricCpu = metricSet.find(m => m.name === 'logstash_node_cpu_metric');
if (showCgroupMetricsLogstash) {
metricCpu.keys = ['logstash_node_cgroup_quota_as_cpu_utilization'];
diff --git a/x-pack/legacy/plugins/monitoring/server/routes/api/v1/logstash/pipelines/cluster_pipeline_ids.js b/x-pack/legacy/plugins/monitoring/server/routes/api/v1/logstash/pipelines/cluster_pipeline_ids.js
index c5fd76487cca1..93330880babcc 100644
--- a/x-pack/legacy/plugins/monitoring/server/routes/api/v1/logstash/pipelines/cluster_pipeline_ids.js
+++ b/x-pack/legacy/plugins/monitoring/server/routes/api/v1/logstash/pipelines/cluster_pipeline_ids.js
@@ -36,7 +36,7 @@ export function logstashClusterPipelineIdsRoute(server) {
const { ccs } = req.payload;
const clusterUuid = req.params.clusterUuid;
const lsIndexPattern = prefixIndexPattern(config, INDEX_PATTERN_LOGSTASH, ccs);
- const size = config.get('xpack.monitoring.max_bucket_size');
+ const size = config.get('monitoring.ui.max_bucket_size');
try {
const pipelines = await getLogstashPipelineIds(req, lsIndexPattern, { clusterUuid }, size);
diff --git a/x-pack/legacy/plugins/monitoring/server/telemetry_collection/get_cluster_uuids.ts b/x-pack/legacy/plugins/monitoring/server/telemetry_collection/get_cluster_uuids.ts
index fc85cbe442ddf..4738ab5b8af83 100644
--- a/x-pack/legacy/plugins/monitoring/server/telemetry_collection/get_cluster_uuids.ts
+++ b/x-pack/legacy/plugins/monitoring/server/telemetry_collection/get_cluster_uuids.ts
@@ -40,7 +40,7 @@ export function fetchClusterUuids({ server, callCluster, start, end }: StatsColl
cluster_uuids: {
terms: {
field: 'cluster_uuid',
- size: config.get('xpack.monitoring.max_bucket_size'),
+ size: config.get('monitoring.ui.max_bucket_size'),
},
},
},
diff --git a/x-pack/legacy/plugins/monitoring/server/telemetry_collection/get_es_stats.js b/x-pack/legacy/plugins/monitoring/server/telemetry_collection/get_es_stats.js
index 8e5a59361e52f..52d34258b5fa4 100644
--- a/x-pack/legacy/plugins/monitoring/server/telemetry_collection/get_es_stats.js
+++ b/x-pack/legacy/plugins/monitoring/server/telemetry_collection/get_es_stats.js
@@ -31,7 +31,7 @@ export function fetchElasticsearchStats(server, callCluster, clusterUuids) {
const config = server.config();
const params = {
index: INDEX_PATTERN_ELASTICSEARCH,
- size: config.get('xpack.monitoring.max_bucket_size'),
+ size: config.get('monitoring.ui.max_bucket_size'),
ignoreUnavailable: true,
filterPath: [
'hits.hits._source.cluster_uuid',
diff --git a/x-pack/legacy/plugins/monitoring/server/telemetry_collection/get_high_level_stats.js b/x-pack/legacy/plugins/monitoring/server/telemetry_collection/get_high_level_stats.js
index 2632a8f6e041d..b87f632308e4d 100644
--- a/x-pack/legacy/plugins/monitoring/server/telemetry_collection/get_high_level_stats.js
+++ b/x-pack/legacy/plugins/monitoring/server/telemetry_collection/get_high_level_stats.js
@@ -217,7 +217,7 @@ export async function fetchHighLevelStats(server, callCluster, clusterUuids, sta
const params = {
index: getIndexPatternForStackProduct(product),
- size: config.get('xpack.monitoring.max_bucket_size'),
+ size: config.get('monitoring.ui.max_bucket_size'),
headers: {
'X-QUERY-SOURCE': TELEMETRY_QUERY_SOURCE,
},
diff --git a/x-pack/legacy/plugins/monitoring/ui_exports.js b/x-pack/legacy/plugins/monitoring/ui_exports.js
index 2b5ea21a2bb45..9251deb673bd1 100644
--- a/x-pack/legacy/plugins/monitoring/ui_exports.js
+++ b/x-pack/legacy/plugins/monitoring/ui_exports.js
@@ -32,7 +32,7 @@ export const getUiExports = () => ({
injectDefaultVars(server) {
const config = server.config();
return {
- monitoringUiEnabled: config.get('xpack.monitoring.ui.enabled'),
+ monitoringUiEnabled: config.get('monitoring.ui.enabled'),
};
},
hacks: ['plugins/monitoring/hacks/toggle_app_link_in_nav'],
diff --git a/x-pack/legacy/plugins/rollup/__jest__/client_integration/helpers/http_requests.js b/x-pack/legacy/plugins/rollup/__jest__/client_integration/helpers/http_requests.js
deleted file mode 100644
index 4552e62c371a1..0000000000000
--- a/x-pack/legacy/plugins/rollup/__jest__/client_integration/helpers/http_requests.js
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * 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 sinon from 'sinon';
-
-// Register helpers to mock HTTP Requests
-const registerHttpRequestMockHelpers = server => {
- const setIndexPatternValidityResponse = response => {
- const defaultResponse = {
- doesMatchIndices: true,
- doesMatchRollupIndices: false,
- dateFields: ['foo', 'bar'],
- numericFields: [],
- keywordFields: [],
- };
- server.respondWith(/\/api\/rollup\/index_pattern_validity\/.*/, [
- 200,
- { 'Content-Type': 'application/json' },
- JSON.stringify({ ...defaultResponse, ...response }),
- ]);
- };
-
- const setCreateJobResponse = (responsePayload = {}) => {
- server.respondWith(/\/api\/rollup\/create/, [
- 200,
- { 'Content-Type': 'application/json' },
- JSON.stringify(responsePayload),
- ]);
- };
-
- const setStartJobResponse = () => {
- server.respondWith(/\/api\/rollup\/start/, [
- 200,
- { 'Content-Type': 'application/json' },
- JSON.stringify({}),
- ]);
- };
-
- const setLoadJobsResponse = response => {
- server.respondWith('GET', '/api/rollup/jobs', [
- 200,
- { 'Content-Type': 'application/json' },
- JSON.stringify(response),
- ]);
- };
-
- return {
- setIndexPatternValidityResponse,
- setCreateJobResponse,
- setLoadJobsResponse,
- setStartJobResponse,
- };
-};
-
-export const init = () => {
- const server = sinon.fakeServer.create();
- server.respondImmediately = true;
-
- // We make requests to APIs which don't impact the UX, e.g. UI metric telemetry,
- // and we can mock them all with a 200 instead of mocking each one individually.
- server.respondWith([200, {}, '']);
-
- return {
- server,
- httpRequestsMockHelpers: registerHttpRequestMockHelpers(server),
- };
-};
diff --git a/x-pack/legacy/plugins/rollup/__jest__/client_integration/helpers/index.js b/x-pack/legacy/plugins/rollup/__jest__/client_integration/helpers/index.js
index 9573e2f405b84..4a5b67e687d85 100644
--- a/x-pack/legacy/plugins/rollup/__jest__/client_integration/helpers/index.js
+++ b/x-pack/legacy/plugins/rollup/__jest__/client_integration/helpers/index.js
@@ -10,7 +10,9 @@ import { setup as jobCloneSetup } from './job_clone.helpers';
export { nextTick, getRandomString, findTestSubject } from '../../../../../../test_utils';
-export { setupEnvironment } from './setup_environment';
+export { mockHttpRequest } from './setup_environment';
+
+export { wrapComponent } from './setup_context';
export const pageHelpers = {
jobCreate: { setup: jobCreateSetup },
diff --git a/x-pack/legacy/plugins/rollup/__jest__/client_integration/helpers/job_clone.helpers.js b/x-pack/legacy/plugins/rollup/__jest__/client_integration/helpers/job_clone.helpers.js
index db0bb49289b60..a8376bb31b23f 100644
--- a/x-pack/legacy/plugins/rollup/__jest__/client_integration/helpers/job_clone.helpers.js
+++ b/x-pack/legacy/plugins/rollup/__jest__/client_integration/helpers/job_clone.helpers.js
@@ -10,8 +10,10 @@ import { JobCreate } from '../../../public/crud_app/sections';
import { JOB_TO_CLONE } from './constants';
import { deserializeJob } from '../../../public/crud_app/services';
+import { wrapComponent } from './setup_context';
+
export const setup = props => {
- const initTestBed = registerTestBed(JobCreate, {
+ const initTestBed = registerTestBed(wrapComponent(JobCreate), {
store: createRollupJobsStore({
cloneJob: { job: deserializeJob(JOB_TO_CLONE.jobs[0]) },
}),
diff --git a/x-pack/legacy/plugins/rollup/__jest__/client_integration/helpers/job_create.helpers.js b/x-pack/legacy/plugins/rollup/__jest__/client_integration/helpers/job_create.helpers.js
index 5de5d02dadd83..2395fd014dd1e 100644
--- a/x-pack/legacy/plugins/rollup/__jest__/client_integration/helpers/job_create.helpers.js
+++ b/x-pack/legacy/plugins/rollup/__jest__/client_integration/helpers/job_create.helpers.js
@@ -10,7 +10,9 @@ import { JobCreate } from '../../../public/crud_app/sections';
import { JOB_TO_CREATE } from './constants';
-const initTestBed = registerTestBed(JobCreate, { store: rollupJobsStore });
+import { wrapComponent } from './setup_context';
+
+const initTestBed = registerTestBed(wrapComponent(JobCreate), { store: rollupJobsStore });
export const setup = props => {
const testBed = initTestBed(props);
diff --git a/x-pack/legacy/plugins/rollup/__jest__/client_integration/helpers/job_list.helpers.js b/x-pack/legacy/plugins/rollup/__jest__/client_integration/helpers/job_list.helpers.js
index 10fa79f775fdc..bcad8c29c87c0 100644
--- a/x-pack/legacy/plugins/rollup/__jest__/client_integration/helpers/job_list.helpers.js
+++ b/x-pack/legacy/plugins/rollup/__jest__/client_integration/helpers/job_list.helpers.js
@@ -9,6 +9,8 @@ import { registerRouter } from '../../../public/crud_app/services';
import { createRollupJobsStore } from '../../../public/crud_app/store';
import { JobList } from '../../../public/crud_app/sections/job_list';
+import { wrapComponent } from './setup_context';
+
const testBedConfig = {
store: createRollupJobsStore,
memoryRouter: {
@@ -19,4 +21,4 @@ const testBedConfig = {
},
};
-export const setup = registerTestBed(JobList, testBedConfig);
+export const setup = registerTestBed(wrapComponent(JobList), testBedConfig);
diff --git a/x-pack/legacy/plugins/rollup/__jest__/client_integration/helpers/setup_context.tsx b/x-pack/legacy/plugins/rollup/__jest__/client_integration/helpers/setup_context.tsx
new file mode 100644
index 0000000000000..4c5a8e17c586a
--- /dev/null
+++ b/x-pack/legacy/plugins/rollup/__jest__/client_integration/helpers/setup_context.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 React, { FunctionComponent } from 'react';
+
+import { KibanaContextProvider } from '../../../../../../../src/plugins/kibana_react/public';
+import { coreMock } from '../../../../../../../src/core/public/mocks';
+const startMock = coreMock.createStart();
+
+const services = {
+ setBreadcrumbs: startMock.chrome.setBreadcrumbs,
+};
+
+const wrapComponent = (Component: FunctionComponent) => (props: any) => (
+
+
+
+);
+
+export { wrapComponent };
diff --git a/x-pack/legacy/plugins/rollup/__jest__/client_integration/helpers/setup_environment.js b/x-pack/legacy/plugins/rollup/__jest__/client_integration/helpers/setup_environment.js
deleted file mode 100644
index 71e7f050786b5..0000000000000
--- a/x-pack/legacy/plugins/rollup/__jest__/client_integration/helpers/setup_environment.js
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * 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 axios from 'axios';
-import axiosXhrAdapter from 'axios/lib/adapters/xhr';
-
-import { setHttp } from '../../../public/crud_app/services';
-import { init as initHttpRequests } from './http_requests';
-
-export const setupEnvironment = () => {
- // axios has a $http like interface so using it to simulate $http
- setHttp(axios.create({ adapter: axiosXhrAdapter }));
-
- const { server, httpRequestsMockHelpers } = initHttpRequests();
-
- return {
- server,
- httpRequestsMockHelpers,
- };
-};
diff --git a/x-pack/legacy/plugins/rollup/__jest__/client_integration/helpers/setup_environment.ts b/x-pack/legacy/plugins/rollup/__jest__/client_integration/helpers/setup_environment.ts
new file mode 100644
index 0000000000000..a8db058908ad4
--- /dev/null
+++ b/x-pack/legacy/plugins/rollup/__jest__/client_integration/helpers/setup_environment.ts
@@ -0,0 +1,44 @@
+/*
+ * 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.
+ */
+
+interface RequestMocks {
+ jobs?: object;
+ createdJob?: object;
+ indxPatternVldtResp?: object;
+ [key: string]: any;
+}
+
+const mockHttpRequest = (
+ http: any,
+ { jobs = {}, createdJob = {}, indxPatternVldtResp = {} }: RequestMocks = {}
+) => {
+ http.get.mockImplementation(async (url: string) => {
+ if (url === '/api/rollup/jobs') {
+ return jobs;
+ }
+
+ if (url.startsWith('/api/rollup/index_pattern_validity')) {
+ return {
+ doesMatchIndices: true,
+ doesMatchRollupIndices: false,
+ dateFields: ['foo', 'bar'],
+ numericFields: [],
+ keywordFields: [],
+ ...indxPatternVldtResp,
+ };
+ }
+
+ return {};
+ });
+
+ // mock '/api/rollup/start'
+ http.post.mockImplementation(async (url: string) => ({}));
+
+ // mock '/api/rollup/create
+ http.put.mockImplementation(async (url: string) => createdJob);
+};
+
+export { mockHttpRequest };
diff --git a/x-pack/legacy/plugins/rollup/__jest__/client_integration/job_create_clone.test.js b/x-pack/legacy/plugins/rollup/__jest__/client_integration/job_create_clone.test.js
index 4ffffd7574bd8..b7c98ed179c7a 100644
--- a/x-pack/legacy/plugins/rollup/__jest__/client_integration/job_create_clone.test.js
+++ b/x-pack/legacy/plugins/rollup/__jest__/client_integration/job_create_clone.test.js
@@ -4,7 +4,8 @@
* you may not use this file except in compliance with the Elastic License.
*/
-import { setupEnvironment, pageHelpers, nextTick } from './helpers';
+import { setHttp } from '../../public/crud_app/services';
+import { mockHttpRequest, pageHelpers, nextTick } from './helpers';
import { JOB_TO_CLONE, JOB_CLONE_INDEX_PATTERN_CHECK } from './helpers/constants';
jest.mock('ui/new_platform');
@@ -17,26 +18,28 @@ const {
} = JOB_TO_CLONE;
describe('Cloning a rollup job through create job wizard', () => {
- let httpRequestsMockHelpers;
- let server;
let find;
let exists;
let form;
let table;
let actions;
+ let npStart;
beforeAll(() => {
- ({ server, httpRequestsMockHelpers } = setupEnvironment());
+ npStart = require('ui/new_platform').npStart; // eslint-disable-line
+ setHttp(npStart.core.http);
});
beforeEach(() => {
- httpRequestsMockHelpers.setIndexPatternValidityResponse(JOB_CLONE_INDEX_PATTERN_CHECK);
+ mockHttpRequest(npStart.core.http, { indxPatternVldtResp: JOB_CLONE_INDEX_PATTERN_CHECK });
({ exists, find, form, actions, table } = setup());
});
- afterAll(() => {
- server.restore();
+ afterEach(() => {
+ npStart.core.http.get.mockClear();
+ npStart.core.http.post.mockClear();
+ npStart.core.http.put.mockClear();
});
it('should have fields correctly pre-populated', async () => {
diff --git a/x-pack/legacy/plugins/rollup/__jest__/client_integration/job_create_date_histogram.test.js b/x-pack/legacy/plugins/rollup/__jest__/client_integration/job_create_date_histogram.test.js
index c4336c535a0ee..b8ec7d9f85d00 100644
--- a/x-pack/legacy/plugins/rollup/__jest__/client_integration/job_create_date_histogram.test.js
+++ b/x-pack/legacy/plugins/rollup/__jest__/client_integration/job_create_date_histogram.test.js
@@ -6,7 +6,8 @@
import moment from 'moment-timezone';
-import { setupEnvironment, pageHelpers } from './helpers';
+import { setHttp } from '../../public/crud_app/services';
+import { mockHttpRequest, pageHelpers } from './helpers';
jest.mock('ui/new_platform');
@@ -15,30 +16,31 @@ jest.mock('lodash/function/debounce', () => fn => fn);
const { setup } = pageHelpers.jobCreate;
describe('Create Rollup Job, step 2: Date histogram', () => {
- let server;
- let httpRequestsMockHelpers;
let find;
let exists;
let actions;
let goToStep;
let form;
let getEuiStepsHorizontalActive;
+ let npStart;
beforeAll(() => {
- ({ server, httpRequestsMockHelpers } = setupEnvironment());
+ npStart = require('ui/new_platform').npStart; // eslint-disable-line
+ setHttp(npStart.core.http);
});
-
- afterAll(() => {
- server.restore();
- });
-
beforeEach(() => {
// Set "default" mock responses by not providing any arguments
- httpRequestsMockHelpers.setIndexPatternValidityResponse();
+ mockHttpRequest(npStart.core.http);
({ find, exists, actions, form, getEuiStepsHorizontalActive, goToStep } = setup());
});
+ afterEach(() => {
+ npStart.core.http.get.mockClear();
+ npStart.core.http.post.mockClear();
+ npStart.core.http.put.mockClear();
+ });
+
describe('layout', () => {
beforeEach(async () => {
await goToStep(2);
@@ -71,7 +73,7 @@ describe('Create Rollup Job, step 2: Date histogram', () => {
describe('Date field select', () => {
it('should set the options value from the index pattern', async () => {
const dateFields = ['field1', 'field2', 'field3'];
- httpRequestsMockHelpers.setIndexPatternValidityResponse({ dateFields });
+ mockHttpRequest(npStart.core.http, { indxPatternVldtResp: { dateFields } });
await goToStep(2);
@@ -83,7 +85,7 @@ describe('Create Rollup Job, step 2: Date histogram', () => {
it('should sort the options in ascending order', async () => {
const dateFields = ['field3', 'field2', 'field1'];
- httpRequestsMockHelpers.setIndexPatternValidityResponse({ dateFields });
+ mockHttpRequest(npStart.core.http, { indxPatternVldtResp: { dateFields } });
await goToStep(2);
diff --git a/x-pack/legacy/plugins/rollup/__jest__/client_integration/job_create_histogram.test.js b/x-pack/legacy/plugins/rollup/__jest__/client_integration/job_create_histogram.test.js
index f91c4582ba247..c4b5d753f1a26 100644
--- a/x-pack/legacy/plugins/rollup/__jest__/client_integration/job_create_histogram.test.js
+++ b/x-pack/legacy/plugins/rollup/__jest__/client_integration/job_create_histogram.test.js
@@ -4,7 +4,8 @@
* you may not use this file except in compliance with the Elastic License.
*/
-import { setupEnvironment, pageHelpers } from './helpers';
+import { setHttp } from '../../public/crud_app/services';
+import { mockHttpRequest, pageHelpers } from './helpers';
jest.mock('ui/new_platform');
@@ -13,8 +14,6 @@ jest.mock('lodash/function/debounce', () => fn => fn);
const { setup } = pageHelpers.jobCreate;
describe('Create Rollup Job, step 4: Histogram', () => {
- let server;
- let httpRequestsMockHelpers;
let find;
let exists;
let actions;
@@ -22,22 +21,26 @@ describe('Create Rollup Job, step 4: Histogram', () => {
let goToStep;
let table;
let form;
+ let npStart;
beforeAll(() => {
- ({ server, httpRequestsMockHelpers } = setupEnvironment());
- });
-
- afterAll(() => {
- server.restore();
+ npStart = require('ui/new_platform').npStart; // eslint-disable-line
+ setHttp(npStart.core.http);
});
beforeEach(() => {
// Set "default" mock responses by not providing any arguments
- httpRequestsMockHelpers.setIndexPatternValidityResponse();
+ mockHttpRequest(npStart.core.http);
({ find, exists, actions, getEuiStepsHorizontalActive, goToStep, table, form } = setup());
});
+ afterEach(() => {
+ npStart.core.http.get.mockClear();
+ npStart.core.http.post.mockClear();
+ npStart.core.http.put.mockClear();
+ });
+
const numericFields = ['a-numericField', 'b-numericField'];
const goToStepAndOpenFieldChooser = async () => {
@@ -108,7 +111,7 @@ describe('Create Rollup Job, step 4: Histogram', () => {
describe('when no histogram fields are availalbe', () => {
it('should indicate it to the user', async () => {
- httpRequestsMockHelpers.setIndexPatternValidityResponse({ numericFields: [] });
+ mockHttpRequest(npStart.core.http, { indxPatternVldtResp: { numericFields: [] } });
await goToStepAndOpenFieldChooser();
const { tableCellsValues } = table.getMetaData('rollupJobHistogramFieldChooser-table');
@@ -119,7 +122,7 @@ describe('Create Rollup Job, step 4: Histogram', () => {
describe('when histogram fields are available', () => {
beforeEach(async () => {
- httpRequestsMockHelpers.setIndexPatternValidityResponse({ numericFields });
+ mockHttpRequest(npStart.core.http, { indxPatternVldtResp: { numericFields } });
await goToStepAndOpenFieldChooser();
});
@@ -153,7 +156,7 @@ describe('Create Rollup Job, step 4: Histogram', () => {
it('should have a delete button on each row to remove an histogram field', async () => {
// First let's add a term to the list
- httpRequestsMockHelpers.setIndexPatternValidityResponse({ numericFields });
+ mockHttpRequest(npStart.core.http, { indxPatternVldtResp: { numericFields } });
await goToStepAndOpenFieldChooser();
const { rows: fieldChooserRows } = table.getMetaData('rollupJobHistogramFieldChooser-table');
fieldChooserRows[0].reactWrapper.simulate('click');
@@ -180,7 +183,7 @@ describe('Create Rollup Job, step 4: Histogram', () => {
};
beforeEach(async () => {
- httpRequestsMockHelpers.setIndexPatternValidityResponse({ numericFields });
+ mockHttpRequest(npStart.core.http, { indxPatternVldtResp: { numericFields } });
await goToStep(4);
addHistogramFieldToList();
});
diff --git a/x-pack/legacy/plugins/rollup/__jest__/client_integration/job_create_logistics.test.js b/x-pack/legacy/plugins/rollup/__jest__/client_integration/job_create_logistics.test.js
index c960eabb37dcb..98af94437fa5a 100644
--- a/x-pack/legacy/plugins/rollup/__jest__/client_integration/job_create_logistics.test.js
+++ b/x-pack/legacy/plugins/rollup/__jest__/client_integration/job_create_logistics.test.js
@@ -13,7 +13,8 @@ import {
YEAR,
} from '../../../../../../src/plugins/es_ui_shared/public/components/cron_editor';
import { indexPatterns } from '../../../../../../src/plugins/data/public';
-import { setupEnvironment, pageHelpers } from './helpers';
+import { setHttp } from '../../public/crud_app/services';
+import { mockHttpRequest, pageHelpers } from './helpers';
jest.mock('ui/new_platform');
@@ -22,29 +23,31 @@ jest.mock('lodash/function/debounce', () => fn => fn);
const { setup } = pageHelpers.jobCreate;
describe('Create Rollup Job, step 1: Logistics', () => {
- let server;
- let httpRequestsMockHelpers;
let find;
let exists;
let actions;
let form;
let getEuiStepsHorizontalActive;
+ let npStart;
beforeAll(() => {
- ({ server, httpRequestsMockHelpers } = setupEnvironment());
- });
-
- afterAll(() => {
- server.restore();
+ npStart = require('ui/new_platform').npStart; // eslint-disable-line
+ setHttp(npStart.core.http);
});
beforeEach(() => {
// Set "default" mock responses by not providing any arguments
- httpRequestsMockHelpers.setIndexPatternValidityResponse();
+ mockHttpRequest(npStart.core.http);
({ find, exists, actions, form, getEuiStepsHorizontalActive } = setup());
});
+ afterEach(() => {
+ npStart.core.http.get.mockClear();
+ npStart.core.http.post.mockClear();
+ npStart.core.http.put.mockClear();
+ });
+
it('should have the horizontal step active on "Logistics"', () => {
expect(getEuiStepsHorizontalActive()).toContain('Logistics');
});
@@ -94,14 +97,14 @@ describe('Create Rollup Job, step 1: Logistics', () => {
});
it('should not allow an unknown index pattern', async () => {
- httpRequestsMockHelpers.setIndexPatternValidityResponse({ doesMatchIndices: false });
+ mockHttpRequest(npStart.core.http, { indxPatternVldtResp: { doesMatchIndices: false } });
await form.setInputValue('rollupIndexPattern', 'unknown', true);
actions.clickNextStep();
expect(form.getErrorsMessages()).toContain("Index pattern doesn't match any indices.");
});
it('should not allow an index pattern without time fields', async () => {
- httpRequestsMockHelpers.setIndexPatternValidityResponse({ dateFields: [] });
+ mockHttpRequest(npStart.core.http, { indxPatternVldtResp: { dateFields: [] } });
await form.setInputValue('rollupIndexPattern', 'abc', true);
actions.clickNextStep();
expect(form.getErrorsMessages()).toContain(
@@ -110,7 +113,9 @@ describe('Create Rollup Job, step 1: Logistics', () => {
});
it('should not allow an index pattern that matches a rollup index', async () => {
- httpRequestsMockHelpers.setIndexPatternValidityResponse({ doesMatchRollupIndices: true });
+ mockHttpRequest(npStart.core.http, {
+ indxPatternVldtResp: { doesMatchRollupIndices: true },
+ });
await form.setInputValue('rollupIndexPattern', 'abc', true);
actions.clickNextStep();
expect(form.getErrorsMessages()).toContain('Index pattern must not match rollup indices.');
diff --git a/x-pack/legacy/plugins/rollup/__jest__/client_integration/job_create_metrics.test.js b/x-pack/legacy/plugins/rollup/__jest__/client_integration/job_create_metrics.test.js
index bbbd2974c56db..a72dc8b25c083 100644
--- a/x-pack/legacy/plugins/rollup/__jest__/client_integration/job_create_metrics.test.js
+++ b/x-pack/legacy/plugins/rollup/__jest__/client_integration/job_create_metrics.test.js
@@ -4,7 +4,8 @@
* you may not use this file except in compliance with the Elastic License.
*/
-import { setupEnvironment, pageHelpers } from './helpers';
+import { setHttp } from '../../public/crud_app/services';
+import { mockHttpRequest, pageHelpers } from './helpers';
jest.mock('ui/new_platform');
@@ -13,8 +14,6 @@ jest.mock('lodash/function/debounce', () => fn => fn);
const { setup } = pageHelpers.jobCreate;
describe('Create Rollup Job, step 5: Metrics', () => {
- let server;
- let httpRequestsMockHelpers;
let find;
let exists;
let actions;
@@ -22,22 +21,26 @@ describe('Create Rollup Job, step 5: Metrics', () => {
let goToStep;
let table;
let metrics;
+ let npStart;
beforeAll(() => {
- ({ server, httpRequestsMockHelpers } = setupEnvironment());
- });
-
- afterAll(() => {
- server.restore();
+ npStart = require('ui/new_platform').npStart; // eslint-disable-line
+ setHttp(npStart.core.http);
});
beforeEach(() => {
// Set "default" mock responses by not providing any arguments
- httpRequestsMockHelpers.setIndexPatternValidityResponse();
+ mockHttpRequest(npStart.core.http);
({ find, exists, actions, getEuiStepsHorizontalActive, goToStep, table, metrics } = setup());
});
+ afterEach(() => {
+ npStart.core.http.get.mockClear();
+ npStart.core.http.post.mockClear();
+ npStart.core.http.put.mockClear();
+ });
+
const numericFields = ['a-numericField', 'c-numericField'];
const dateFields = ['b-dateField', 'd-dateField'];
@@ -109,7 +112,7 @@ describe('Create Rollup Job, step 5: Metrics', () => {
describe('table', () => {
beforeEach(async () => {
- httpRequestsMockHelpers.setIndexPatternValidityResponse({ numericFields, dateFields });
+ mockHttpRequest(npStart.core.http, { indxPatternVldtResp: { numericFields, dateFields } });
await goToStepAndOpenFieldChooser();
});
@@ -166,7 +169,7 @@ describe('Create Rollup Job, step 5: Metrics', () => {
describe('when fields are added', () => {
beforeEach(async () => {
- httpRequestsMockHelpers.setIndexPatternValidityResponse({ numericFields, dateFields });
+ mockHttpRequest(npStart.core.http, { indxPatternVldtResp: { numericFields, dateFields } });
await goToStepAndOpenFieldChooser();
});
@@ -257,7 +260,8 @@ describe('Create Rollup Job, step 5: Metrics', () => {
let getFieldListTableRows;
beforeEach(async () => {
- httpRequestsMockHelpers.setIndexPatternValidityResponse({ numericFields, dateFields });
+ mockHttpRequest(npStart.core.http, { indxPatternVldtResp: { numericFields, dateFields } });
+
await goToStep(5);
await addFieldToList('numeric');
await addFieldToList('date');
diff --git a/x-pack/legacy/plugins/rollup/__jest__/client_integration/job_create_review.test.js b/x-pack/legacy/plugins/rollup/__jest__/client_integration/job_create_review.test.js
index d7bc5416263fe..0fa9509368d3f 100644
--- a/x-pack/legacy/plugins/rollup/__jest__/client_integration/job_create_review.test.js
+++ b/x-pack/legacy/plugins/rollup/__jest__/client_integration/job_create_review.test.js
@@ -4,8 +4,9 @@
* you may not use this file except in compliance with the Elastic License.
*/
-import { setupEnvironment, pageHelpers } from './helpers';
+import { pageHelpers, mockHttpRequest } from './helpers';
import { first } from 'lodash';
+import { setHttp } from '../../public/crud_app/services';
import { JOBS } from './helpers/constants';
jest.mock('ui/new_platform');
@@ -15,8 +16,6 @@ jest.mock('lodash/function/debounce', () => fn => fn);
const { setup } = pageHelpers.jobCreate;
describe('Create Rollup Job, step 6: Review', () => {
- let server;
- let httpRequestsMockHelpers;
let find;
let exists;
let actions;
@@ -24,21 +23,25 @@ describe('Create Rollup Job, step 6: Review', () => {
let goToStep;
let table;
let form;
+ let npStart;
beforeAll(() => {
- ({ server, httpRequestsMockHelpers } = setupEnvironment());
- });
-
- afterAll(() => {
- server.restore();
+ npStart = require('ui/new_platform').npStart; // eslint-disable-line
+ setHttp(npStart.core.http);
});
beforeEach(() => {
// Set "default" mock responses by not providing any arguments
- httpRequestsMockHelpers.setIndexPatternValidityResponse();
+ mockHttpRequest(npStart.core.http);
({ find, exists, actions, getEuiStepsHorizontalActive, goToStep, table, form } = setup());
});
+ afterEach(() => {
+ npStart.core.http.get.mockClear();
+ npStart.core.http.post.mockClear();
+ npStart.core.http.put.mockClear();
+ });
+
describe('layout', () => {
beforeEach(async () => {
await goToStep(6);
@@ -81,7 +84,7 @@ describe('Create Rollup Job, step 6: Review', () => {
});
it('should have a "Summary", "Terms" & "Request" tab if a term aggregation was added', async () => {
- httpRequestsMockHelpers.setIndexPatternValidityResponse({ numericFields: ['my-field'] });
+ mockHttpRequest(npStart.core.http, { indxPatternVldtResp: { numericFields: ['my-field'] } });
await goToStep(3);
selectFirstField('Terms');
@@ -93,7 +96,7 @@ describe('Create Rollup Job, step 6: Review', () => {
});
it('should have a "Summary", "Histogram" & "Request" tab if a histogram field was added', async () => {
- httpRequestsMockHelpers.setIndexPatternValidityResponse({ numericFields: ['a-field'] });
+ mockHttpRequest(npStart.core.http, { indxPatternVldtResp: { numericFields: ['a-field'] } });
await goToStep(4);
selectFirstField('Histogram');
form.setInputValue('rollupJobCreateHistogramInterval', 3); // set an interval
@@ -105,9 +108,11 @@ describe('Create Rollup Job, step 6: Review', () => {
});
it('should have a "Summary", "Metrics" & "Request" tab if a histogram field was added', async () => {
- httpRequestsMockHelpers.setIndexPatternValidityResponse({
- numericFields: ['a-field'],
- dateFields: ['b-field'],
+ mockHttpRequest(npStart.core.http, {
+ indxPatternVldtResp: {
+ numericFields: ['a-field'],
+ dateFields: ['b-field'],
+ },
});
await goToStep(5);
selectFirstField('Metrics');
@@ -125,27 +130,30 @@ describe('Create Rollup Job, step 6: Review', () => {
describe('without starting job after creation', () => {
it('should call the "create" Api server endpoint', async () => {
- httpRequestsMockHelpers.setCreateJobResponse(first(JOBS.jobs));
+ mockHttpRequest(npStart.core.http, {
+ createdJob: first(JOBS.jobs),
+ });
await goToStep(6);
- expect(server.requests.find(r => r.url === jobCreateApiPath)).toBe(undefined); // make sure it hasn't been called
- expect(server.requests.find(r => r.url === jobStartApiPath)).toBe(undefined); // make sure it hasn't been called
+ expect(npStart.core.http.put).not.toHaveBeenCalledWith(jobCreateApiPath); // make sure it hasn't been called
+ expect(npStart.core.http.get).not.toHaveBeenCalledWith(jobStartApiPath); // make sure it hasn't been called
actions.clickSave();
// Given the following anti-jitter sleep x-pack/legacy/plugins/rollup/public/crud_app/store/actions/create_job.js
// we add a longer sleep here :(
await new Promise(res => setTimeout(res, 750));
- expect(server.requests.find(r => r.url === jobCreateApiPath)).not.toBe(undefined); // It has been called!
- expect(server.requests.find(r => r.url === jobStartApiPath)).toBe(undefined); // It has still not been called!
+ expect(npStart.core.http.put).toHaveBeenCalledWith(jobCreateApiPath, expect.anything()); // It has been called!
+ expect(npStart.core.http.get).not.toHaveBeenCalledWith(jobStartApiPath); // It has still not been called!
});
});
describe('with starting job after creation', () => {
it('should call the "create" and "start" Api server endpoints', async () => {
- httpRequestsMockHelpers.setCreateJobResponse(first(JOBS.jobs));
- httpRequestsMockHelpers.setStartJobResponse();
+ mockHttpRequest(npStart.core.http, {
+ createdJob: first(JOBS.jobs),
+ });
await goToStep(6);
@@ -153,14 +161,14 @@ describe('Create Rollup Job, step 6: Review', () => {
target: { checked: true },
});
- expect(server.requests.find(r => r.url === jobStartApiPath)).toBe(undefined); // make sure it hasn't been called
+ expect(npStart.core.http.post).not.toHaveBeenCalledWith(jobStartApiPath); // make sure it hasn't been called
actions.clickSave();
// Given the following anti-jitter sleep x-pack/legacy/plugins/rollup/public/crud_app/store/actions/create_job.js
// we add a longer sleep here :(
await new Promise(res => setTimeout(res, 750));
- expect(server.requests.find(r => r.url === jobStartApiPath)).not.toBe(undefined); // It has been called!
+ expect(npStart.core.http.post).toHaveBeenCalledWith(jobStartApiPath, expect.anything()); // It has been called!
});
});
});
diff --git a/x-pack/legacy/plugins/rollup/__jest__/client_integration/job_create_terms.test.js b/x-pack/legacy/plugins/rollup/__jest__/client_integration/job_create_terms.test.js
index d3a0aaa08e148..f111a7df2c250 100644
--- a/x-pack/legacy/plugins/rollup/__jest__/client_integration/job_create_terms.test.js
+++ b/x-pack/legacy/plugins/rollup/__jest__/client_integration/job_create_terms.test.js
@@ -4,7 +4,8 @@
* you may not use this file except in compliance with the Elastic License.
*/
-import { setupEnvironment, pageHelpers } from './helpers';
+import { setHttp } from '../../public/crud_app/services';
+import { pageHelpers, mockHttpRequest } from './helpers';
jest.mock('ui/new_platform');
@@ -13,30 +14,30 @@ jest.mock('lodash/function/debounce', () => fn => fn);
const { setup } = pageHelpers.jobCreate;
describe('Create Rollup Job, step 3: Terms', () => {
- let server;
- let httpRequestsMockHelpers;
let find;
let exists;
let actions;
let getEuiStepsHorizontalActive;
let goToStep;
let table;
+ let npStart;
beforeAll(() => {
- ({ server, httpRequestsMockHelpers } = setupEnvironment());
- });
-
- afterAll(() => {
- server.restore();
+ npStart = require('ui/new_platform').npStart; // eslint-disable-line
+ setHttp(npStart.core.http);
});
beforeEach(() => {
// Set "default" mock responses by not providing any arguments
- httpRequestsMockHelpers.setIndexPatternValidityResponse();
+ mockHttpRequest(npStart.core.http);
({ find, exists, actions, getEuiStepsHorizontalActive, goToStep, table } = setup());
});
+ afterEach(() => {
+ npStart.core.http.get.mockClear();
+ });
+
const numericFields = ['a-numericField', 'c-numericField'];
const keywordFields = ['b-keywordField', 'd-keywordField'];
@@ -108,9 +109,11 @@ describe('Create Rollup Job, step 3: Terms', () => {
describe('when no terms are available', () => {
it('should indicate it to the user', async () => {
- httpRequestsMockHelpers.setIndexPatternValidityResponse({
- numericFields: [],
- keywordFields: [],
+ mockHttpRequest(npStart.core.http, {
+ indxPatternVldtResp: {
+ numericFields: [],
+ keywordFields: [],
+ },
});
await goToStepAndOpenFieldChooser();
@@ -122,7 +125,12 @@ describe('Create Rollup Job, step 3: Terms', () => {
describe('when terms are available', () => {
beforeEach(async () => {
- httpRequestsMockHelpers.setIndexPatternValidityResponse({ numericFields, keywordFields });
+ mockHttpRequest(npStart.core.http, {
+ indxPatternVldtResp: {
+ numericFields,
+ keywordFields,
+ },
+ });
await goToStepAndOpenFieldChooser();
});
@@ -163,7 +171,12 @@ describe('Create Rollup Job, step 3: Terms', () => {
it('should have a delete button on each row to remove a term', async () => {
// First let's add a term to the list
- httpRequestsMockHelpers.setIndexPatternValidityResponse({ numericFields, keywordFields });
+ mockHttpRequest(npStart.core.http, {
+ indxPatternVldtResp: {
+ numericFields,
+ keywordFields,
+ },
+ });
await goToStepAndOpenFieldChooser();
const { rows: fieldChooserRows } = table.getMetaData('rollupJobTermsFieldChooser-table');
fieldChooserRows[0].reactWrapper.simulate('click');
diff --git a/x-pack/legacy/plugins/rollup/__jest__/client_integration/job_list.test.js b/x-pack/legacy/plugins/rollup/__jest__/client_integration/job_list.test.js
index 16cb41bc76677..a9e474cf0b559 100644
--- a/x-pack/legacy/plugins/rollup/__jest__/client_integration/job_list.test.js
+++ b/x-pack/legacy/plugins/rollup/__jest__/client_integration/job_list.test.js
@@ -4,8 +4,8 @@
* you may not use this file except in compliance with the Elastic License.
*/
-import { getRouter } from '../../public/crud_app/services';
-import { setupEnvironment, pageHelpers, nextTick } from './helpers';
+import { getRouter, setHttp } from '../../public/crud_app/services';
+import { mockHttpRequest, pageHelpers, nextTick } from './helpers';
import { JOBS } from './helpers/constants';
jest.mock('ui/new_platform');
@@ -22,22 +22,18 @@ const { setup } = pageHelpers.jobList;
describe(' ', () => {
describe('detail panel', () => {
- let server;
- let httpRequestsMockHelpers;
let component;
let table;
let exists;
+ let npStart;
beforeAll(() => {
- ({ server, httpRequestsMockHelpers } = setupEnvironment());
- });
-
- afterAll(() => {
- server.restore();
+ npStart = require('ui/new_platform').npStart; // eslint-disable-line
+ setHttp(npStart.core.http);
});
beforeEach(async () => {
- httpRequestsMockHelpers.setLoadJobsResponse(JOBS);
+ mockHttpRequest(npStart.core.http, { jobs: JOBS });
({ component, exists, table } = setup());
@@ -45,6 +41,10 @@ describe(' ', () => {
component.update();
});
+ afterEach(() => {
+ npStart.core.http.get.mockClear();
+ });
+
test('should open the detail panel when clicking on a job in the table', () => {
const { rows } = table.getMetaData('rollupJobsListTable');
const button = rows[0].columns[1].reactWrapper.find('button');
diff --git a/x-pack/legacy/plugins/rollup/__jest__/client_integration/job_list_clone.test.js b/x-pack/legacy/plugins/rollup/__jest__/client_integration/job_list_clone.test.js
index 6feabe7f772ee..8a36af83def4c 100644
--- a/x-pack/legacy/plugins/rollup/__jest__/client_integration/job_list_clone.test.js
+++ b/x-pack/legacy/plugins/rollup/__jest__/client_integration/job_list_clone.test.js
@@ -4,9 +4,10 @@
* you may not use this file except in compliance with the Elastic License.
*/
-import { setupEnvironment, pageHelpers, nextTick } from './helpers';
+import { mockHttpRequest, pageHelpers, nextTick } from './helpers';
import { JOB_TO_CLONE, JOB_CLONE_INDEX_PATTERN_CHECK } from './helpers/constants';
import { getRouter } from '../../public/crud_app/services/routing';
+import { setHttp } from '../../public/crud_app/services';
import { CRUD_APP_BASE_PATH } from '../../public/crud_app/constants';
jest.mock('ui/new_platform');
@@ -16,24 +17,22 @@ jest.mock('lodash/function/debounce', () => fn => fn);
const { setup } = pageHelpers.jobList;
describe('Smoke test cloning an existing rollup job from job list', () => {
- let server;
- let httpRequestsMockHelpers;
let table;
let find;
let component;
let exists;
+ let npStart;
beforeAll(() => {
- ({ server, httpRequestsMockHelpers } = setupEnvironment());
- });
-
- afterAll(() => {
- server.restore();
+ npStart = require('ui/new_platform').npStart; // eslint-disable-line
+ setHttp(npStart.core.http);
});
beforeEach(async () => {
- httpRequestsMockHelpers.setIndexPatternValidityResponse(JOB_CLONE_INDEX_PATTERN_CHECK);
- httpRequestsMockHelpers.setLoadJobsResponse(JOB_TO_CLONE);
+ mockHttpRequest(npStart.core.http, {
+ jobs: JOB_TO_CLONE,
+ indxPatternVldtResp: JOB_CLONE_INDEX_PATTERN_CHECK,
+ });
({ find, exists, table, component } = setup());
@@ -41,6 +40,10 @@ describe('Smoke test cloning an existing rollup job from job list', () => {
component.update();
});
+ afterEach(() => {
+ npStart.core.http.get.mockClear();
+ });
+
it('should navigate to create view with default values set', async () => {
const router = getRouter();
const { rows } = table.getMetaData('rollupJobsListTable');
diff --git a/x-pack/legacy/plugins/rollup/common/index.js b/x-pack/legacy/plugins/rollup/common/index.ts
similarity index 100%
rename from x-pack/legacy/plugins/rollup/common/index.js
rename to x-pack/legacy/plugins/rollup/common/index.ts
diff --git a/x-pack/legacy/plugins/rollup/common/ui_metric.js b/x-pack/legacy/plugins/rollup/common/ui_metric.ts
similarity index 100%
rename from x-pack/legacy/plugins/rollup/common/ui_metric.js
rename to x-pack/legacy/plugins/rollup/common/ui_metric.ts
diff --git a/x-pack/legacy/plugins/rollup/index.js b/x-pack/legacy/plugins/rollup/index.js
index f4210435abc09..cace3bba1592b 100644
--- a/x-pack/legacy/plugins/rollup/index.js
+++ b/x-pack/legacy/plugins/rollup/index.js
@@ -26,7 +26,7 @@ export function rollup(kibana) {
require: ['kibana', 'elasticsearch', 'xpack_main'],
uiExports: {
styleSheetPaths: resolve(__dirname, 'public/index.scss'),
- managementSections: ['plugins/rollup/crud_app'],
+ managementSections: ['plugins/rollup/legacy'],
uiSettingDefaults: {
[CONFIG_ROLLUPS]: {
name: i18n.translate('xpack.rollupJobs.rollupIndexPatternsTitle', {
@@ -41,13 +41,9 @@ export function rollup(kibana) {
category: ['rollups'],
},
},
- indexManagement: [
- 'plugins/rollup/index_pattern_creation',
- 'plugins/rollup/index_pattern_list',
- 'plugins/rollup/extend_index_management',
- ],
- visualize: ['plugins/rollup/visualize'],
- search: ['plugins/rollup/search'],
+ indexManagement: ['plugins/rollup/legacy'],
+ visualize: ['plugins/rollup/legacy'],
+ search: ['plugins/rollup/legacy'],
},
init: function(server) {
const { usageCollection } = server.newPlatform.setup.plugins;
@@ -64,7 +60,7 @@ export function rollup(kibana) {
server.plugins.index_management.addIndexManagementDataEnricher(rollupDataEnricher);
}
- registerRollupSearchStrategy(this.kbnServer, server);
+ registerRollupSearchStrategy(this.kbnServer);
},
});
}
diff --git a/x-pack/legacy/plugins/rollup/public/application.tsx b/x-pack/legacy/plugins/rollup/public/application.tsx
new file mode 100644
index 0000000000000..df17d37bc3465
--- /dev/null
+++ b/x-pack/legacy/plugins/rollup/public/application.tsx
@@ -0,0 +1,47 @@
+/*
+ * 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 React from 'react';
+import { render, unmountComponentAtNode } from 'react-dom';
+import { Provider } from 'react-redux';
+import { KibanaContextProvider } from '../../../../../src/plugins/kibana_react/public';
+import { ChromeBreadcrumb, CoreSetup } from '../../../../../src/core/public';
+// @ts-ignore
+import { rollupJobsStore } from './crud_app/store';
+// @ts-ignore
+import { App } from './crud_app/app';
+
+/**
+ * This module will be loaded asynchronously to reduce the bundle size of your plugin's main bundle.
+ */
+export const renderApp = async (
+ core: CoreSetup,
+ {
+ element,
+ setBreadcrumbs,
+ }: { element: HTMLElement; setBreadcrumbs: (crumbs: ChromeBreadcrumb[]) => void }
+) => {
+ const [coreStart] = await core.getStartServices();
+ const I18nContext = coreStart.i18n.Context;
+
+ render(
+
+
+
+
+
+
+ ,
+ element
+ );
+ return () => {
+ unmountComponentAtNode(element);
+ };
+};
diff --git a/x-pack/legacy/plugins/rollup/public/crud_app/_crud_app.scss b/x-pack/legacy/plugins/rollup/public/crud_app/_crud_app.scss
index e1166d0942a5c..9e3bd491115ce 100644
--- a/x-pack/legacy/plugins/rollup/public/crud_app/_crud_app.scss
+++ b/x-pack/legacy/plugins/rollup/public/crud_app/_crud_app.scss
@@ -5,10 +5,6 @@
align-items: flex-end; /* 1 */
}
-.rollupJobsRoot {
- display: flex;
-}
-
/**
* 1. Ensure panel fills width of parent when search input yields no matching rollup jobs.
*/
diff --git a/x-pack/legacy/plugins/rollup/public/crud_app/index.js b/x-pack/legacy/plugins/rollup/public/crud_app/index.js
deleted file mode 100644
index 82bbb90d2e33c..0000000000000
--- a/x-pack/legacy/plugins/rollup/public/crud_app/index.js
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- * 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 React from 'react';
-import {
- FeatureCatalogueRegistryProvider,
- FeatureCatalogueCategory,
-} from 'ui/registry/feature_catalogue';
-import { render, unmountComponentAtNode } from 'react-dom';
-import { Provider } from 'react-redux';
-import { i18n } from '@kbn/i18n';
-import { I18nContext } from 'ui/i18n';
-import { management } from 'ui/management';
-import routes from 'ui/routes';
-
-import { CRUD_APP_BASE_PATH } from './constants';
-import { setHttp, setUserHasLeftApp } from './services';
-import { App } from './app';
-import template from './main.html';
-import { rollupJobsStore } from './store';
-
-const esSection = management.getSection('elasticsearch');
-
-esSection.register('rollup_jobs', {
- visible: true,
- display: i18n.translate('xpack.rollupJobs.appTitle', { defaultMessage: 'Rollup Jobs' }),
- order: 3,
- url: `#${CRUD_APP_BASE_PATH}/job_list`,
-});
-
-const renderReact = async elem => {
- render(
-
-
-
-
- ,
- elem
- );
-};
-
-routes.when(`${CRUD_APP_BASE_PATH}/:view?`, {
- template: template,
- controllerAs: 'rollupJobs',
- controller: class IndexRollupJobsController {
- constructor($scope, $route, $injector) {
- // NOTE: We depend upon Angular's $http service because it's decorated with interceptors,
- // e.g. to check license status per request.
- setHttp($injector.get('$http'));
-
- // If returning to the app, we'll need to reset this state.
- setUserHasLeftApp(false);
-
- $scope.$$postDigest(() => {
- const appElement = document.getElementById('rollupJobsReactRoot');
- renderReact(appElement);
-
- const appRoute = $route.current;
- const stopListeningForLocationChange = $scope.$on('$locationChangeSuccess', () => {
- const currentRoute = $route.current;
-
- const isNavigationInApp = currentRoute.$$route.template === appRoute.$$route.template;
-
- // When we navigate within rollups, prevent Angular from re-matching the route and
- // rebuilding the app.
- if (isNavigationInApp) {
- $route.current = appRoute;
- } else {
- // Set internal flag so we can prevent reacting to the route change internally.
- setUserHasLeftApp(true);
- }
- });
-
- $scope.$on('$destroy', () => {
- stopListeningForLocationChange();
- unmountComponentAtNode(appElement);
- });
- });
- }
- },
-});
-
-FeatureCatalogueRegistryProvider.register(() => {
- return {
- id: 'rollup_jobs',
- title: 'Rollups',
- description: i18n.translate('xpack.rollupJobs.featureCatalogueDescription', {
- defaultMessage: 'Summarize and store historical data in a smaller index for future analysis.',
- }),
- icon: 'indexRollupApp',
- path: `#${CRUD_APP_BASE_PATH}/job_list`,
- showOnHomePage: true,
- category: FeatureCatalogueCategory.ADMIN,
- };
-});
diff --git a/x-pack/legacy/plugins/rollup/public/crud_app/main.html b/x-pack/legacy/plugins/rollup/public/crud_app/main.html
deleted file mode 100644
index 2956d157e784c..0000000000000
--- a/x-pack/legacy/plugins/rollup/public/crud_app/main.html
+++ /dev/null
@@ -1,3 +0,0 @@
-
-
-
diff --git a/x-pack/legacy/plugins/rollup/public/crud_app/sections/components/job_action_menu/confirm_delete_modal/confirm_delete_modal.js b/x-pack/legacy/plugins/rollup/public/crud_app/sections/components/job_action_menu/confirm_delete_modal/confirm_delete_modal.js
index 183a3765e1fd9..de1bee29aed4d 100644
--- a/x-pack/legacy/plugins/rollup/public/crud_app/sections/components/job_action_menu/confirm_delete_modal/confirm_delete_modal.js
+++ b/x-pack/legacy/plugins/rollup/public/crud_app/sections/components/job_action_menu/confirm_delete_modal/confirm_delete_modal.js
@@ -6,11 +6,12 @@
import React, { Component, Fragment } from 'react';
import PropTypes from 'prop-types';
-import { injectI18n, FormattedMessage } from '@kbn/i18n/react';
+import { i18n } from '@kbn/i18n';
+import { FormattedMessage } from '@kbn/i18n/react';
import { EuiConfirmModal, EuiOverlayMask } from '@elastic/eui';
-class ConfirmDeleteModalUi extends Component {
+export class ConfirmDeleteModal extends Component {
static propTypes = {
isSingleSelection: PropTypes.bool.isRequired,
jobs: PropTypes.array.isRequired,
@@ -19,12 +20,14 @@ class ConfirmDeleteModalUi extends Component {
};
renderJobs() {
- const { jobs, intl } = this.props;
+ const { jobs } = this.props;
const jobItems = jobs.map(({ id, status }) => {
- const startedMessage = intl.formatMessage({
- id: 'xpack.rollupJobs.jobActionMenu.deleteJob.confirmModal.startedMessage',
- defaultMessage: 'started',
- });
+ const startedMessage = i18n.translate(
+ 'xpack.rollupJobs.jobActionMenu.deleteJob.confirmModal.startedMessage',
+ {
+ defaultMessage: 'started',
+ }
+ );
const statusText = status === 'started' ? ` (${startedMessage})` : null;
return (
@@ -38,19 +41,19 @@ class ConfirmDeleteModalUi extends Component {
}
render() {
- const { isSingleSelection, jobs, onCancel, onConfirm, intl } = this.props;
+ const { isSingleSelection, jobs, onCancel, onConfirm } = this.props;
let title;
let content;
if (isSingleSelection) {
const { id, status } = jobs[0];
- title = intl.formatMessage(
+ title = i18n.translate(
+ 'xpack.rollupJobs.jobActionMenu.deleteJob.confirmModal.deleteSingleJobTitle',
{
- id: 'xpack.rollupJobs.jobActionMenu.deleteJob.confirmModal.deleteSingleJobTitle',
defaultMessage: "Delete rollup job '{id}'?",
- },
- { id }
+ values: { id },
+ }
);
if (status === 'started') {
@@ -64,12 +67,12 @@ class ConfirmDeleteModalUi extends Component {
);
}
} else {
- title = intl.formatMessage(
+ title = i18n.translate(
+ 'xpack.rollupJobs.jobActionMenu.deleteJob.confirmModal.multipleDeletionTitle',
{
- id: 'xpack.rollupJobs.jobActionMenu.deleteJob.confirmModal.multipleDeletionTitle',
defaultMessage: 'Delete {count} rollup jobs?',
- },
- { count: jobs.length }
+ values: { count: jobs.length },
+ }
);
content = (
@@ -92,15 +95,19 @@ class ConfirmDeleteModalUi extends Component {
title={title}
onCancel={onCancel}
onConfirm={onConfirm}
- cancelButtonText={intl.formatMessage({
- id: 'xpack.rollupJobs.jobActionMenu.deleteJob.confirmModal.cancelButtonText',
- defaultMessage: 'Cancel',
- })}
+ cancelButtonText={i18n.translate(
+ 'xpack.rollupJobs.jobActionMenu.deleteJob.confirmModal.cancelButtonText',
+ {
+ defaultMessage: 'Cancel',
+ }
+ )}
buttonColor="danger"
- confirmButtonText={intl.formatMessage({
- id: 'xpack.rollupJobs.jobActionMenu.deleteJob.confirmModal.confirmButtonText',
- defaultMessage: 'Delete',
- })}
+ confirmButtonText={i18n.translate(
+ 'xpack.rollupJobs.jobActionMenu.deleteJob.confirmModal.confirmButtonText',
+ {
+ defaultMessage: 'Delete',
+ }
+ )}
>
{content}
@@ -108,5 +115,3 @@ class ConfirmDeleteModalUi extends Component {
);
}
}
-
-export const ConfirmDeleteModal = injectI18n(ConfirmDeleteModalUi);
diff --git a/x-pack/legacy/plugins/rollup/public/crud_app/sections/job_create/job_create.js b/x-pack/legacy/plugins/rollup/public/crud_app/sections/job_create/job_create.js
index a8e921973efc0..5379778c77e2f 100644
--- a/x-pack/legacy/plugins/rollup/public/crud_app/sections/job_create/job_create.js
+++ b/x-pack/legacy/plugins/rollup/public/crud_app/sections/job_create/job_create.js
@@ -12,9 +12,9 @@ import debounce from 'lodash/function/debounce';
import first from 'lodash/array/first';
import { i18n } from '@kbn/i18n';
-import { injectI18n, FormattedMessage } from '@kbn/i18n/react';
-import chrome from 'ui/chrome';
-import { MANAGEMENT_BREADCRUMB } from 'ui/management';
+import { FormattedMessage } from '@kbn/i18n/react';
+
+import { withKibana } from '../../../../../../../../src/plugins/kibana_react/public/';
import {
EuiCallOut,
@@ -27,8 +27,6 @@ import {
EuiTitle,
} from '@elastic/eui';
-import { fatalError } from 'ui/notify';
-
import {
validateIndexPattern,
formatFields,
@@ -59,6 +57,8 @@ import {
hasErrors,
} from './steps_config';
+import { getFatalErrors } from '../../../kibana_services';
+
const stepIdToTitleMap = {
[STEP_LOGISTICS]: i18n.translate('xpack.rollupJobs.create.steps.stepLogisticsTitle', {
defaultMessage: 'Logistics',
@@ -92,7 +92,7 @@ export class JobCreateUi extends Component {
constructor(props) {
super(props);
- chrome.breadcrumbs.set([MANAGEMENT_BREADCRUMB, listBreadcrumb, createBreadcrumb]);
+ props.kibana.services.setBreadcrumbs([listBreadcrumb, createBreadcrumb]);
const { jobToClone: stepDefaultOverrides } = props;
const stepsFields = mapValues(stepIdToStepConfigMap, step =>
cloneDeep(step.getDefaultFields(stepDefaultOverrides))
@@ -181,7 +181,7 @@ export class JobCreateUi extends Component {
dateFields: indexPatternDateFields,
numericFields,
keywordFields,
- } = response.data;
+ } = response;
let indexPatternAsyncErrors;
@@ -298,9 +298,9 @@ export class JobCreateUi extends Component {
return;
}
- // Expect an error in the shape provided by Angular's $http service.
- if (error && error.data) {
- const { error: errorString, statusCode } = error.data;
+ // Expect an error in the shape provided by http service.
+ if (error && error.body) {
+ const { error: errorString, statusCode } = error.body;
const indexPatternAsyncErrors = [
({
text: name,
}));
-export class StepDateHistogramUi extends Component {
+export class StepDateHistogram extends Component {
static propTypes = {
fields: PropTypes.object.isRequired,
onFieldsChange: PropTypes.func.isRequired,
@@ -192,7 +192,7 @@ export class StepDateHistogramUi extends Component {
+
;
};
}
-
-export const StepDateHistogram = injectI18n(StepDateHistogramUi);
diff --git a/x-pack/legacy/plugins/rollup/public/crud_app/sections/job_create/steps/step_histogram.js b/x-pack/legacy/plugins/rollup/public/crud_app/sections/job_create/steps/step_histogram.js
index 4c4019b3161a9..9307c9074e663 100644
--- a/x-pack/legacy/plugins/rollup/public/crud_app/sections/job_create/steps/step_histogram.js
+++ b/x-pack/legacy/plugins/rollup/public/crud_app/sections/job_create/steps/step_histogram.js
@@ -6,7 +6,7 @@
import React, { Component, Fragment } from 'react';
import PropTypes from 'prop-types';
-import { injectI18n, FormattedMessage } from '@kbn/i18n/react';
+import { FormattedMessage } from '@kbn/i18n/react';
import {
EuiButtonEmpty,
@@ -20,13 +20,13 @@ import {
EuiTitle,
} from '@elastic/eui';
-import { histogramDetailsUrl } from '../../../services';
+import { getHistogramDetailsUrl } from '../../../services';
import { FieldList } from '../../components';
import { FieldChooser, StepError } from './components';
-export class StepHistogramUi extends Component {
+export class StepHistogram extends Component {
static propTypes = {
fields: PropTypes.object.isRequired,
onFieldsChange: PropTypes.func.isRequired,
@@ -96,7 +96,7 @@ export class StepHistogramUi extends Component {
;
};
}
-
-export const StepHistogram = injectI18n(StepHistogramUi);
diff --git a/x-pack/legacy/plugins/rollup/public/crud_app/sections/job_create/steps/step_logistics.js b/x-pack/legacy/plugins/rollup/public/crud_app/sections/job_create/steps/step_logistics.js
index 8cba18804b1c6..024001d463240 100644
--- a/x-pack/legacy/plugins/rollup/public/crud_app/sections/job_create/steps/step_logistics.js
+++ b/x-pack/legacy/plugins/rollup/public/crud_app/sections/job_create/steps/step_logistics.js
@@ -6,7 +6,7 @@
import React, { Component, Fragment } from 'react';
import PropTypes from 'prop-types';
-import { injectI18n, FormattedMessage } from '@kbn/i18n/react';
+import { FormattedMessage } from '@kbn/i18n/react';
import {
EuiButtonEmpty,
@@ -26,8 +26,8 @@ import {
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
import { CronEditor } from '../../../../../../../../../src/plugins/es_ui_shared/public/components/cron_editor';
-import { INDEX_ILLEGAL_CHARACTERS_VISIBLE } from 'ui/indices';
-import { logisticalDetailsUrl, cronUrl } from '../../../services';
+import { INDEX_ILLEGAL_CHARACTERS_VISIBLE } from '../../../../legacy_imports';
+import { getLogisticalDetailsUrl, getCronUrl } from '../../../services';
import { StepError } from './components';
import { indexPatterns } from '../../../../../../../../../src/plugins/data/public';
@@ -35,7 +35,7 @@ import { indexPatterns } from '../../../../../../../../../src/plugins/data/publi
const indexPatternIllegalCharacters = indexPatterns.ILLEGAL_CHARACTERS_VISIBLE.join(' ');
const indexIllegalCharacters = INDEX_ILLEGAL_CHARACTERS_VISIBLE.join(' ');
-export class StepLogisticsUi extends Component {
+export class StepLogistics extends Component {
static propTypes = {
fields: PropTypes.object.isRequired,
onFieldsChange: PropTypes.func.isRequired,
@@ -146,7 +146,7 @@ export class StepLogisticsUi extends Component {
isInvalid={Boolean(areStepErrorsVisible && errorRollupCron)}
helpText={
-
+
;
};
}
-
-export const StepLogistics = injectI18n(StepLogisticsUi);
diff --git a/x-pack/legacy/plugins/rollup/public/crud_app/sections/job_create/steps/step_metrics.js b/x-pack/legacy/plugins/rollup/public/crud_app/sections/job_create/steps/step_metrics.js
index 5022754ec5faa..b71b6bfc805bf 100644
--- a/x-pack/legacy/plugins/rollup/public/crud_app/sections/job_create/steps/step_metrics.js
+++ b/x-pack/legacy/plugins/rollup/public/crud_app/sections/job_create/steps/step_metrics.js
@@ -6,7 +6,7 @@
import React, { Component, Fragment } from 'react';
import PropTypes from 'prop-types';
-import { injectI18n, FormattedMessage } from '@kbn/i18n/react';
+import { FormattedMessage } from '@kbn/i18n/react';
import { i18n } from '@kbn/i18n';
import get from 'lodash/object/get';
@@ -22,7 +22,7 @@ import {
EuiButton,
} from '@elastic/eui';
-import { metricsDetailsUrl } from '../../../services';
+import { getMetricsDetailsUrl } from '../../../services';
import { FieldList } from '../../components';
import { FieldChooser, StepError } from './components';
import { METRICS_CONFIG } from '../../../constants';
@@ -64,7 +64,7 @@ const metricTypesConfig = (function() {
});
})();
-export class StepMetricsUi extends Component {
+export class StepMetrics extends Component {
static propTypes = {
fields: PropTypes.object.isRequired,
onFieldsChange: PropTypes.func.isRequired,
@@ -247,7 +247,7 @@ export class StepMetricsUi extends Component {
}
getListColumns() {
- return StepMetricsUi.chooserColumns.concat({
+ return StepMetrics.chooserColumns.concat({
type: 'metrics',
name: i18n.translate('xpack.rollupJobs.create.stepMetrics.metricsColumnHeader', {
defaultMessage: 'Metrics',
@@ -384,7 +384,7 @@ export class StepMetricsUi extends Component {
}
- columns={StepMetricsUi.chooserColumns}
+ columns={StepMetrics.chooserColumns}
fields={metricsFields}
selectedFields={metrics}
onSelectField={this.onSelectField}
@@ -472,5 +472,3 @@ export class StepMetricsUi extends Component {
},
];
}
-
-export const StepMetrics = injectI18n(StepMetricsUi);
diff --git a/x-pack/legacy/plugins/rollup/public/crud_app/sections/job_create/steps/step_review.js b/x-pack/legacy/plugins/rollup/public/crud_app/sections/job_create/steps/step_review.js
index 19937732275a2..0097792db3105 100644
--- a/x-pack/legacy/plugins/rollup/public/crud_app/sections/job_create/steps/step_review.js
+++ b/x-pack/legacy/plugins/rollup/public/crud_app/sections/job_create/steps/step_review.js
@@ -6,7 +6,7 @@
import React, { Component, Fragment } from 'react';
import PropTypes from 'prop-types';
-import { injectI18n, FormattedMessage } from '@kbn/i18n/react';
+import { FormattedMessage } from '@kbn/i18n/react';
import { EuiErrorBoundary, EuiSpacer, EuiTab, EuiTabs, EuiTitle } from '@elastic/eui';
@@ -30,7 +30,7 @@ const JOB_DETAILS_TABS = [
JOB_DETAILS_TAB_REQUEST,
];
-export class StepReviewUi extends Component {
+export class StepReview extends Component {
static propTypes = {
job: PropTypes.object.isRequired,
};
@@ -121,5 +121,3 @@ export class StepReviewUi extends Component {
);
}
}
-
-export const StepReview = injectI18n(StepReviewUi);
diff --git a/x-pack/legacy/plugins/rollup/public/crud_app/sections/job_create/steps/step_terms.js b/x-pack/legacy/plugins/rollup/public/crud_app/sections/job_create/steps/step_terms.js
index cd3c6cc5127f1..48e045e19f478 100644
--- a/x-pack/legacy/plugins/rollup/public/crud_app/sections/job_create/steps/step_terms.js
+++ b/x-pack/legacy/plugins/rollup/public/crud_app/sections/job_create/steps/step_terms.js
@@ -6,7 +6,7 @@
import React, { Component, Fragment } from 'react';
import PropTypes from 'prop-types';
-import { injectI18n, FormattedMessage } from '@kbn/i18n/react';
+import { FormattedMessage } from '@kbn/i18n/react';
import {
EuiButtonEmpty,
@@ -17,13 +17,13 @@ import {
EuiTitle,
} from '@elastic/eui';
-import { termsDetailsUrl } from '../../../services';
+import { getTermsDetailsUrl } from '../../../services';
import { FieldList } from '../../components';
import { FieldChooser } from './components';
-export class StepTermsUi extends Component {
+export class StepTerms extends Component {
static propTypes = {
fields: PropTypes.object.isRequired,
onFieldsChange: PropTypes.func.isRequired,
@@ -99,7 +99,7 @@ export class StepTermsUi extends Component {
@@ -251,5 +251,3 @@ export class DetailPanelUi extends Component {
);
}
}
-
-export const DetailPanel = injectI18n(DetailPanelUi);
diff --git a/x-pack/legacy/plugins/rollup/public/crud_app/sections/job_list/detail_panel/detail_panel.test.js b/x-pack/legacy/plugins/rollup/public/crud_app/sections/job_list/detail_panel/detail_panel.test.js
index 39153cda1f99d..9ac8e6075e4cf 100644
--- a/x-pack/legacy/plugins/rollup/public/crud_app/sections/job_list/detail_panel/detail_panel.test.js
+++ b/x-pack/legacy/plugins/rollup/public/crud_app/sections/job_list/detail_panel/detail_panel.test.js
@@ -58,12 +58,12 @@ describe(' ', () => {
});
it("should have children if it's open", () => {
- expect(component.find('DetailPanelUi').children().length).toBeTruthy();
+ expect(component.find('DetailPanel').children().length).toBeTruthy();
});
it('should *not* have children if its closed', () => {
({ component } = initTestBed({ isOpen: false }));
- expect(component.find('DetailPanelUi').children().length).toBeFalsy();
+ expect(component.find('DetailPanel').children().length).toBeFalsy();
});
it('should show a loading when the job is loading', () => {
diff --git a/x-pack/legacy/plugins/rollup/public/crud_app/sections/job_list/job_list.js b/x-pack/legacy/plugins/rollup/public/crud_app/sections/job_list/job_list.js
index 035a53206c71d..98329a687217a 100644
--- a/x-pack/legacy/plugins/rollup/public/crud_app/sections/job_list/job_list.js
+++ b/x-pack/legacy/plugins/rollup/public/crud_app/sections/job_list/job_list.js
@@ -6,9 +6,8 @@
import React, { Component, Fragment } from 'react';
import PropTypes from 'prop-types';
-import { injectI18n, FormattedMessage } from '@kbn/i18n/react';
-import chrome from 'ui/chrome';
-import { MANAGEMENT_BREADCRUMB } from 'ui/management';
+import { FormattedMessage } from '@kbn/i18n/react';
+import { i18n } from '@kbn/i18n';
import {
EuiButton,
@@ -26,6 +25,8 @@ import {
EuiCallOut,
} from '@elastic/eui';
+import { withKibana } from '../../../../../../../../src/plugins/kibana_react/public/';
+
import { CRUD_APP_BASE_PATH } from '../../constants';
import { getRouterLinkProps, extractQueryParams, listBreadcrumb } from '../../services';
@@ -67,7 +68,7 @@ export class JobListUi extends Component {
props.loadJobs();
- chrome.breadcrumbs.set([MANAGEMENT_BREADCRUMB, listBreadcrumb]);
+ props.kibana.services.setBreadcrumbs([listBreadcrumb]);
this.state = {};
}
@@ -97,9 +98,7 @@ export class JobListUi extends Component {
}
renderNoPermission() {
- const { intl } = this.props;
- const title = intl.formatMessage({
- id: 'xpack.rollupJobs.jobList.noPermissionTitle',
+ const title = i18n.translate('xpack.rollupJobs.jobList.noPermissionTitle', {
defaultMessage: 'Permission error',
});
return (
@@ -122,13 +121,11 @@ export class JobListUi extends Component {
}
renderError(error) {
- // We can safely depend upon the shape of this error coming from Angular $http, because we
+ // We can safely depend upon the shape of this error coming from http service, because we
// handle unexpected error shapes in the API action.
- const { statusCode, error: errorString } = error.data;
+ const { statusCode, error: errorString } = error.body;
- const { intl } = this.props;
- const title = intl.formatMessage({
- id: 'xpack.rollupJobs.jobList.loadingErrorTitle',
+ const title = i18n.translate('xpack.rollupJobs.jobList.loadingErrorTitle', {
defaultMessage: 'Error loading rollup jobs',
});
return (
@@ -254,4 +251,4 @@ export class JobListUi extends Component {
}
}
-export const JobList = injectI18n(JobListUi);
+export const JobList = withKibana(JobListUi);
diff --git a/x-pack/legacy/plugins/rollup/public/crud_app/sections/job_list/job_list.test.js b/x-pack/legacy/plugins/rollup/public/crud_app/sections/job_list/job_list.test.js
index 5c7d53efbd62c..725789fc584de 100644
--- a/x-pack/legacy/plugins/rollup/public/crud_app/sections/job_list/job_list.test.js
+++ b/x-pack/legacy/plugins/rollup/public/crud_app/sections/job_list/job_list.test.js
@@ -4,24 +4,16 @@
* you may not use this file except in compliance with the Elastic License.
*/
+import React from 'react';
import { registerTestBed } from '../../../../../../../test_utils';
import { rollupJobsStore } from '../../store';
import { JobList } from './job_list';
+import { KibanaContextProvider } from '../../../../../../../../src/plugins/kibana_react/public';
+import { coreMock } from '../../../../../../../../src/core/public/mocks';
+const startMock = coreMock.createStart();
+
jest.mock('ui/new_platform');
-jest.mock('ui/chrome', () => ({
- addBasePath: () => {},
- breadcrumbs: { set: () => {} },
- getInjected: key => {
- if (key === 'uiCapabilities') {
- return {
- navLinks: {},
- management: {},
- catalogue: {},
- };
- }
- },
-}));
jest.mock('../../services', () => {
const services = require.requireActual('../../services');
@@ -40,7 +32,16 @@ const defaultProps = {
isLoading: false,
};
-const initTestBed = registerTestBed(JobList, { defaultProps, store: rollupJobsStore });
+const services = {
+ setBreadcrumbs: startMock.chrome.setBreadcrumbs,
+};
+const Component = props => (
+
+
+
+);
+
+const initTestBed = registerTestBed(Component, { defaultProps, store: rollupJobsStore });
describe(' ', () => {
it('should render empty prompt when loading is complete and there are no jobs', () => {
@@ -53,21 +54,21 @@ describe(' ', () => {
const { component, exists } = initTestBed({ isLoading: true });
expect(exists('jobListLoading')).toBeTruthy();
- expect(component.find('JobTableUi').length).toBeFalsy();
+ expect(component.find('JobTable').length).toBeFalsy();
});
it('should display the when there are jobs', () => {
const { component, exists } = initTestBed({ hasJobs: true });
expect(exists('jobListLoading')).toBeFalsy();
- expect(component.find('JobTableUi').length).toBeTruthy();
+ expect(component.find('JobTable').length).toBeTruthy();
});
describe('when there is an API error', () => {
const { exists, find } = initTestBed({
jobLoadError: {
status: 400,
- data: { statusCode: 400, error: 'Houston we got a problem.' },
+ body: { statusCode: 400, error: 'Houston we got a problem.' },
},
});
diff --git a/x-pack/legacy/plugins/rollup/public/crud_app/sections/job_list/job_table/job_table.js b/x-pack/legacy/plugins/rollup/public/crud_app/sections/job_list/job_table/job_table.js
index 42d48702a3385..4dbe396ab8410 100644
--- a/x-pack/legacy/plugins/rollup/public/crud_app/sections/job_list/job_table/job_table.js
+++ b/x-pack/legacy/plugins/rollup/public/crud_app/sections/job_list/job_table/job_table.js
@@ -7,7 +7,7 @@
import React, { Component, Fragment } from 'react';
import PropTypes from 'prop-types';
import { i18n } from '@kbn/i18n';
-import { injectI18n, FormattedMessage } from '@kbn/i18n/react';
+import { FormattedMessage } from '@kbn/i18n/react';
import {
EuiCheckbox,
@@ -120,7 +120,7 @@ const COLUMNS = [
},
];
-export class JobTableUi extends Component {
+export class JobTable extends Component {
static propTypes = {
jobs: PropTypes.array,
pager: PropTypes.object.isRequired,
@@ -333,7 +333,7 @@ export class JobTableUi extends Component {
}
render() {
- const { filterChanged, filter, jobs, intl, closeDetailPanel } = this.props;
+ const { filterChanged, filter, jobs, closeDetailPanel } = this.props;
const { idToSelectedJobMap } = this.state;
@@ -360,8 +360,7 @@ export class JobTableUi extends Component {
filterChanged(event.target.value);
}}
data-test-subj="jobTableFilterInput"
- placeholder={intl.formatMessage({
- id: 'xpack.rollupJobs.jobTable.searchInputPlaceholder',
+ placeholder={i18n.translate('xpack.rollupJobs.jobTable.searchInputPlaceholder', {
defaultMessage: 'Search',
})}
aria-label="Search jobs"
@@ -405,5 +404,3 @@ export class JobTableUi extends Component {
);
}
}
-
-export const JobTable = injectI18n(JobTableUi);
diff --git a/x-pack/legacy/plugins/rollup/public/crud_app/services/api.js b/x-pack/legacy/plugins/rollup/public/crud_app/services/api.js
index e712415f9568d..8f95561b72d1d 100644
--- a/x-pack/legacy/plugins/rollup/public/crud_app/services/api.js
+++ b/x-pack/legacy/plugins/rollup/public/crud_app/services/api.js
@@ -4,7 +4,6 @@
* you may not use this file except in compliance with the Elastic License.
*/
-import chrome from 'ui/chrome';
import {
UIM_JOB_CREATE,
UIM_JOB_DELETE,
@@ -17,39 +16,45 @@ import {
import { getHttp } from './http_provider';
import { trackUserRequest } from './track_ui_metric';
-const apiPrefix = chrome.addBasePath('/api/rollup');
+const apiPrefix = '/api/rollup';
export async function loadJobs() {
- const {
- data: { jobs },
- } = await getHttp().get(`${apiPrefix}/jobs`);
+ const { jobs } = await getHttp().get(`${apiPrefix}/jobs`);
return jobs;
}
export async function startJobs(jobIds) {
const body = { jobIds };
- const request = getHttp().post(`${apiPrefix}/start`, body);
+ const request = getHttp().post(`${apiPrefix}/start`, {
+ body: JSON.stringify(body),
+ });
const actionType = jobIds.length > 1 ? UIM_JOB_START_MANY : UIM_JOB_START;
return await trackUserRequest(request, actionType);
}
export async function stopJobs(jobIds) {
const body = { jobIds };
- const request = getHttp().post(`${apiPrefix}/stop`, body);
+ const request = getHttp().post(`${apiPrefix}/stop`, {
+ body: JSON.stringify(body),
+ });
const actionType = jobIds.length > 1 ? UIM_JOB_STOP_MANY : UIM_JOB_STOP;
return await trackUserRequest(request, actionType);
}
export async function deleteJobs(jobIds) {
const body = { jobIds };
- const request = getHttp().post(`${apiPrefix}/delete`, body);
+ const request = getHttp().post(`${apiPrefix}/delete`, {
+ body: JSON.stringify(body),
+ });
const actionType = jobIds.length > 1 ? UIM_JOB_DELETE_MANY : UIM_JOB_DELETE;
return await trackUserRequest(request, actionType);
}
export async function createJob(job) {
const body = { job };
- const request = getHttp().put(`${apiPrefix}/create`, body);
+ const request = getHttp().put(`${apiPrefix}/create`, {
+ body: JSON.stringify(body),
+ });
return await trackUserRequest(request, UIM_JOB_CREATE);
}
diff --git a/x-pack/legacy/plugins/rollup/public/crud_app/services/api_errors.js b/x-pack/legacy/plugins/rollup/public/crud_app/services/api_errors.ts
similarity index 54%
rename from x-pack/legacy/plugins/rollup/public/crud_app/services/api_errors.js
rename to x-pack/legacy/plugins/rollup/public/crud_app/services/api_errors.ts
index bacaf13405898..af9e1a16e4cc5 100644
--- a/x-pack/legacy/plugins/rollup/public/crud_app/services/api_errors.js
+++ b/x-pack/legacy/plugins/rollup/public/crud_app/services/api_errors.ts
@@ -4,12 +4,12 @@
* you may not use this file except in compliance with the Elastic License.
*/
-import { fatalError, toastNotifications } from 'ui/notify';
+import { getNotifications, getFatalErrors } from '../../kibana_services';
-function createToastConfig(error, errorTitle) {
- // Expect an error in the shape provided by Angular's $http service.
- if (error && error.data) {
- const { error: errorString, statusCode, message } = error.data;
+function createToastConfig(error: any, errorTitle: string) {
+ // Expect an error in the shape provided by http service.
+ if (error && error.body) {
+ const { error: errorString, statusCode, message } = error.body;
return {
title: errorTitle,
text: `${statusCode}: ${errorString}. ${message}`,
@@ -17,26 +17,26 @@ function createToastConfig(error, errorTitle) {
}
}
-export function showApiWarning(error, errorTitle) {
+export function showApiWarning(error: any, errorTitle: string) {
const toastConfig = createToastConfig(error, errorTitle);
if (toastConfig) {
- return toastNotifications.addWarning(toastConfig);
+ return getNotifications().toasts.addWarning(toastConfig);
}
// This error isn't an HTTP error, so let the fatal error screen tell the user something
// unexpected happened.
- return fatalError(error, errorTitle);
+ return getFatalErrors().add(error, errorTitle);
}
-export function showApiError(error, errorTitle) {
+export function showApiError(error: any, errorTitle: string) {
const toastConfig = createToastConfig(error, errorTitle);
if (toastConfig) {
- return toastNotifications.addDanger(toastConfig);
+ return getNotifications().toasts.addDanger(toastConfig);
}
// This error isn't an HTTP error, so let the fatal error screen tell the user something
// unexpected happened.
- fatalError(error, errorTitle);
+ getFatalErrors().add(error, errorTitle);
}
diff --git a/x-pack/legacy/plugins/rollup/public/crud_app/services/documentation_links.js b/x-pack/legacy/plugins/rollup/public/crud_app/services/documentation_links.js
index 7616d8bc179c0..ce42b26cc3e86 100644
--- a/x-pack/legacy/plugins/rollup/public/crud_app/services/documentation_links.js
+++ b/x-pack/legacy/plugins/rollup/public/crud_app/services/documentation_links.js
@@ -4,16 +4,21 @@
* you may not use this file except in compliance with the Elastic License.
*/
-import { ELASTIC_WEBSITE_URL, DOC_LINK_VERSION } from 'ui/documentation_links';
+let esBase = '';
+let xPackBase = '';
-const esBase = `${ELASTIC_WEBSITE_URL}guide/en/elasticsearch/reference/${DOC_LINK_VERSION}`;
-const xPackBase = `${ELASTIC_WEBSITE_URL}guide/en/x-pack/${DOC_LINK_VERSION}`;
+export function setEsBaseAndXPackBase(elasticWebsiteUrl, docLinksVersion) {
+ esBase = `${elasticWebsiteUrl}guide/en/elasticsearch/reference/${docLinksVersion}`;
+ xPackBase = `${elasticWebsiteUrl}guide/en/x-pack/${docLinksVersion}`;
+}
-export const logisticalDetailsUrl = `${esBase}/rollup-job-config.html#_logistical_details`;
-export const dateHistogramDetailsUrl = `${esBase}/rollup-job-config.html#_date_histogram_2`;
-export const termsDetailsUrl = `${esBase}/rollup-job-config.html#_terms_2`;
-export const histogramDetailsUrl = `${esBase}/rollup-job-config.html#_histogram_2`;
-export const metricsDetailsUrl = `${esBase}/rollup-job-config.html#rollup-metrics-config`;
+export const getLogisticalDetailsUrl = () => `${esBase}/rollup-job-config.html#_logistical_details`;
+export const getDateHistogramDetailsUrl = () =>
+ `${esBase}/rollup-job-config.html#_date_histogram_2`;
+export const getTermsDetailsUrl = () => `${esBase}/rollup-job-config.html#_terms_2`;
+export const getHistogramDetailsUrl = () => `${esBase}/rollup-job-config.html#_histogram_2`;
+export const getMetricsDetailsUrl = () => `${esBase}/rollup-job-config.html#rollup-metrics-config`;
-export const dateHistogramAggregationUrl = `${esBase}/search-aggregations-bucket-datehistogram-aggregation.html`;
-export const cronUrl = `${xPackBase}/trigger-schedule.html#_cron_expressions`;
+export const getDateHistogramAggregationUrl = () =>
+ `${esBase}/search-aggregations-bucket-datehistogram-aggregation.html`;
+export const getCronUrl = () => `${xPackBase}/trigger-schedule.html#_cron_expressions`;
diff --git a/x-pack/legacy/plugins/rollup/public/crud_app/services/http_provider.js b/x-pack/legacy/plugins/rollup/public/crud_app/services/http_provider.ts
similarity index 61%
rename from x-pack/legacy/plugins/rollup/public/crud_app/services/http_provider.js
rename to x-pack/legacy/plugins/rollup/public/crud_app/services/http_provider.ts
index 835a7bdc09d86..dd84328084d05 100644
--- a/x-pack/legacy/plugins/rollup/public/crud_app/services/http_provider.js
+++ b/x-pack/legacy/plugins/rollup/public/crud_app/services/http_provider.ts
@@ -4,14 +4,17 @@
* you may not use this file except in compliance with the Elastic License.
*/
-// This is an Angular service, which is why we use this provider pattern to access it within
-// our React app.
-let _http;
+import { HttpStart } from 'src/core/public';
-export function setHttp(http) {
+let _http: HttpStart | null = null;
+
+export function setHttp(http: HttpStart) {
_http = http;
}
export function getHttp() {
+ if (!_http) {
+ throw new Error('Rollup http is not defined');
+ }
return _http;
}
diff --git a/x-pack/legacy/plugins/rollup/public/crud_app/services/index.js b/x-pack/legacy/plugins/rollup/public/crud_app/services/index.js
index 74ed8d8c325c0..790770b9b6a9f 100644
--- a/x-pack/legacy/plugins/rollup/public/crud_app/services/index.js
+++ b/x-pack/legacy/plugins/rollup/public/crud_app/services/index.js
@@ -11,13 +11,14 @@ export { showApiError, showApiWarning } from './api_errors';
export { listBreadcrumb, createBreadcrumb } from './breadcrumbs';
export {
- logisticalDetailsUrl,
- dateHistogramDetailsUrl,
- dateHistogramAggregationUrl,
- termsDetailsUrl,
- histogramDetailsUrl,
- metricsDetailsUrl,
- cronUrl,
+ setEsBaseAndXPackBase,
+ getLogisticalDetailsUrl,
+ getDateHistogramDetailsUrl,
+ getDateHistogramAggregationUrl,
+ getTermsDetailsUrl,
+ getHistogramDetailsUrl,
+ getMetricsDetailsUrl,
+ getCronUrl,
} from './documentation_links';
export { filterItems } from './filter_items';
diff --git a/x-pack/legacy/plugins/rollup/public/crud_app/store/actions/create_job.js b/x-pack/legacy/plugins/rollup/public/crud_app/store/actions/create_job.js
index 163860b7f24c6..c85b4c55f665e 100644
--- a/x-pack/legacy/plugins/rollup/public/crud_app/store/actions/create_job.js
+++ b/x-pack/legacy/plugins/rollup/public/crud_app/store/actions/create_job.js
@@ -5,7 +5,6 @@
*/
import { i18n } from '@kbn/i18n';
-import { fatalError } from 'ui/notify';
import { CRUD_APP_BASE_PATH } from '../../constants';
import {
@@ -24,6 +23,8 @@ import {
CLEAR_CREATE_JOB_ERRORS,
} from '../action_types';
+import { getFatalErrors } from '../../../kibana_services';
+
export const createJob = jobConfig => async dispatch => {
dispatch({
type: CREATE_JOB_START,
@@ -39,12 +40,13 @@ export const createJob = jobConfig => async dispatch => {
]);
} catch (error) {
if (error) {
- const { statusCode, data } = error;
+ const { body } = error;
+ const statusCode = error.statusCode || (body && body.statusCode);
- // Expect an error in the shape provided by Angular's $http service.
- if (data) {
+ // Expect an error in the shape provided by http service.
+ if (body) {
// Some errors have statusCode directly available but some are under a data property.
- if ((statusCode || (data && data.statusCode)) === 409) {
+ if (statusCode === 409) {
return dispatch({
type: CREATE_JOB_FAILURE,
payload: {
@@ -67,9 +69,9 @@ export const createJob = jobConfig => async dispatch => {
error: {
message: i18n.translate('xpack.rollupJobs.createAction.failedDefaultErrorMessage', {
defaultMessage: 'Request failed with a {statusCode} error. {message}',
- values: { statusCode, message: data.message },
+ values: { statusCode, message: body.message },
}),
- cause: data.cause,
+ cause: body.cause,
},
},
});
@@ -78,7 +80,7 @@ export const createJob = jobConfig => async dispatch => {
// This error isn't an HTTP error, so let the fatal error screen tell the user something
// unexpected happened.
- return fatalError(
+ return getFatalErrors().add(
error,
i18n.translate('xpack.rollupJobs.createAction.errorTitle', {
defaultMessage: 'Error creating rollup job',
@@ -86,7 +88,7 @@ export const createJob = jobConfig => async dispatch => {
);
}
- const deserializedJob = deserializeJob(newJob.data);
+ const deserializedJob = deserializeJob(newJob);
dispatch({
type: CREATE_JOB_SUCCESS,
diff --git a/x-pack/legacy/plugins/rollup/public/crud_app/store/actions/delete_jobs.js b/x-pack/legacy/plugins/rollup/public/crud_app/store/actions/delete_jobs.js
index d700ec69839be..0cfc8c24d46e9 100644
--- a/x-pack/legacy/plugins/rollup/public/crud_app/store/actions/delete_jobs.js
+++ b/x-pack/legacy/plugins/rollup/public/crud_app/store/actions/delete_jobs.js
@@ -5,7 +5,6 @@
*/
import { i18n } from '@kbn/i18n';
-import { toastNotifications } from 'ui/notify';
import {
deleteJobs as sendDeleteJobsRequest,
@@ -19,6 +18,8 @@ import { UPDATE_JOB_START, UPDATE_JOB_SUCCESS, UPDATE_JOB_FAILURE } from '../act
import { refreshJobs } from './refresh_jobs';
import { closeDetailPanel } from './detail_panel';
+import { getNotifications } from '../../../kibana_services';
+
export const deleteJobs = jobIds => async (dispatch, getState) => {
dispatch({
type: UPDATE_JOB_START,
@@ -40,14 +41,14 @@ export const deleteJobs = jobIds => async (dispatch, getState) => {
}
if (jobIds.length === 1) {
- toastNotifications.addSuccess(
+ getNotifications().toasts.addSuccess(
i18n.translate('xpack.rollupJobs.deleteAction.successSingleNotificationTitle', {
defaultMessage: `Rollup job '{jobId}' was deleted`,
values: { jobId: jobIds[0] },
})
);
} else {
- toastNotifications.addSuccess(
+ getNotifications().toasts.addSuccess(
i18n.translate('xpack.rollupJobs.deleteAction.successMultipleNotificationTitle', {
defaultMessage: '{count} rollup jobs were deleted',
values: { count: jobIds.length },
diff --git a/x-pack/legacy/plugins/rollup/public/extend_index_management/index.js b/x-pack/legacy/plugins/rollup/public/extend_index_management/index.ts
similarity index 76%
rename from x-pack/legacy/plugins/rollup/public/extend_index_management/index.js
rename to x-pack/legacy/plugins/rollup/public/extend_index_management/index.ts
index 5e14d3eabc9a6..1a34811901bbe 100644
--- a/x-pack/legacy/plugins/rollup/public/extend_index_management/index.js
+++ b/x-pack/legacy/plugins/rollup/public/extend_index_management/index.ts
@@ -4,15 +4,11 @@
* you may not use this file except in compliance with the Elastic License.
*/
import { i18n } from '@kbn/i18n';
-import {
- addToggleExtension,
- addBadgeExtension,
-} from '../../../index_management/public/index_management_extensions';
import { get } from 'lodash';
const propertyPath = 'isRollupIndex';
export const rollupToggleExtension = {
- matchIndex: index => {
+ matchIndex: (index: { isRollupIndex: boolean }) => {
return get(index, propertyPath);
},
label: i18n.translate('xpack.rollupJobs.indexMgmtToggle.toggleLabel', {
@@ -20,8 +16,9 @@ export const rollupToggleExtension = {
}),
name: 'rollupToggle',
};
+
export const rollupBadgeExtension = {
- matchIndex: index => {
+ matchIndex: (index: { isRollupIndex: boolean }) => {
return get(index, propertyPath);
},
label: i18n.translate('xpack.rollupJobs.indexMgmtBadge.rollupLabel', {
@@ -30,6 +27,3 @@ export const rollupBadgeExtension = {
color: 'secondary',
filterExpression: 'isRollupIndex:true',
};
-
-addBadgeExtension(rollupBadgeExtension);
-addToggleExtension(rollupToggleExtension);
diff --git a/x-pack/legacy/plugins/rollup/public/index_pattern_creation/index.js b/x-pack/legacy/plugins/rollup/public/index_pattern_creation/index.js
deleted file mode 100644
index 1add469e073bd..0000000000000
--- a/x-pack/legacy/plugins/rollup/public/index_pattern_creation/index.js
+++ /dev/null
@@ -1,17 +0,0 @@
-/*
- * 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 chrome from 'ui/chrome';
-
-import { initIndexPatternCreation } from './register';
-import { CONFIG_ROLLUPS } from '../../common';
-
-const uiSettings = chrome.getUiSettingsClient();
-const isRollupIndexPatternsEnabled = uiSettings.get(CONFIG_ROLLUPS);
-
-if (isRollupIndexPatternsEnabled) {
- initIndexPatternCreation();
-}
diff --git a/x-pack/legacy/plugins/rollup/public/index_pattern_creation/register.js b/x-pack/legacy/plugins/rollup/public/index_pattern_creation/register.js
deleted file mode 100644
index 9a3aed548dcc9..0000000000000
--- a/x-pack/legacy/plugins/rollup/public/index_pattern_creation/register.js
+++ /dev/null
@@ -1,12 +0,0 @@
-/*
- * 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 { setup as managementSetup } from '../../../../../../src/legacy/core_plugins/management/public/legacy';
-import { RollupIndexPatternCreationConfig } from './rollup_index_pattern_creation_config';
-
-export function initIndexPatternCreation() {
- managementSetup.indexPattern.creation.add(RollupIndexPatternCreationConfig);
-}
diff --git a/x-pack/legacy/plugins/rollup/public/index_pattern_creation/rollup_index_pattern_creation_config.js b/x-pack/legacy/plugins/rollup/public/index_pattern_creation/rollup_index_pattern_creation_config.js
index 07f2a674decc5..82a4c5a888594 100644
--- a/x-pack/legacy/plugins/rollup/public/index_pattern_creation/rollup_index_pattern_creation_config.js
+++ b/x-pack/legacy/plugins/rollup/public/index_pattern_creation/rollup_index_pattern_creation_config.js
@@ -6,10 +6,8 @@
import React from 'react';
import { i18n } from '@kbn/i18n';
-import { npSetup } from 'ui/new_platform';
import { RollupPrompt } from './components/rollup_prompt';
-import { setHttpClient, getRollupIndices } from '../services/api';
import { IndexPatternCreationConfig } from '../../../../../../src/legacy/core_plugins/management/public';
const rollupIndexPatternTypeName = i18n.translate(
@@ -54,7 +52,6 @@ export class RollupIndexPatternCreationConfig extends IndexPatternCreationConfig
...options,
});
- setHttpClient(this.httpClient);
this.rollupIndex = null;
this.rollupJobs = [];
this.rollupIndicesCapabilities = {};
@@ -67,9 +64,10 @@ export class RollupIndexPatternCreationConfig extends IndexPatternCreationConfig
// This is a hack intended to prevent the getRollupIndices() request from being sent if
// we're on /logout. There is a race condition that can arise on that page, whereby this
// request resolves after the logout request resolves, and un-clears the session ID.
- const isAnonymous = npSetup.core.http.anonymousPaths.isAnonymous(window.location.pathname);
+ const isAnonymous = this.httpClient.anonymousPaths.isAnonymous(window.location.pathname);
if (!isAnonymous) {
- this.rollupIndicesCapabilities = await getRollupIndices();
+ const response = await this.httpClient.get('/api/rollup/indices');
+ this.rollupIndicesCapabilities = response || {};
}
this.rollupIndices = Object.keys(this.rollupIndicesCapabilities);
diff --git a/x-pack/legacy/plugins/rollup/public/index_pattern_list/index.js b/x-pack/legacy/plugins/rollup/public/index_pattern_list/index.js
deleted file mode 100644
index 63a3149faaadb..0000000000000
--- a/x-pack/legacy/plugins/rollup/public/index_pattern_list/index.js
+++ /dev/null
@@ -1,16 +0,0 @@
-/*
- * 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 chrome from 'ui/chrome';
-import { initIndexPatternList } from './register';
-import { CONFIG_ROLLUPS } from '../../common';
-
-const uiSettings = chrome.getUiSettingsClient();
-const isRollupIndexPatternsEnabled = uiSettings.get(CONFIG_ROLLUPS);
-
-if (isRollupIndexPatternsEnabled) {
- initIndexPatternList();
-}
diff --git a/x-pack/legacy/plugins/rollup/public/index_pattern_list/register.js b/x-pack/legacy/plugins/rollup/public/index_pattern_list/register.js
deleted file mode 100644
index 173c28826436b..0000000000000
--- a/x-pack/legacy/plugins/rollup/public/index_pattern_list/register.js
+++ /dev/null
@@ -1,12 +0,0 @@
-/*
- * 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 { setup as managementSetup } from '../../../../../../src/legacy/core_plugins/management/public/legacy';
-import { RollupIndexPatternListConfig } from './rollup_index_pattern_list_config';
-
-export function initIndexPatternList() {
- managementSetup.indexPattern.list.add(RollupIndexPatternListConfig);
-}
diff --git a/x-pack/legacy/plugins/rollup/public/kibana_services.ts b/x-pack/legacy/plugins/rollup/public/kibana_services.ts
new file mode 100644
index 0000000000000..335eeb90282ca
--- /dev/null
+++ b/x-pack/legacy/plugins/rollup/public/kibana_services.ts
@@ -0,0 +1,30 @@
+/*
+ * 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 { NotificationsStart, FatalErrorsSetup } from 'src/core/public';
+
+let notifications: NotificationsStart | null = null;
+let fatalErrors: FatalErrorsSetup | null = null;
+
+export function getNotifications() {
+ if (!notifications) {
+ throw new Error('Rollup notifications is not defined');
+ }
+ return notifications;
+}
+export function setNotifications(newNotifications: NotificationsStart) {
+ notifications = newNotifications;
+}
+
+export function getFatalErrors() {
+ if (!fatalErrors) {
+ throw new Error('Rollup fatalErrors is not defined');
+ }
+ return fatalErrors;
+}
+export function setFatalErrors(newFatalErrors: FatalErrorsSetup) {
+ fatalErrors = newFatalErrors;
+}
diff --git a/x-pack/legacy/plugins/rollup/public/legacy.ts b/x-pack/legacy/plugins/rollup/public/legacy.ts
new file mode 100644
index 0000000000000..a2738372ff346
--- /dev/null
+++ b/x-pack/legacy/plugins/rollup/public/legacy.ts
@@ -0,0 +1,30 @@
+/*
+ * 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 { npSetup, npStart } from 'ui/new_platform';
+import { editorConfigProviders } from 'ui/vis/config';
+import { aggTypeFilters } from 'ui/agg_types/filter';
+import { aggTypeFieldFilters } from 'ui/agg_types/param_types/filter';
+import { addSearchStrategy } from '../../../../../src/plugins/data/public';
+import { RollupPlugin } from './plugin';
+import { setup as management } from '../../../../../src/legacy/core_plugins/management/public/legacy';
+import { addBadgeExtension, addToggleExtension } from '../../index_management/public';
+
+const plugin = new RollupPlugin();
+
+export const setup = plugin.setup(npSetup.core, {
+ ...npSetup.plugins,
+ __LEGACY: {
+ aggTypeFilters,
+ aggTypeFieldFilters,
+ editorConfigProviders,
+ addSearchStrategy,
+ addBadgeExtension,
+ addToggleExtension,
+ managementLegacy: management,
+ },
+});
+export const start = plugin.start(npStart.core);
diff --git a/x-pack/legacy/plugins/rollup/public/legacy_imports.ts b/x-pack/legacy/plugins/rollup/public/legacy_imports.ts
new file mode 100644
index 0000000000000..981f97963591e
--- /dev/null
+++ b/x-pack/legacy/plugins/rollup/public/legacy_imports.ts
@@ -0,0 +1,12 @@
+/*
+ * 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.
+ */
+
+// @ts-ignore
+export { findIllegalCharactersInIndexName, INDEX_ILLEGAL_CHARACTERS_VISIBLE } from 'ui/indices';
+
+export { AggTypeFilters } from 'ui/agg_types/filter';
+export { AggTypeFieldFilters } from 'ui/agg_types/param_types/filter';
+export { EditorConfigProviderRegistry } from 'ui/vis/config';
diff --git a/x-pack/legacy/plugins/rollup/public/plugin.ts b/x-pack/legacy/plugins/rollup/public/plugin.ts
new file mode 100644
index 0000000000000..97c03fd1fdfc2
--- /dev/null
+++ b/x-pack/legacy/plugins/rollup/public/plugin.ts
@@ -0,0 +1,128 @@
+/*
+ * 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 { i18n } from '@kbn/i18n';
+import { CoreSetup, CoreStart, Plugin } from 'kibana/public';
+import {
+ EditorConfigProviderRegistry,
+ AggTypeFilters,
+ AggTypeFieldFilters,
+} from './legacy_imports';
+import { SearchStrategyProvider } from '../../../../../src/plugins/data/public';
+import { ManagementSetup as ManagementSetupLegacy } from '../../../../../src/legacy/core_plugins/management/public/np_ready';
+import { rollupBadgeExtension, rollupToggleExtension } from './extend_index_management';
+// @ts-ignore
+import { RollupIndexPatternCreationConfig } from './index_pattern_creation/rollup_index_pattern_creation_config';
+// @ts-ignore
+import { RollupIndexPatternListConfig } from './index_pattern_list/rollup_index_pattern_list_config';
+import { getRollupSearchStrategy } from './search/rollup_search_strategy';
+// @ts-ignore
+import { initAggTypeFilter } from './visualize/agg_type_filter';
+// @ts-ignore
+import { initAggTypeFieldFilter } from './visualize/agg_type_field_filter';
+// @ts-ignore
+import { initEditorConfig } from './visualize/editor_config';
+import { CONFIG_ROLLUPS } from '../common';
+import {
+ FeatureCatalogueCategory,
+ HomePublicPluginSetup,
+} from '../../../../../src/plugins/home/public';
+// @ts-ignore
+import { CRUD_APP_BASE_PATH } from './crud_app/constants';
+import { ManagementSetup } from '../../../../../src/plugins/management/public';
+// @ts-ignore
+import { setEsBaseAndXPackBase, setHttp } from './crud_app/services';
+import { setNotifications, setFatalErrors } from './kibana_services';
+import { renderApp } from './application';
+
+export interface RollupPluginSetupDependencies {
+ __LEGACY: {
+ aggTypeFilters: AggTypeFilters;
+ aggTypeFieldFilters: AggTypeFieldFilters;
+ editorConfigProviders: EditorConfigProviderRegistry;
+ addSearchStrategy: (searchStrategy: SearchStrategyProvider) => void;
+ managementLegacy: ManagementSetupLegacy;
+ addBadgeExtension: (badgeExtension: any) => void;
+ addToggleExtension: (toggleExtension: any) => void;
+ };
+ home?: HomePublicPluginSetup;
+ management: ManagementSetup;
+}
+
+export class RollupPlugin implements Plugin {
+ setup(
+ core: CoreSetup,
+ {
+ __LEGACY: {
+ aggTypeFilters,
+ aggTypeFieldFilters,
+ editorConfigProviders,
+ addSearchStrategy,
+ managementLegacy,
+ addBadgeExtension,
+ addToggleExtension,
+ },
+ home,
+ management,
+ }: RollupPluginSetupDependencies
+ ) {
+ setFatalErrors(core.fatalErrors);
+ addBadgeExtension(rollupBadgeExtension);
+ addToggleExtension(rollupToggleExtension);
+
+ const isRollupIndexPatternsEnabled = core.uiSettings.get(CONFIG_ROLLUPS);
+
+ if (isRollupIndexPatternsEnabled) {
+ managementLegacy.indexPattern.creation.add(RollupIndexPatternCreationConfig);
+ managementLegacy.indexPattern.list.add(RollupIndexPatternListConfig);
+ addSearchStrategy(getRollupSearchStrategy(core.http.fetch));
+ initAggTypeFilter(aggTypeFilters);
+ initAggTypeFieldFilter(aggTypeFieldFilters);
+ initEditorConfig(editorConfigProviders);
+ }
+
+ if (home) {
+ home.featureCatalogue.register({
+ id: 'rollup_jobs',
+ title: 'Rollups',
+ description: i18n.translate('xpack.rollupJobs.featureCatalogueDescription', {
+ defaultMessage:
+ 'Summarize and store historical data in a smaller index for future analysis.',
+ }),
+ icon: 'indexRollupApp',
+ path: `#${CRUD_APP_BASE_PATH}/job_list`,
+ showOnHomePage: true,
+ category: FeatureCatalogueCategory.ADMIN,
+ });
+ }
+
+ const esSection = management.sections.getSection('elasticsearch');
+ if (esSection) {
+ esSection.registerApp({
+ id: 'rollup_jobs',
+ title: i18n.translate('xpack.rollupJobs.appTitle', { defaultMessage: 'Rollup Jobs' }),
+ order: 3,
+ mount(params) {
+ params.setBreadcrumbs([
+ {
+ text: i18n.translate('xpack.rollupJobs.breadcrumbsTitle', {
+ defaultMessage: 'Rollup Jobs',
+ }),
+ },
+ ]);
+
+ return renderApp(core, params);
+ },
+ });
+ }
+ }
+
+ start(core: CoreStart) {
+ setHttp(core.http);
+ setNotifications(core.notifications);
+ setEsBaseAndXPackBase(core.docLinks.ELASTIC_WEBSITE_URL, core.docLinks.DOC_LINK_VERSION);
+ }
+}
diff --git a/x-pack/legacy/plugins/rollup/public/search/index.js b/x-pack/legacy/plugins/rollup/public/search/index.js
deleted file mode 100644
index e76ba4817d72c..0000000000000
--- a/x-pack/legacy/plugins/rollup/public/search/index.js
+++ /dev/null
@@ -1,17 +0,0 @@
-/*
- * 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 chrome from 'ui/chrome';
-
-import { initSearch } from './register';
-import { CONFIG_ROLLUPS } from '../../common';
-
-const uiSettings = chrome.getUiSettingsClient();
-const isRollupIndexPatternsEnabled = uiSettings.get(CONFIG_ROLLUPS);
-
-if (isRollupIndexPatternsEnabled) {
- initSearch();
-}
diff --git a/x-pack/legacy/plugins/rollup/public/search/register.js b/x-pack/legacy/plugins/rollup/public/search/register.js
deleted file mode 100644
index 05db100088e8a..0000000000000
--- a/x-pack/legacy/plugins/rollup/public/search/register.js
+++ /dev/null
@@ -1,12 +0,0 @@
-/*
- * 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 { addSearchStrategy } from '../../../../../../src/plugins/data/public';
-import { rollupSearchStrategy } from './rollup_search_strategy';
-
-export function initSearch() {
- addSearchStrategy(rollupSearchStrategy);
-}
diff --git a/x-pack/legacy/plugins/rollup/public/search/rollup_search_strategy.js b/x-pack/legacy/plugins/rollup/public/search/rollup_search_strategy.ts
similarity index 74%
rename from x-pack/legacy/plugins/rollup/public/search/rollup_search_strategy.js
rename to x-pack/legacy/plugins/rollup/public/search/rollup_search_strategy.ts
index 18e72cdf0fd3d..4709c0aa498f8 100644
--- a/x-pack/legacy/plugins/rollup/public/search/rollup_search_strategy.js
+++ b/x-pack/legacy/plugins/rollup/public/search/rollup_search_strategy.ts
@@ -4,10 +4,17 @@
* you may not use this file except in compliance with the Elastic License.
*/
-import { kfetch } from 'ui/kfetch';
-import { SearchError, getSearchErrorType } from '../../../../../../src/plugins/data/public';
+import { HttpSetup } from 'src/core/public';
+import {
+ SearchError,
+ getSearchErrorType,
+ IIndexPattern,
+ SearchStrategyProvider,
+ SearchResponse,
+ SearchRequest,
+} from '../../../../../../src/plugins/data/public';
-function serializeFetchParams(searchRequests) {
+function serializeFetchParams(searchRequests: SearchRequest[]) {
return JSON.stringify(
searchRequests.map(searchRequestWithFetchParams => {
const indexPattern =
@@ -17,7 +24,7 @@ function serializeFetchParams(searchRequests) {
} = searchRequestWithFetchParams;
const query = {
- size: size,
+ size,
aggregations: aggs,
query: _query,
};
@@ -30,7 +37,7 @@ function serializeFetchParams(searchRequests) {
// Rollup search always returns 0 hits, but visualizations expect search responses
// to return hits > 0, otherwise they do not render. We fake the number of hits here
// by counting the number of aggregation buckets/values returned by rollup search.
-function shimHitsInFetchResponse(response) {
+function shimHitsInFetchResponse(response: SearchResponse[]) {
return response.map(result => {
const buckets = result.aggregations
? Object.keys(result.aggregations).reduce((allBuckets, agg) => {
@@ -51,17 +58,16 @@ function shimHitsInFetchResponse(response) {
});
}
-export const rollupSearchStrategy = {
+export const getRollupSearchStrategy = (fetch: HttpSetup['fetch']): SearchStrategyProvider => ({
id: 'rollup',
- search: ({ searchRequests, Promise }) => {
+ search: ({ searchRequests }) => {
// Serialize the fetch params into a format suitable for the body of an ES query.
const serializedFetchParams = serializeFetchParams(searchRequests);
const controller = new AbortController();
- const promise = kfetch({
+ const promise = fetch('../api/rollup/search', {
signal: controller.signal,
- pathname: '../api/rollup/search',
method: 'POST',
body: serializedFetchParams,
});
@@ -69,17 +75,17 @@ export const rollupSearchStrategy = {
return {
searching: promise.then(shimHitsInFetchResponse).catch(error => {
const {
- body: { statusText, error: title, message },
+ body: { statusCode, error: title, message },
res: { url },
} = error;
- // Format kfetch error as a SearchError.
+ // Format fetch error as a SearchError.
const searchError = new SearchError({
- status: statusText,
+ status: statusCode,
title,
message: `Rollup search error: ${message}`,
path: url,
- type: getSearchErrorType({ message }),
+ type: getSearchErrorType({ message }) || '',
});
return Promise.reject(searchError);
@@ -88,11 +94,11 @@ export const rollupSearchStrategy = {
};
},
- isViable: indexPattern => {
+ isViable: (indexPattern: IIndexPattern) => {
if (!indexPattern) {
return false;
}
return indexPattern.type === 'rollup';
},
-};
+});
diff --git a/x-pack/legacy/plugins/rollup/public/services/api.js b/x-pack/legacy/plugins/rollup/public/services/api.js
deleted file mode 100644
index ae9e8756c7efc..0000000000000
--- a/x-pack/legacy/plugins/rollup/public/services/api.js
+++ /dev/null
@@ -1,14 +0,0 @@
-/*
- * 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.
- */
-let httpClient;
-export const setHttpClient = client => {
- httpClient = client;
-};
-
-export async function getRollupIndices() {
- const response = await httpClient.get('/api/rollup/indices');
- return response || {};
-}
diff --git a/x-pack/legacy/plugins/rollup/public/visualize/agg_type_field_filter.js b/x-pack/legacy/plugins/rollup/public/visualize/agg_type_field_filter.js
index 9d19dff648667..6f44e0ef90efd 100644
--- a/x-pack/legacy/plugins/rollup/public/visualize/agg_type_field_filter.js
+++ b/x-pack/legacy/plugins/rollup/public/visualize/agg_type_field_filter.js
@@ -4,9 +4,7 @@
* you may not use this file except in compliance with the Elastic License.
*/
-import { aggTypeFieldFilters } from 'ui/agg_types/param_types/filter';
-
-export function initAggTypeFieldFilter() {
+export function initAggTypeFieldFilter(aggTypeFieldFilters) {
/**
* If rollup index pattern, check its capabilities
* and limit available fields for a given aggType based on that.
diff --git a/x-pack/legacy/plugins/rollup/public/visualize/agg_type_filter.js b/x-pack/legacy/plugins/rollup/public/visualize/agg_type_filter.js
index 75b11dac06cf5..5f9fab3061a19 100644
--- a/x-pack/legacy/plugins/rollup/public/visualize/agg_type_filter.js
+++ b/x-pack/legacy/plugins/rollup/public/visualize/agg_type_filter.js
@@ -4,9 +4,7 @@
* you may not use this file except in compliance with the Elastic License.
*/
-import { aggTypeFilters } from 'ui/agg_types/filter';
-
-export function initAggTypeFilter() {
+export function initAggTypeFilter(aggTypeFilters) {
/**
* If rollup index pattern, check its capabilities
* and limit available aggregations based on that.
diff --git a/x-pack/legacy/plugins/rollup/public/visualize/editor_config.js b/x-pack/legacy/plugins/rollup/public/visualize/editor_config.js
index 8f5072e8a9866..5c1eb7c8ee3b7 100644
--- a/x-pack/legacy/plugins/rollup/public/visualize/editor_config.js
+++ b/x-pack/legacy/plugins/rollup/public/visualize/editor_config.js
@@ -5,9 +5,8 @@
*/
import { i18n } from '@kbn/i18n';
-import { editorConfigProviders } from 'ui/vis/config';
-export function initEditorConfig() {
+export function initEditorConfig(editorConfigProviders) {
// Limit agg params based on rollup capabilities
editorConfigProviders.register((indexPattern, aggConfig) => {
if (indexPattern.type !== 'rollup') {
diff --git a/x-pack/legacy/plugins/rollup/public/visualize/index.js b/x-pack/legacy/plugins/rollup/public/visualize/index.js
deleted file mode 100644
index e5a9c63c91a92..0000000000000
--- a/x-pack/legacy/plugins/rollup/public/visualize/index.js
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * 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 chrome from 'ui/chrome';
-
-import { initAggTypeFilter } from './agg_type_filter';
-import { initAggTypeFieldFilter } from './agg_type_field_filter';
-import { initEditorConfig } from './editor_config';
-import { CONFIG_ROLLUPS } from '../../common';
-
-const uiSettings = chrome.getUiSettingsClient();
-const isRollupIndexPatternsEnabled = uiSettings.get(CONFIG_ROLLUPS);
-
-if (isRollupIndexPatternsEnabled) {
- initAggTypeFilter();
- initAggTypeFieldFilter();
- initEditorConfig();
-}
diff --git a/x-pack/legacy/plugins/rollup/server/lib/call_with_request_factory/call_with_request_factory.js b/x-pack/legacy/plugins/rollup/server/lib/call_with_request_factory/call_with_request_factory.js
index 537c5cf45ad61..284151d404a47 100644
--- a/x-pack/legacy/plugins/rollup/server/lib/call_with_request_factory/call_with_request_factory.js
+++ b/x-pack/legacy/plugins/rollup/server/lib/call_with_request_factory/call_with_request_factory.js
@@ -8,10 +8,10 @@ import { once } from 'lodash';
import { elasticsearchJsPlugin } from '../../client/elasticsearch_rollup';
const callWithRequest = once(server => {
- const config = { plugins: [elasticsearchJsPlugin] };
- const cluster = server.plugins.elasticsearch.createCluster('rollup', config);
-
- return cluster.callWithRequest;
+ const client = server.newPlatform.setup.core.elasticsearch.createClient('rollup', {
+ plugins: [elasticsearchJsPlugin],
+ });
+ return (request, ...args) => client.asScoped(request).callAsCurrentUser(...args);
});
export const callWithRequestFactory = (server, request) => {
diff --git a/x-pack/legacy/plugins/rollup/server/lib/search_strategies/register_rollup_search_strategy.js b/x-pack/legacy/plugins/rollup/server/lib/search_strategies/register_rollup_search_strategy.js
index 5d732c8e7fbaa..fe65a7f1f30e9 100644
--- a/x-pack/legacy/plugins/rollup/server/lib/search_strategies/register_rollup_search_strategy.js
+++ b/x-pack/legacy/plugins/rollup/server/lib/search_strategies/register_rollup_search_strategy.js
@@ -6,19 +6,19 @@
import { getRollupSearchStrategy } from './rollup_search_strategy';
import { getRollupSearchRequest } from './rollup_search_request';
import { getRollupSearchCapabilities } from './rollup_search_capabilities';
+import {
+ AbstractSearchRequest,
+ DefaultSearchCapabilities,
+ AbstractSearchStrategy,
+} from '../../../../../../../src/plugins/vis_type_timeseries/server';
-export const registerRollupSearchStrategy = (kbnServer, server) =>
+export const registerRollupSearchStrategy = kbnServer =>
kbnServer.afterPluginsInit(() => {
- if (!server.plugins.metrics) {
+ if (!kbnServer.newPlatform.setup.plugins.metrics) {
return;
}
- const {
- addSearchStrategy,
- AbstractSearchRequest,
- AbstractSearchStrategy,
- DefaultSearchCapabilities,
- } = server.plugins.metrics;
+ const { addSearchStrategy } = kbnServer.newPlatform.setup.plugins.metrics;
const RollupSearchRequest = getRollupSearchRequest(AbstractSearchRequest);
const RollupSearchCapabilities = getRollupSearchCapabilities(DefaultSearchCapabilities);
@@ -28,5 +28,5 @@ export const registerRollupSearchStrategy = (kbnServer, server) =>
RollupSearchCapabilities
);
- addSearchStrategy(new RollupSearchStrategy(server));
+ addSearchStrategy(new RollupSearchStrategy(kbnServer));
});
diff --git a/x-pack/legacy/plugins/rollup/server/lib/search_strategies/register_rollup_search_strategy.test.js b/x-pack/legacy/plugins/rollup/server/lib/search_strategies/register_rollup_search_strategy.test.js
index 5a1e4f27b1453..acd016d75f97e 100644
--- a/x-pack/legacy/plugins/rollup/server/lib/search_strategies/register_rollup_search_strategy.test.js
+++ b/x-pack/legacy/plugins/rollup/server/lib/search_strategies/register_rollup_search_strategy.test.js
@@ -14,6 +14,9 @@ describe('Register Rollup Search Strategy', () => {
kbnServer = {
afterPluginsInit,
+ newPlatform: {
+ setup: { plugins: {} },
+ },
};
metrics = {
@@ -25,27 +28,22 @@ describe('Register Rollup Search Strategy', () => {
});
test('should run initialization on "afterPluginsInit" hook', () => {
- registerRollupSearchStrategy(kbnServer, {
- plugins: {},
- });
+ registerRollupSearchStrategy(kbnServer);
expect(kbnServer.afterPluginsInit).toHaveBeenCalled();
});
test('should run initialization if metrics plugin available', () => {
- registerRollupSearchStrategy(kbnServer, {
- plugins: {
- metrics,
- },
+ registerRollupSearchStrategy({
+ ...kbnServer,
+ newPlatform: { setup: { plugins: { metrics } } },
});
expect(metrics.addSearchStrategy).toHaveBeenCalled();
});
test('should not run initialization if metrics plugin unavailable', () => {
- registerRollupSearchStrategy(kbnServer, {
- plugins: {},
- });
+ registerRollupSearchStrategy(kbnServer);
expect(metrics.addSearchStrategy).not.toHaveBeenCalled();
});
diff --git a/x-pack/legacy/plugins/siem/public/components/link_to/redirect_to_detection_engine.tsx b/x-pack/legacy/plugins/siem/public/components/link_to/redirect_to_detection_engine.tsx
index e4a6a799fdcf3..3701069389b72 100644
--- a/x-pack/legacy/plugins/siem/public/components/link_to/redirect_to_detection_engine.tsx
+++ b/x-pack/legacy/plugins/siem/public/components/link_to/redirect_to_detection_engine.tsx
@@ -57,9 +57,7 @@ export const RedirectToEditRulePage = ({
location: { search },
}: DetectionEngineComponentProps) => {
return (
-
+
);
};
diff --git a/x-pack/legacy/plugins/siem/public/containers/detection_engine/rules/api.ts b/x-pack/legacy/plugins/siem/public/containers/detection_engine/rules/api.ts
index 6b3578bacf24c..8f4abeb31c226 100644
--- a/x-pack/legacy/plugins/siem/public/containers/detection_engine/rules/api.ts
+++ b/x-pack/legacy/plugins/siem/public/containers/detection_engine/rules/api.ts
@@ -217,6 +217,8 @@ export const duplicateRules = async ({ rules }: DuplicateRulesProps): Promise {
if (field === 'queryBar') {
- const filters = addFilterStateIfNotThere(get('queryBar.filters', value));
+ const filters = addFilterStateIfNotThere(get('queryBar.filters', value) ?? []);
const query = get('queryBar.query', value) as Query;
const savedId = get('queryBar.saved_id', value);
return buildQueryBarDescription({
diff --git a/x-pack/legacy/plugins/uptime/common/domain_types/monitors.ts b/x-pack/legacy/plugins/uptime/common/domain_types/monitors.ts
index 296df279b8eec..7f5699eb7e8a4 100644
--- a/x-pack/legacy/plugins/uptime/common/domain_types/monitors.ts
+++ b/x-pack/legacy/plugins/uptime/common/domain_types/monitors.ts
@@ -4,14 +4,7 @@
* you may not use this file except in compliance with the Elastic License.
*/
-import { HistogramDataPoint } from '../graphql/types';
-
export interface UMGqlRange {
dateRangeStart: string;
dateRangeEnd: string;
}
-
-export interface HistogramResult {
- histogram: HistogramDataPoint[];
- interval: number;
-}
diff --git a/x-pack/legacy/plugins/uptime/common/graphql/introspection.json b/x-pack/legacy/plugins/uptime/common/graphql/introspection.json
index 19d9cf19cc7f8..e5d9816ebd28e 100644
--- a/x-pack/legacy/plugins/uptime/common/graphql/introspection.json
+++ b/x-pack/legacy/plugins/uptime/common/graphql/introspection.json
@@ -166,65 +166,6 @@
"isDeprecated": false,
"deprecationReason": null
},
- {
- "name": "getSnapshotHistogram",
- "description": "",
- "args": [
- {
- "name": "dateRangeStart",
- "description": "",
- "type": {
- "kind": "NON_NULL",
- "name": null,
- "ofType": { "kind": "SCALAR", "name": "String", "ofType": null }
- },
- "defaultValue": null
- },
- {
- "name": "dateRangeEnd",
- "description": "",
- "type": {
- "kind": "NON_NULL",
- "name": null,
- "ofType": { "kind": "SCALAR", "name": "String", "ofType": null }
- },
- "defaultValue": null
- },
- {
- "name": "filters",
- "description": "",
- "type": { "kind": "SCALAR", "name": "String", "ofType": null },
- "defaultValue": null
- },
- {
- "name": "statusFilter",
- "description": "",
- "type": { "kind": "SCALAR", "name": "String", "ofType": null },
- "defaultValue": null
- },
- {
- "name": "monitorId",
- "description": "",
- "type": { "kind": "SCALAR", "name": "String", "ofType": null },
- "defaultValue": null
- }
- ],
- "type": {
- "kind": "NON_NULL",
- "name": null,
- "ofType": {
- "kind": "LIST",
- "name": null,
- "ofType": {
- "kind": "NON_NULL",
- "name": null,
- "ofType": { "kind": "OBJECT", "name": "HistogramDataPoint", "ofType": null }
- }
- }
- },
- "isDeprecated": false,
- "deprecationReason": null
- },
{
"name": "getMonitorChartsData",
"description": "",
@@ -2172,57 +2113,6 @@
"enumValues": null,
"possibleTypes": null
},
- {
- "kind": "OBJECT",
- "name": "HistogramDataPoint",
- "description": "",
- "fields": [
- {
- "name": "upCount",
- "description": "",
- "args": [],
- "type": { "kind": "SCALAR", "name": "Int", "ofType": null },
- "isDeprecated": false,
- "deprecationReason": null
- },
- {
- "name": "downCount",
- "description": "",
- "args": [],
- "type": { "kind": "SCALAR", "name": "Int", "ofType": null },
- "isDeprecated": false,
- "deprecationReason": null
- },
- {
- "name": "x",
- "description": "",
- "args": [],
- "type": { "kind": "SCALAR", "name": "UnsignedInteger", "ofType": null },
- "isDeprecated": false,
- "deprecationReason": null
- },
- {
- "name": "x0",
- "description": "",
- "args": [],
- "type": { "kind": "SCALAR", "name": "UnsignedInteger", "ofType": null },
- "isDeprecated": false,
- "deprecationReason": null
- },
- {
- "name": "y",
- "description": "",
- "args": [],
- "type": { "kind": "SCALAR", "name": "UnsignedInteger", "ofType": null },
- "isDeprecated": false,
- "deprecationReason": null
- }
- ],
- "inputFields": null,
- "interfaces": [],
- "enumValues": null,
- "possibleTypes": null
- },
{
"kind": "OBJECT",
"name": "MonitorChart",
@@ -3944,33 +3834,6 @@
],
"possibleTypes": null
},
- {
- "kind": "OBJECT",
- "name": "DataPoint",
- "description": "",
- "fields": [
- {
- "name": "x",
- "description": "",
- "args": [],
- "type": { "kind": "SCALAR", "name": "UnsignedInteger", "ofType": null },
- "isDeprecated": false,
- "deprecationReason": null
- },
- {
- "name": "y",
- "description": "",
- "args": [],
- "type": { "kind": "SCALAR", "name": "Float", "ofType": null },
- "isDeprecated": false,
- "deprecationReason": null
- }
- ],
- "inputFields": null,
- "interfaces": [],
- "enumValues": null,
- "possibleTypes": null
- },
{
"kind": "OBJECT",
"name": "MonitorDurationAreaPoint",
diff --git a/x-pack/legacy/plugins/uptime/common/graphql/types.ts b/x-pack/legacy/plugins/uptime/common/graphql/types.ts
index 92e27d20323a7..c58dd9111cc3f 100644
--- a/x-pack/legacy/plugins/uptime/common/graphql/types.ts
+++ b/x-pack/legacy/plugins/uptime/common/graphql/types.ts
@@ -24,8 +24,6 @@ export interface Query {
getSnapshot?: Snapshot | null;
- getSnapshotHistogram: HistogramDataPoint[];
-
getMonitorChartsData?: MonitorChart | null;
/** Fetch the most recent event data for a monitor ID, date range, location. */
getLatestMonitors: Ping[];
@@ -419,17 +417,7 @@ export interface SnapshotCount {
total: number;
}
-export interface HistogramDataPoint {
- upCount?: number | null;
-
- downCount?: number | null;
-
- x?: UnsignedInteger | null;
-
- x0?: UnsignedInteger | null;
- y?: UnsignedInteger | null;
-}
/** The data used to populate the monitor charts. */
export interface MonitorChart {
/** The average values for the monitor duration. */
@@ -616,47 +604,6 @@ export interface StatesIndexStatus {
docCount?: DocCount | null;
}
-export interface DataPoint {
- x?: UnsignedInteger | null;
-
- y?: number | null;
-}
-/** Represents a monitor's duration performance in microseconds at a point in time. */
-export interface MonitorDurationAreaPoint {
- /** The timeseries value for this point in time. */
- x: UnsignedInteger;
- /** The min duration value in microseconds at this time. */
- yMin?: number | null;
- /** The max duration value in microseconds at this point. */
- yMax?: number | null;
-}
-
-export interface MonitorSummaryUrl {
- domain?: string | null;
-
- fragment?: string | null;
-
- full?: string | null;
-
- original?: string | null;
-
- password?: string | null;
-
- path?: string | null;
-
- port?: number | null;
-
- query?: string | null;
-
- scheme?: string | null;
-
- username?: string | null;
-}
-
-// ====================================================
-// Arguments
-// ====================================================
-
export interface AllPingsQueryArgs {
/** Optional: the direction to sort by. Accepts 'asc' and 'desc'. Defaults to 'desc'. */
sort?: string | null;
@@ -673,35 +620,7 @@ export interface AllPingsQueryArgs {
/** Optional: agent location to filter by. */
location?: string | null;
}
-export interface GetMonitorsQueryArgs {
- dateRangeStart: string;
-
- dateRangeEnd: string;
-
- filters?: string | null;
-
- statusFilter?: string | null;
-}
-export interface GetSnapshotQueryArgs {
- dateRangeStart: string;
-
- dateRangeEnd: string;
-
- filters?: string | null;
- statusFilter?: string | null;
-}
-export interface GetSnapshotHistogramQueryArgs {
- dateRangeStart: string;
-
- dateRangeEnd: string;
-
- filters?: string | null;
-
- statusFilter?: string | null;
-
- monitorId?: string | null;
-}
export interface GetMonitorChartsDataQueryArgs {
monitorId: string;
@@ -711,11 +630,6 @@ export interface GetMonitorChartsDataQueryArgs {
location?: string | null;
}
-export interface GetFilterBarQueryArgs {
- dateRangeStart: string;
-
- dateRangeEnd: string;
-}
export interface GetMonitorStatesQueryArgs {
dateRangeStart: string;
diff --git a/x-pack/legacy/plugins/ml/server/models/calendar/index.js b/x-pack/legacy/plugins/uptime/common/types/index.ts
similarity index 81%
rename from x-pack/legacy/plugins/ml/server/models/calendar/index.js
rename to x-pack/legacy/plugins/uptime/common/types/index.ts
index 11f99bc8fd922..34bfbc540672f 100644
--- a/x-pack/legacy/plugins/ml/server/models/calendar/index.js
+++ b/x-pack/legacy/plugins/uptime/common/types/index.ts
@@ -4,4 +4,4 @@
* you may not use this file except in compliance with the Elastic License.
*/
-export { CalendarManager } from './calendar_manager';
+export * from './ping/histogram';
diff --git a/x-pack/legacy/plugins/uptime/common/types/ping/histogram.ts b/x-pack/legacy/plugins/uptime/common/types/ping/histogram.ts
new file mode 100644
index 0000000000000..7ac8d1f7b0151
--- /dev/null
+++ b/x-pack/legacy/plugins/uptime/common/types/ping/histogram.ts
@@ -0,0 +1,32 @@
+/*
+ * 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 type UnsignedInteger = any;
+
+export interface HistogramDataPoint {
+ upCount?: number | null;
+
+ downCount?: number | null;
+
+ x?: UnsignedInteger | null;
+
+ x0?: UnsignedInteger | null;
+
+ y?: UnsignedInteger | null;
+}
+
+export interface GetPingHistogramParams {
+ dateStart: string;
+ dateEnd: string;
+ filters?: string;
+ monitorId?: string;
+ statusFilter?: string;
+}
+
+export interface HistogramResult {
+ histogram: HistogramDataPoint[];
+ interval: string;
+}
diff --git a/x-pack/legacy/plugins/uptime/public/components/connected/charts/ping_histogram.tsx b/x-pack/legacy/plugins/uptime/public/components/connected/charts/ping_histogram.tsx
new file mode 100644
index 0000000000000..a6607ca81fc18
--- /dev/null
+++ b/x-pack/legacy/plugins/uptime/public/components/connected/charts/ping_histogram.tsx
@@ -0,0 +1,76 @@
+/*
+ * 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 React, { useEffect } from 'react';
+import { connect } from 'react-redux';
+import { AppState } from '../../../state';
+import {
+ PingHistogramComponent,
+ PingHistogramComponentProps,
+} from '../../functional/charts/ping_histogram';
+import { getPingHistogram } from '../../../state/actions';
+import { selectPingHistogram } from '../../../state/selectors';
+import { withResponsiveWrapper, ResponsiveWrapperProps } from '../../higher_order';
+import { GetPingHistogramParams, HistogramResult } from '../../../../common/types';
+
+type Props = GetPingHistogramParams &
+ ResponsiveWrapperProps &
+ PingHistogramComponentProps &
+ DispatchProps & { lastRefresh: number };
+
+const PingHistogramContainer: React.FC = ({
+ data,
+ loadData,
+ statusFilter,
+ filters,
+ dateStart,
+ dateEnd,
+ absoluteStartDate,
+ absoluteEndDate,
+ monitorId,
+ lastRefresh,
+ ...props
+}) => {
+ useEffect(() => {
+ loadData({ monitorId, dateStart, dateEnd, statusFilter, filters });
+ }, [loadData, dateStart, dateEnd, monitorId, filters, statusFilter, lastRefresh]);
+ return (
+
+ );
+};
+
+interface StateProps {
+ data: HistogramResult | null;
+ loading: boolean;
+ lastRefresh: number;
+}
+
+interface DispatchProps {
+ loadData: typeof getPingHistogram;
+}
+
+const mapStateToProps = (state: AppState): StateProps => ({ ...selectPingHistogram(state) });
+
+const mapDispatchToProps = (dispatch: any): DispatchProps => ({
+ loadData: (params: GetPingHistogramParams) => {
+ return dispatch(getPingHistogram(params));
+ },
+});
+
+export const PingHistogram = connect<
+ StateProps,
+ DispatchProps,
+ PingHistogramComponentProps,
+ AppState
+>(
+ mapStateToProps,
+ mapDispatchToProps
+)(withResponsiveWrapper(PingHistogramContainer));
diff --git a/x-pack/legacy/plugins/uptime/public/components/connected/filter_group/filter_group_container.tsx b/x-pack/legacy/plugins/uptime/public/components/connected/filter_group/filter_group_container.tsx
new file mode 100644
index 0000000000000..2d1c21d1c997d
--- /dev/null
+++ b/x-pack/legacy/plugins/uptime/public/components/connected/filter_group/filter_group_container.tsx
@@ -0,0 +1,93 @@
+/*
+ * 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 React, { useEffect } from 'react';
+import { connect } from 'react-redux';
+import { useUrlParams } from '../../../hooks';
+import { parseFiltersMap } from '../../functional/filter_group/parse_filter_map';
+import { AppState } from '../../../state';
+import { fetchOverviewFilters, GetOverviewFiltersPayload } from '../../../state/actions';
+import { FilterGroupComponent } from '../../functional/filter_group';
+import { OverviewFilters } from '../../../../common/runtime_types/overview_filters';
+
+interface OwnProps {
+ esFilters?: string;
+}
+
+interface StoreProps {
+ esKuery: string;
+ lastRefresh: number;
+ loading: boolean;
+ overviewFilters: OverviewFilters;
+}
+
+interface DispatchProps {
+ loadFilterGroup: typeof fetchOverviewFilters;
+}
+
+type Props = OwnProps & StoreProps & DispatchProps;
+
+export const Container: React.FC = ({
+ esKuery,
+ esFilters,
+ loading,
+ loadFilterGroup,
+ overviewFilters,
+}: Props) => {
+ const [getUrlParams, updateUrl] = useUrlParams();
+
+ const { dateRangeStart, dateRangeEnd, statusFilter, filters: urlFilters } = getUrlParams();
+
+ useEffect(() => {
+ const filterSelections = parseFiltersMap(urlFilters);
+ loadFilterGroup({
+ dateRangeStart,
+ dateRangeEnd,
+ locations: filterSelections.locations ?? [],
+ ports: filterSelections.ports ?? [],
+ schemes: filterSelections.schemes ?? [],
+ search: esKuery,
+ statusFilter,
+ tags: filterSelections.tags ?? [],
+ });
+ }, [dateRangeStart, dateRangeEnd, esKuery, esFilters, statusFilter, urlFilters, loadFilterGroup]);
+
+ // update filters in the URL from filter group
+ const onFilterUpdate = (filtersKuery: string) => {
+ if (urlFilters !== filtersKuery) {
+ updateUrl({ filters: filtersKuery, pagination: '' });
+ }
+ };
+
+ return (
+
+ );
+};
+
+const mapStateToProps = ({
+ overviewFilters: { loading, filters },
+ ui: { esKuery, lastRefresh },
+}: AppState): StoreProps => ({
+ esKuery,
+ overviewFilters: filters,
+ lastRefresh,
+ loading,
+});
+
+const mapDispatchToProps = (dispatch: any): DispatchProps => ({
+ loadFilterGroup: (payload: GetOverviewFiltersPayload) => dispatch(fetchOverviewFilters(payload)),
+});
+
+export const FilterGroup = connect(
+ // @ts-ignore connect is expecting null | undefined for some reason
+ mapStateToProps,
+ mapDispatchToProps
+)(Container);
diff --git a/x-pack/legacy/plugins/uptime/public/components/connected/index.ts b/x-pack/legacy/plugins/uptime/public/components/connected/index.ts
new file mode 100644
index 0000000000000..5bb0d1ae8468f
--- /dev/null
+++ b/x-pack/legacy/plugins/uptime/public/components/connected/index.ts
@@ -0,0 +1,10 @@
+/*
+ * 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 { PingHistogram } from './charts/ping_histogram';
+export { KueryBar } from './kuerybar/kuery_bar_container';
+export { OverviewPage } from './pages/overview_container';
+export { FilterGroup } from './filter_group/filter_group_container';
diff --git a/x-pack/legacy/plugins/uptime/public/components/connected/kuerybar/kuery_bar_container.tsx b/x-pack/legacy/plugins/uptime/public/components/connected/kuerybar/kuery_bar_container.tsx
new file mode 100644
index 0000000000000..d0f160b2c5540
--- /dev/null
+++ b/x-pack/legacy/plugins/uptime/public/components/connected/kuerybar/kuery_bar_container.tsx
@@ -0,0 +1,21 @@
+/*
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
+ * or more contributor license agreements. Licensed under the Elastic License;
+ * you may not use this file except in compliance with the Elastic License.
+ */
+
+import { connect } from 'react-redux';
+import { AppState } from '../../../state';
+import { selectIndexPattern } from '../../../state/selectors';
+import { getIndexPattern } from '../../../state/actions';
+import { KueryBarComponent } from '../../functional';
+
+const mapStateToProps = (state: AppState) => ({ indexPattern: selectIndexPattern(state) });
+
+const mapDispatchToProps = (dispatch: any) => ({
+ loadIndexPattern: () => {
+ dispatch(getIndexPattern({}));
+ },
+});
+
+export const KueryBar = connect(mapStateToProps, mapDispatchToProps)(KueryBarComponent);
diff --git a/x-pack/legacy/plugins/uptime/public/components/connected/pages/overview_container.ts b/x-pack/legacy/plugins/uptime/public/components/connected/pages/overview_container.ts
new file mode 100644
index 0000000000000..406fab8f5bf01
--- /dev/null
+++ b/x-pack/legacy/plugins/uptime/public/components/connected/pages/overview_container.ts
@@ -0,0 +1,14 @@
+/*
+ * 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 { connect } from 'react-redux';
+import { OverviewPageComponent } from '../../../pages/overview';
+import { selectIndexPattern } from '../../../state/selectors';
+import { AppState } from '../../../state';
+
+const mapStateToProps = (state: AppState) => ({ indexPattern: selectIndexPattern(state) });
+
+export const OverviewPage = connect(mapStateToProps)(OverviewPageComponent);
diff --git a/x-pack/legacy/plugins/uptime/public/components/functional/__tests__/__snapshots__/overview_page_parsing_error_callout.test.tsx.snap b/x-pack/legacy/plugins/uptime/public/components/functional/__tests__/__snapshots__/overview_page_parsing_error_callout.test.tsx.snap
index 4b9c169b3d9b3..653b739145f30 100644
--- a/x-pack/legacy/plugins/uptime/public/components/functional/__tests__/__snapshots__/overview_page_parsing_error_callout.test.tsx.snap
+++ b/x-pack/legacy/plugins/uptime/public/components/functional/__tests__/__snapshots__/overview_page_parsing_error_callout.test.tsx.snap
@@ -4,6 +4,11 @@ exports[`OverviewPageParsingErrorCallout renders without errors when a valid err
@@ -26,6 +31,11 @@ exports[`OverviewPageParsingErrorCallout renders without errors when an error wi
diff --git a/x-pack/legacy/plugins/uptime/public/components/functional/charts/__tests__/__snapshots__/chart_wrapper.test.tsx.snap b/x-pack/legacy/plugins/uptime/public/components/functional/charts/__tests__/__snapshots__/chart_wrapper.test.tsx.snap
index 3f3e6b0b929e1..c1b5970f6456c 100644
--- a/x-pack/legacy/plugins/uptime/public/components/functional/charts/__tests__/__snapshots__/chart_wrapper.test.tsx.snap
+++ b/x-pack/legacy/plugins/uptime/public/components/functional/charts/__tests__/__snapshots__/chart_wrapper.test.tsx.snap
@@ -1,7 +1,7 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`ChartWrapper component renders the component with loading false 1`] = `
-
+
-
+
`;
exports[`ChartWrapper component renders the component with loading true 1`] = `
-
+
-
+
`;
diff --git a/x-pack/legacy/plugins/uptime/public/components/functional/charts/__tests__/__snapshots__/ping_histogram.test.tsx.snap b/x-pack/legacy/plugins/uptime/public/components/functional/charts/__tests__/__snapshots__/ping_histogram.test.tsx.snap
new file mode 100644
index 0000000000000..8ee4dc3575469
--- /dev/null
+++ b/x-pack/legacy/plugins/uptime/public/components/functional/charts/__tests__/__snapshots__/ping_histogram.test.tsx.snap
@@ -0,0 +1,48 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`PingHistogram component renders the component without errors 1`] = `
+
+
+
+
+
+
+
+
+
+
+ }
+ title={
+
+
+
+
+
+ }
+ />
+
+
+`;
diff --git a/x-pack/legacy/plugins/uptime/public/components/functional/charts/__tests__/__snapshots__/snapshot_histogram.test.tsx.snap b/x-pack/legacy/plugins/uptime/public/components/functional/charts/__tests__/__snapshots__/snapshot_histogram.test.tsx.snap
deleted file mode 100644
index a725f97d3e0fb..0000000000000
--- a/x-pack/legacy/plugins/uptime/public/components/functional/charts/__tests__/__snapshots__/snapshot_histogram.test.tsx.snap
+++ /dev/null
@@ -1,7 +0,0 @@
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[`SnapshotHistogram component renders the component without errors 1`] = `
-
-
-
-`;
diff --git a/x-pack/legacy/plugins/uptime/public/components/functional/charts/__tests__/snapshot_histogram.test.tsx b/x-pack/legacy/plugins/uptime/public/components/functional/charts/__tests__/ping_histogram.test.tsx
similarity index 64%
rename from x-pack/legacy/plugins/uptime/public/components/functional/charts/__tests__/snapshot_histogram.test.tsx
rename to x-pack/legacy/plugins/uptime/public/components/functional/charts/__tests__/ping_histogram.test.tsx
index db78c063b7ed5..de7cfc86abc0c 100644
--- a/x-pack/legacy/plugins/uptime/public/components/functional/charts/__tests__/snapshot_histogram.test.tsx
+++ b/x-pack/legacy/plugins/uptime/public/components/functional/charts/__tests__/ping_histogram.test.tsx
@@ -6,17 +6,16 @@
import React from 'react';
import { shallowWithIntl } from 'test_utils/enzyme_helpers';
-import { SnapshotHistogram, SnapshotHistogramProps } from '../snapshot_histogram';
+import { PingHistogramComponent, PingHistogramComponentProps } from '../ping_histogram';
-describe('SnapshotHistogram component', () => {
- const props: SnapshotHistogramProps = {
+describe('PingHistogram component', () => {
+ const props: PingHistogramComponentProps = {
absoluteStartDate: 1548697920000,
absoluteEndDate: 1548700920000,
- isResponsive: false,
};
it('renders the component without errors', () => {
- const component = shallowWithIntl( );
+ const component = shallowWithIntl( );
expect(component).toMatchSnapshot();
});
});
diff --git a/x-pack/legacy/plugins/uptime/public/components/functional/charts/chart_wrapper/chart_wrapper.tsx b/x-pack/legacy/plugins/uptime/public/components/functional/charts/chart_wrapper/chart_wrapper.tsx
index deeb1411052c3..7286c59956887 100644
--- a/x-pack/legacy/plugins/uptime/public/components/functional/charts/chart_wrapper/chart_wrapper.tsx
+++ b/x-pack/legacy/plugins/uptime/public/components/functional/charts/chart_wrapper/chart_wrapper.tsx
@@ -4,8 +4,8 @@
* you may not use this file except in compliance with the Elastic License.
*/
-import React, { FC, Fragment, HTMLAttributes } from 'react';
-import { EuiFlexGroup, EuiFlexItem, EuiLoadingChart } from '@elastic/eui';
+import React, { FC, HTMLAttributes } from 'react';
+import { EuiErrorBoundary, EuiFlexGroup, EuiFlexItem, EuiLoadingChart } from '@elastic/eui';
interface Props {
/**
@@ -31,7 +31,7 @@ export const ChartWrapper: FC = ({
const opacity = loading === true ? 0.3 : 1;
return (
-
+
= ({
)}
-
+
);
};
diff --git a/x-pack/legacy/plugins/uptime/public/components/functional/charts/index.ts b/x-pack/legacy/plugins/uptime/public/components/functional/charts/index.ts
index f7c1283dc9e07..2cbd9a2b3aa32 100644
--- a/x-pack/legacy/plugins/uptime/public/components/functional/charts/index.ts
+++ b/x-pack/legacy/plugins/uptime/public/components/functional/charts/index.ts
@@ -7,4 +7,4 @@
export { DonutChart } from './donut_chart';
export { DurationChart } from './duration_chart';
export { MonitorBarSeries } from './monitor_bar_series';
-export { SnapshotHistogram } from './snapshot_histogram';
+export { PingHistogramComponent } from './ping_histogram';
diff --git a/x-pack/legacy/plugins/uptime/public/components/functional/charts/snapshot_histogram.tsx b/x-pack/legacy/plugins/uptime/public/components/functional/charts/ping_histogram.tsx
similarity index 76%
rename from x-pack/legacy/plugins/uptime/public/components/functional/charts/snapshot_histogram.tsx
rename to x-pack/legacy/plugins/uptime/public/components/functional/charts/ping_histogram.tsx
index 92b04534b7331..2d44cff0108cd 100644
--- a/x-pack/legacy/plugins/uptime/public/components/functional/charts/snapshot_histogram.tsx
+++ b/x-pack/legacy/plugins/uptime/public/components/functional/charts/ping_histogram.tsx
@@ -4,21 +4,18 @@
* you may not use this file except in compliance with the Elastic License.
*/
-import { Axis, BarSeries, Chart, Position, timeFormatter, Settings } from '@elastic/charts';
-import { EuiEmptyPrompt, EuiTitle, EuiPanel } from '@elastic/eui';
+import { Axis, BarSeries, Chart, Position, Settings, timeFormatter } from '@elastic/charts';
+import { EuiEmptyPrompt, EuiPanel, EuiTitle } from '@elastic/eui';
import { i18n } from '@kbn/i18n';
import React, { useContext } from 'react';
import { FormattedMessage } from '@kbn/i18n/react';
import moment from 'moment';
import { getChartDateLabel } from '../../../lib/helper';
-import { withUptimeGraphQL, UptimeGraphQLQueryProps } from '../../higher_order';
-import { snapshotHistogramQuery } from '../../../queries/snapshot_histogram_query';
import { ChartWrapper } from './chart_wrapper';
import { UptimeThemeContext } from '../../../contexts';
-import { ResponsiveWrapperProps, withResponsiveWrapper } from '../../higher_order';
-import { HistogramResult } from '../../../../common/domain_types';
+import { HistogramResult } from '../../../../common/types';
-interface HistogramProps {
+export interface PingHistogramComponentProps {
/**
* The date/time for the start of the timespan.
*/
@@ -32,29 +29,23 @@ interface HistogramProps {
* Height is needed, since by default charts takes height of 100%
*/
height?: string;
-}
-export type SnapshotHistogramProps = HistogramProps & ResponsiveWrapperProps;
+ data?: HistogramResult;
-interface SnapshotHistogramQueryResult {
- queryResult?: HistogramResult;
+ loading?: boolean;
}
-type Props = UptimeGraphQLQueryProps
&
- SnapshotHistogramProps &
- ResponsiveWrapperProps;
-
-export const SnapshotHistogramComponent: React.FC = ({
+export const PingHistogramComponent: React.FC = ({
absoluteStartDate,
absoluteEndDate,
data,
loading = false,
height,
-}: Props) => {
+}) => {
const {
colors: { danger, gray },
} = useContext(UptimeThemeContext);
- if (!data || !data.queryResult)
+ if (!data || !data.histogram)
/**
* TODO: the Fragment, EuiTitle, and EuiPanel should be extracted to a dumb component
* that we can reuse in the subsequent return statement at the bottom of this function.
@@ -93,19 +84,15 @@ export const SnapshotHistogramComponent: React.FC = ({
>
);
- const {
- queryResult: { histogram, interval },
- } = data;
+ const { histogram } = data;
- const downMonitorsId = i18n.translate('xpack.uptime.snapshotHistogram.downMonitorsId', {
+ const downSpecId = i18n.translate('xpack.uptime.snapshotHistogram.downMonitorsId', {
defaultMessage: 'Down Monitors',
});
- const downSpecId = downMonitorsId;
const upMonitorsId = i18n.translate('xpack.uptime.snapshotHistogram.series.upLabel', {
defaultMessage: 'Up',
});
- const upSpecId = upMonitorsId;
return (
<>
@@ -131,7 +118,6 @@ export const SnapshotHistogramComponent: React.FC = ({
= ({
/>
= ({
/>
= ({
[x, upCount || 0])}
- id={upSpecId}
+ id={upMonitorsId}
name={upMonitorsId}
stackAccessors={[0]}
timeZone="local"
@@ -187,8 +173,3 @@ export const SnapshotHistogramComponent: React.FC = ({
>
);
};
-
-export const SnapshotHistogram = withUptimeGraphQL<
- SnapshotHistogramQueryResult,
- SnapshotHistogramProps
->(withResponsiveWrapper(SnapshotHistogramComponent), snapshotHistogramQuery);
diff --git a/x-pack/legacy/plugins/uptime/public/components/functional/filter_group/filter_group.tsx b/x-pack/legacy/plugins/uptime/public/components/functional/filter_group/filter_group.tsx
index 351302fb38356..ff73554c8f07c 100644
--- a/x-pack/legacy/plugins/uptime/public/components/functional/filter_group/filter_group.tsx
+++ b/x-pack/legacy/plugins/uptime/public/components/functional/filter_group/filter_group.tsx
@@ -4,44 +4,21 @@
* you may not use this file except in compliance with the Elastic License.
*/
+import React from 'react';
import { EuiFilterGroup } from '@elastic/eui';
-import React, { useEffect } from 'react';
import { i18n } from '@kbn/i18n';
-import { connect } from 'react-redux';
import { FilterPopoverProps, FilterPopover } from './filter_popover';
import { FilterStatusButton } from './filter_status_button';
-import { OverviewFilters } from '../../../../common/runtime_types';
-import { fetchOverviewFilters, GetOverviewFiltersPayload } from '../../../state/actions';
-import { AppState } from '../../../state';
-import { useUrlParams } from '../../../hooks';
-import { parseFiltersMap } from './parse_filter_map';
+import { OverviewFilters } from '../../../../common/runtime_types/overview_filters';
-interface OwnProps {
- currentFilter: any;
- onFilterUpdate: any;
- dateRangeStart: string;
- dateRangeEnd: string;
- filters?: string;
- statusFilter?: string;
-}
-
-interface StoreProps {
- esKuery: string;
- lastRefresh: number;
+interface PresentationalComponentProps {
loading: boolean;
overviewFilters: OverviewFilters;
+ currentFilter: string;
+ onFilterUpdate: (filtersKuery: string) => void;
}
-interface DispatchProps {
- loadFilterGroup: typeof fetchOverviewFilters;
-}
-
-type Props = OwnProps & StoreProps & DispatchProps;
-
-type PresentationalComponentProps = Pick &
- Pick;
-
-export const PresentationalComponent: React.FC = ({
+export const FilterGroupComponent: React.FC = ({
currentFilter,
overviewFilters,
loading,
@@ -151,60 +128,3 @@ export const PresentationalComponent: React.FC = (
);
};
-
-export const Container: React.FC = ({
- currentFilter,
- esKuery,
- filters,
- loading,
- loadFilterGroup,
- dateRangeStart,
- dateRangeEnd,
- overviewFilters,
- statusFilter,
- onFilterUpdate,
-}: Props) => {
- const [getUrlParams] = useUrlParams();
- const { filters: urlFilters } = getUrlParams();
- useEffect(() => {
- const filterSelections = parseFiltersMap(urlFilters);
- loadFilterGroup({
- dateRangeStart,
- dateRangeEnd,
- locations: filterSelections.locations ?? [],
- ports: filterSelections.ports ?? [],
- schemes: filterSelections.schemes ?? [],
- search: esKuery,
- statusFilter,
- tags: filterSelections.tags ?? [],
- });
- }, [dateRangeStart, dateRangeEnd, esKuery, filters, statusFilter, urlFilters, loadFilterGroup]);
- return (
-
- );
-};
-
-const mapStateToProps = ({
- overviewFilters: { loading, filters },
- ui: { esKuery, lastRefresh },
-}: AppState): StoreProps => ({
- esKuery,
- overviewFilters: filters,
- lastRefresh,
- loading,
-});
-
-const mapDispatchToProps = (dispatch: any): DispatchProps => ({
- loadFilterGroup: (payload: GetOverviewFiltersPayload) => dispatch(fetchOverviewFilters(payload)),
-});
-
-export const FilterGroup = connect(
- // @ts-ignore connect is expecting null | undefined for some reason
- mapStateToProps,
- mapDispatchToProps
-)(Container);
diff --git a/x-pack/legacy/plugins/uptime/public/components/functional/filter_group/index.ts b/x-pack/legacy/plugins/uptime/public/components/functional/filter_group/index.ts
index 285972fb34eaa..2aae026144d8f 100644
--- a/x-pack/legacy/plugins/uptime/public/components/functional/filter_group/index.ts
+++ b/x-pack/legacy/plugins/uptime/public/components/functional/filter_group/index.ts
@@ -4,4 +4,4 @@
* you may not use this file except in compliance with the Elastic License.
*/
-export { FilterGroup } from './filter_group';
+export { FilterGroupComponent } from './filter_group';
diff --git a/x-pack/legacy/plugins/uptime/public/components/functional/index.ts b/x-pack/legacy/plugins/uptime/public/components/functional/index.ts
index 7370faa12f393..6af17cfd67c46 100644
--- a/x-pack/legacy/plugins/uptime/public/components/functional/index.ts
+++ b/x-pack/legacy/plugins/uptime/public/components/functional/index.ts
@@ -7,13 +7,12 @@
export { DonutChart } from './charts/donut_chart';
export { EmptyState } from './empty_state';
export { MonitorStatusBar } from './monitor_status_details';
-export { FilterGroup } from './filter_group';
export { IntegrationLink } from './integration_link';
-export { KueryBar } from './kuery_bar';
+export { KueryBarComponent } from './kuery_bar/kuery_bar';
export { MonitorCharts } from './monitor_charts';
export { MonitorList } from './monitor_list';
export { OverviewPageParsingErrorCallout } from './overview_page_parsing_error_callout';
export { PingList } from './ping_list';
export { Snapshot } from './snapshot';
-export { SnapshotHistogram } from './charts';
+export { PingHistogramComponent } from './charts';
export { StatusPanel } from './status_panel';
diff --git a/x-pack/legacy/plugins/uptime/public/components/functional/kuery_bar/index.tsx b/x-pack/legacy/plugins/uptime/public/components/functional/kuery_bar/kuery_bar.tsx
similarity index 91%
rename from x-pack/legacy/plugins/uptime/public/components/functional/kuery_bar/index.tsx
rename to x-pack/legacy/plugins/uptime/public/components/functional/kuery_bar/kuery_bar.tsx
index 679106f7e19b4..63c8885fe5864 100644
--- a/x-pack/legacy/plugins/uptime/public/components/functional/kuery_bar/index.tsx
+++ b/x-pack/legacy/plugins/uptime/public/components/functional/kuery_bar/kuery_bar.tsx
@@ -11,14 +11,12 @@ import styled from 'styled-components';
import { FormattedMessage } from '@kbn/i18n/react';
import { Typeahead } from './typeahead';
import { useUrlParams } from '../../../hooks';
-import { toStaticIndexPattern } from '../../../lib/helper';
import {
esKuery,
IIndexPattern,
autocomplete,
DataPublicPluginStart,
} from '../../../../../../../../src/plugins/data/public';
-import { useIndexPattern } from '../../../hooks';
const Container = styled.div`
margin-bottom: 10px;
@@ -36,20 +34,29 @@ function convertKueryToEsQuery(kuery: string, indexPattern: IIndexPattern) {
interface Props {
autocomplete: DataPublicPluginStart['autocomplete'];
+ loadIndexPattern: any;
+ indexPattern: any;
}
-export function KueryBar({ autocomplete: autocompleteService }: Props) {
+export function KueryBarComponent({
+ autocomplete: autocompleteService,
+ loadIndexPattern,
+ indexPattern,
+}: Props) {
+ useEffect(() => {
+ if (!indexPattern) {
+ loadIndexPattern();
+ }
+ }, [indexPattern, loadIndexPattern]);
+
const [state, setState] = useState({
suggestions: [],
isLoadingIndexPattern: true,
});
- const [indexPattern, setIndexPattern] = useState(undefined);
const [isLoadingIndexPattern, setIsLoadingIndexPattern] = useState(true);
const [isLoadingSuggestions, setIsLoadingSuggestions] = useState(false);
let currentRequestCheck: string;
- useIndexPattern((result: any) => setIndexPattern(toStaticIndexPattern(result)));
-
useEffect(() => {
if (indexPattern !== undefined) {
setIsLoadingIndexPattern(false);
diff --git a/x-pack/legacy/plugins/uptime/public/components/functional/location_map/__tests__/__snapshots__/location_map.test.tsx.snap b/x-pack/legacy/plugins/uptime/public/components/functional/location_map/__tests__/__snapshots__/location_map.test.tsx.snap
index a03a89be35ec2..2ed3512c9c21a 100644
--- a/x-pack/legacy/plugins/uptime/public/components/functional/location_map/__tests__/__snapshots__/location_map.test.tsx.snap
+++ b/x-pack/legacy/plugins/uptime/public/components/functional/location_map/__tests__/__snapshots__/location_map.test.tsx.snap
@@ -143,6 +143,45 @@ exports[`LocationMap component renders correctly against snapshot 1`] = `
`;
+exports[`LocationMap component renders named locations that have missing geo data 1`] = `
+
+
+
+
+
+
+
+
+
+
+
+
+
+`;
+
exports[`LocationMap component shows warning if geo information is missing 1`] = `
diff --git a/x-pack/legacy/plugins/uptime/public/components/functional/location_map/__tests__/__snapshots__/location_missing.test.tsx.snap b/x-pack/legacy/plugins/uptime/public/components/functional/location_map/__tests__/__snapshots__/location_missing.test.tsx.snap
index fb949c7f3b4c2..7862fe03163dc 100644
--- a/x-pack/legacy/plugins/uptime/public/components/functional/location_map/__tests__/__snapshots__/location_missing.test.tsx.snap
+++ b/x-pack/legacy/plugins/uptime/public/components/functional/location_map/__tests__/__snapshots__/location_missing.test.tsx.snap
@@ -3,6 +3,7 @@
exports[`LocationMissingWarning component renders correctly against snapshot 1`] = `
{
const warningComponent = component.find(LocationMissingWarning);
expect(warningComponent).toHaveLength(0);
});
+
+ it('renders named locations that have missing geo data', () => {
+ monitorLocations = {
+ monitorId: 'wapo',
+ locations: [
+ {
+ summary: { up: 4, down: 0 },
+ geo: { name: 'New York', location: undefined },
+ timestamp: '2020-01-13T22:50:06.536Z',
+ },
+ ],
+ };
+
+ const component = shallowWithIntl( );
+ expect(component).toMatchSnapshot();
+ });
});
diff --git a/x-pack/legacy/plugins/uptime/public/components/functional/location_map/location_missing.tsx b/x-pack/legacy/plugins/uptime/public/components/functional/location_map/location_missing.tsx
index 3a3319208ea3c..f8efe42d0ce71 100644
--- a/x-pack/legacy/plugins/uptime/public/components/functional/location_map/location_missing.tsx
+++ b/x-pack/legacy/plugins/uptime/public/components/functional/location_map/location_missing.tsx
@@ -31,7 +31,7 @@ export const LocationMissingWarning = () => {
);
return (
-
+
-
diff --git a/x-pack/legacy/plugins/uptime/public/components/functional/overview_page_parsing_error_callout.tsx b/x-pack/legacy/plugins/uptime/public/components/functional/overview_page_parsing_error_callout.tsx
index 3d38ce42dd1f0..b71a4f2f8646a 100644
--- a/x-pack/legacy/plugins/uptime/public/components/functional/overview_page_parsing_error_callout.tsx
+++ b/x-pack/legacy/plugins/uptime/public/components/functional/overview_page_parsing_error_callout.tsx
@@ -26,6 +26,7 @@ export const OverviewPageParsingErrorCallout = ({
})}
color="danger"
iconType="alert"
+ style={{ width: '100%' }}
>
(
@@ -42,12 +40,15 @@ export const StatusPanel = ({
/>
-
diff --git a/x-pack/legacy/plugins/uptime/public/hooks/index.ts b/x-pack/legacy/plugins/uptime/public/hooks/index.ts
index aa7bb0a220357..cfb8d71f783a6 100644
--- a/x-pack/legacy/plugins/uptime/public/hooks/index.ts
+++ b/x-pack/legacy/plugins/uptime/public/hooks/index.ts
@@ -5,5 +5,5 @@
*/
export { useUrlParams } from './use_url_params';
-export { useIndexPattern } from './use_index_pattern';
export * from './use_telemetry';
+export * from './update_kuery_string';
diff --git a/x-pack/legacy/plugins/uptime/public/hooks/update_kuery_string.ts b/x-pack/legacy/plugins/uptime/public/hooks/update_kuery_string.ts
new file mode 100644
index 0000000000000..d02a6fc2afb5d
--- /dev/null
+++ b/x-pack/legacy/plugins/uptime/public/hooks/update_kuery_string.ts
@@ -0,0 +1,65 @@
+/*
+ * 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 { combineFiltersAndUserSearch, stringifyKueries } from '../lib/helper';
+import { esKuery } from '../../../../../../src/plugins/data/common/es_query';
+import { store } from '../state';
+import { setEsKueryString } from '../state/actions';
+import { IIndexPattern } from '../../../../../../src/plugins/data/common/index_patterns';
+
+const updateEsQueryForFilterGroup = (filterQueryString: string, indexPattern: IIndexPattern) => {
+ // Update EsQuery in Redux to be used in FilterGroup
+ const searchDSL: string = filterQueryString
+ ? JSON.stringify(
+ esKuery.toElasticsearchQuery(esKuery.fromKueryExpression(filterQueryString), indexPattern)
+ )
+ : '';
+ store.dispatch(setEsKueryString(searchDSL));
+};
+
+const getKueryString = (urlFilters: string): string => {
+ let kueryString = '';
+ // We are using try/catch here because this is user entered value
+ // and JSON.parse and stringifyKueries can have hard time parsing
+ // all possible scenarios, we can safely ignore if we can't parse them
+ try {
+ if (urlFilters !== '') {
+ const filterMap = new Map
>(JSON.parse(urlFilters));
+ kueryString = stringifyKueries(filterMap);
+ }
+ } catch {
+ kueryString = '';
+ }
+ return kueryString;
+};
+
+export const useUpdateKueryString = (
+ indexPattern: IIndexPattern,
+ filterQueryString = '',
+ urlFilters: string
+): [string?, Error?] => {
+ const kueryString = getKueryString(urlFilters);
+
+ const combinedFilterString = combineFiltersAndUserSearch(filterQueryString, kueryString);
+
+ let esFilters: string | undefined;
+ // this try catch is necessary to evaluate user input in kuery bar,
+ // this error will be actually shown in UI for user to see
+ try {
+ if ((filterQueryString || urlFilters) && indexPattern) {
+ const ast = esKuery.fromKueryExpression(combinedFilterString);
+
+ const elasticsearchQuery = esKuery.toElasticsearchQuery(ast, indexPattern);
+
+ esFilters = JSON.stringify(elasticsearchQuery);
+
+ updateEsQueryForFilterGroup(filterQueryString, indexPattern);
+ }
+ return [esFilters];
+ } catch (err) {
+ return [urlFilters, err];
+ }
+};
diff --git a/x-pack/legacy/plugins/uptime/public/hooks/use_index_pattern.ts b/x-pack/legacy/plugins/uptime/public/hooks/use_index_pattern.ts
deleted file mode 100644
index f2b586b27dba6..0000000000000
--- a/x-pack/legacy/plugins/uptime/public/hooks/use_index_pattern.ts
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * 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 { useEffect, Dispatch } from 'react';
-import { useKibana } from '../../../../../../src/plugins/kibana_react/public';
-
-export const useIndexPattern = (setIndexPattern: Dispatch) => {
- const core = useKibana();
- useEffect(() => {
- const fetch = core.services.http?.fetch;
- async function getIndexPattern() {
- if (!fetch) throw new Error('Http core services are not defined');
- setIndexPattern(await fetch('/api/uptime/index_pattern', { method: 'GET' }));
- }
- getIndexPattern();
- // eslint-disable-next-line react-hooks/exhaustive-deps
- }, [core.services.http]);
-};
diff --git a/x-pack/legacy/plugins/uptime/public/lib/helper/__tests__/__snapshots__/to_static_index_pattern.test.ts.snap b/x-pack/legacy/plugins/uptime/public/lib/helper/__tests__/__snapshots__/to_static_index_pattern.test.ts.snap
deleted file mode 100644
index bc02e1054b6f7..0000000000000
--- a/x-pack/legacy/plugins/uptime/public/lib/helper/__tests__/__snapshots__/to_static_index_pattern.test.ts.snap
+++ /dev/null
@@ -1,19 +0,0 @@
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[`toStaticIndexPattern provides the required fields 1`] = `
-Object {
- "attributes": Object {
- "fields": "[{\\"name\\":\\"@timestamp\\",\\"type\\":\\"date\\",\\"scripted\\":false,\\"searchable\\":true}]",
- },
- "fields": Array [
- Object {
- "name": "@timestamp",
- "scripted": false,
- "searchable": true,
- "type": "date",
- },
- ],
- "id": "foo",
- "title": "foo",
-}
-`;
diff --git a/x-pack/legacy/plugins/uptime/public/lib/helper/__tests__/to_static_index_pattern.test.ts b/x-pack/legacy/plugins/uptime/public/lib/helper/__tests__/to_static_index_pattern.test.ts
deleted file mode 100644
index c8015a678c726..0000000000000
--- a/x-pack/legacy/plugins/uptime/public/lib/helper/__tests__/to_static_index_pattern.test.ts
+++ /dev/null
@@ -1,19 +0,0 @@
-/*
- * 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 { toStaticIndexPattern } from '../to_static_index_pattern';
-
-describe('toStaticIndexPattern', () => {
- it('provides the required fields', () => {
- const pattern = {
- attributes: {
- fields: '[{"name":"@timestamp","type":"date","scripted":false,"searchable":true}]',
- },
- id: 'foo',
- };
- expect(toStaticIndexPattern(pattern)).toMatchSnapshot();
- });
-});
diff --git a/x-pack/legacy/plugins/uptime/public/lib/helper/combine_filters_and_user_search.ts b/x-pack/legacy/plugins/uptime/public/lib/helper/combine_filters_and_user_search.ts
index f3dfbb7d3b529..45aff24f0449e 100644
--- a/x-pack/legacy/plugins/uptime/public/lib/helper/combine_filters_and_user_search.ts
+++ b/x-pack/legacy/plugins/uptime/public/lib/helper/combine_filters_and_user_search.ts
@@ -5,6 +5,9 @@
*/
export const combineFiltersAndUserSearch = (filters: string, search: string) => {
+ if (!filters && !search) {
+ return '';
+ }
if (!filters) return search;
if (!search) return filters;
return `(${filters}) and (${search})`;
diff --git a/x-pack/legacy/plugins/uptime/public/lib/helper/index.ts b/x-pack/legacy/plugins/uptime/public/lib/helper/index.ts
index ced06ce7a1d7b..ef191ce32e532 100644
--- a/x-pack/legacy/plugins/uptime/public/lib/helper/index.ts
+++ b/x-pack/legacy/plugins/uptime/public/lib/helper/index.ts
@@ -12,5 +12,4 @@ export { getChartDateLabel } from './charts';
export { parameterizeValues } from './parameterize_values';
export { seriesHasDownValues } from './series_has_down_values';
export { stringifyKueries } from './stringify_kueries';
-export { toStaticIndexPattern } from './to_static_index_pattern';
export { UptimeUrlParams, getSupportedUrlParams } from './url_params';
diff --git a/x-pack/legacy/plugins/uptime/public/pages/index.ts b/x-pack/legacy/plugins/uptime/public/pages/index.ts
index a96be42eb0dee..17f083ca023ed 100644
--- a/x-pack/legacy/plugins/uptime/public/pages/index.ts
+++ b/x-pack/legacy/plugins/uptime/public/pages/index.ts
@@ -5,6 +5,6 @@
*/
export { MonitorPage } from './monitor';
-export { OverviewPage } from './overview';
export { NotFoundPage } from './not_found';
export { PageHeader } from './page_header';
+export { OverviewPage } from '../components/connected/';
diff --git a/x-pack/legacy/plugins/uptime/public/pages/overview.tsx b/x-pack/legacy/plugins/uptime/public/pages/overview.tsx
index 36abee673b682..0f6195c5f4c66 100644
--- a/x-pack/legacy/plugins/uptime/public/pages/overview.tsx
+++ b/x-pack/legacy/plugins/uptime/public/pages/overview.tsx
@@ -5,30 +5,28 @@
*/
import { EuiFlexGroup, EuiFlexItem, EuiSpacer } from '@elastic/eui';
-import React, { Fragment, useContext, useState } from 'react';
+import React, { useContext } from 'react';
import styled from 'styled-components';
import {
EmptyState,
- FilterGroup,
- KueryBar,
MonitorList,
OverviewPageParsingErrorCallout,
StatusPanel,
} from '../components/functional';
import { UMUpdateBreadcrumbs } from '../lib/lib';
-import { useIndexPattern, useUrlParams, useUptimeTelemetry, UptimePage } from '../hooks';
+import { useUrlParams, useUptimeTelemetry, UptimePage } from '../hooks';
import { stringifyUrlParams } from '../lib/helper/stringify_url_params';
import { useTrackPageview } from '../../../infra/public';
-import { combineFiltersAndUserSearch, stringifyKueries, toStaticIndexPattern } from '../lib/helper';
-import { store } from '../state';
-import { setEsKueryString } from '../state/actions';
import { PageHeader } from './page_header';
-import { esKuery, DataPublicPluginStart } from '../../../../../../src/plugins/data/public';
-import { UptimeThemeContext } from '../contexts/uptime_theme_context';
+import { DataPublicPluginStart, IIndexPattern } from '../../../../../../src/plugins/data/public';
+import { UptimeThemeContext } from '../contexts';
+import { FilterGroup, KueryBar } from '../components/connected';
+import { useUpdateKueryString } from '../hooks';
interface OverviewPageProps {
autocomplete: DataPublicPluginStart['autocomplete'];
setBreadcrumbs: UMUpdateBreadcrumbs;
+ indexPattern: IIndexPattern;
}
type Props = OverviewPageProps;
@@ -42,72 +40,37 @@ const EuiFlexItemStyled = styled(EuiFlexItem)`
}
`;
-export const OverviewPage = ({ autocomplete, setBreadcrumbs }: Props) => {
+export const OverviewPageComponent = ({ autocomplete, setBreadcrumbs, indexPattern }: Props) => {
const { colors } = useContext(UptimeThemeContext);
- const [getUrlParams, updateUrl] = useUrlParams();
+ const [getUrlParams] = useUrlParams();
const { absoluteDateRangeStart, absoluteDateRangeEnd, ...params } = getUrlParams();
const {
dateRangeStart,
dateRangeEnd,
- search,
pagination,
statusFilter,
+ search,
filters: urlFilters,
} = params;
- const [indexPattern, setIndexPattern] = useState(undefined);
+
useUptimeTelemetry(UptimePage.Overview);
- useIndexPattern(setIndexPattern);
useTrackPageview({ app: 'uptime', path: 'overview' });
useTrackPageview({ app: 'uptime', path: 'overview', delay: 15000 });
- let error: any;
- let kueryString: string = '';
- try {
- if (urlFilters !== '') {
- const filterMap = new Map>(JSON.parse(urlFilters));
- kueryString = stringifyKueries(filterMap);
- }
- } catch {
- kueryString = '';
- }
-
- const filterQueryString = search || '';
- let filters: any | undefined;
- try {
- if (filterQueryString || urlFilters) {
- if (indexPattern) {
- const staticIndexPattern = toStaticIndexPattern(indexPattern);
- const combinedFilterString = combineFiltersAndUserSearch(filterQueryString, kueryString);
- const ast = esKuery.fromKueryExpression(combinedFilterString);
- const elasticsearchQuery = esKuery.toElasticsearchQuery(ast, staticIndexPattern);
- filters = JSON.stringify(elasticsearchQuery);
- const searchDSL: string = filterQueryString
- ? JSON.stringify(
- esKuery.toElasticsearchQuery(
- esKuery.fromKueryExpression(filterQueryString),
- staticIndexPattern
- )
- )
- : '';
- store.dispatch(setEsKueryString(searchDSL));
- }
- }
- } catch (e) {
- error = e;
- }
+ const [esFilters, error] = useUpdateKueryString(indexPattern, search, urlFilters);
const sharedProps = {
dateRangeStart,
dateRangeEnd,
- filters,
statusFilter,
+ filters: esFilters,
};
const linkParameters = stringifyUrlParams(params, true);
return (
-
+ <>
@@ -115,15 +78,7 @@ export const OverviewPage = ({ autocomplete, setBreadcrumbs }: Props) => {
- {
- if (urlFilters !== filtersKuery) {
- updateUrl({ filters: filtersKuery, pagination: '' });
- }
- }}
- />
+
{error && }
@@ -133,16 +88,15 @@ export const OverviewPage = ({ autocomplete, setBreadcrumbs }: Props) => {
absoluteDateRangeEnd={absoluteDateRangeEnd}
dateRangeStart={dateRangeStart}
dateRangeEnd={dateRangeEnd}
- filters={filters}
+ filters={esFilters}
statusFilter={statusFilter}
- sharedProps={sharedProps}
/>
{
}}
/>
-
+ >
);
};
diff --git a/x-pack/legacy/plugins/uptime/public/queries/snapshot_histogram_query.ts b/x-pack/legacy/plugins/uptime/public/queries/snapshot_histogram_query.ts
deleted file mode 100644
index 7eb56ea4e9dd1..0000000000000
--- a/x-pack/legacy/plugins/uptime/public/queries/snapshot_histogram_query.ts
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * 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 gql from 'graphql-tag';
-
-export const snapshotHistogramQueryString = `
- query SnapshotHistogram(
- $dateRangeStart: String!
- $dateRangeEnd: String!
- $filters: String
- $monitorId: String
- $statusFilter: String
- ) {
- queryResult: getSnapshotHistogram(
- dateRangeStart: $dateRangeStart
- dateRangeEnd: $dateRangeEnd
- filters: $filters
- statusFilter: $statusFilter
- monitorId: $monitorId
- ) {
- histogram {
- upCount
- downCount
- x
- x0
- y
- }
- interval
- }
- }
-`;
-
-export const snapshotHistogramQuery = gql`
- ${snapshotHistogramQueryString}
-`;
diff --git a/x-pack/legacy/plugins/uptime/public/routes.tsx b/x-pack/legacy/plugins/uptime/public/routes.tsx
index 07bba5163922e..c318a82ab7f19 100644
--- a/x-pack/legacy/plugins/uptime/public/routes.tsx
+++ b/x-pack/legacy/plugins/uptime/public/routes.tsx
@@ -6,7 +6,7 @@
import React, { FC } from 'react';
import { Route, Switch } from 'react-router-dom';
-import { MonitorPage, OverviewPage, NotFoundPage } from './pages';
+import { MonitorPage, NotFoundPage, OverviewPage } from './pages';
import { DataPublicPluginStart } from '../../../../../src/plugins/data/public';
import { UMUpdateBreadcrumbs } from './lib/lib';
diff --git a/x-pack/legacy/plugins/uptime/public/state/actions/index.ts b/x-pack/legacy/plugins/uptime/public/state/actions/index.ts
index 9874da1839c2f..df707584bd844 100644
--- a/x-pack/legacy/plugins/uptime/public/state/actions/index.ts
+++ b/x-pack/legacy/plugins/uptime/public/state/actions/index.ts
@@ -8,3 +8,5 @@ export * from './overview_filters';
export * from './snapshot';
export * from './ui';
export * from './monitor_status';
+export * from './index_patternts';
+export * from './ping';
diff --git a/x-pack/legacy/plugins/uptime/public/state/actions/index_patternts.ts b/x-pack/legacy/plugins/uptime/public/state/actions/index_patternts.ts
new file mode 100644
index 0000000000000..f52dac805a199
--- /dev/null
+++ b/x-pack/legacy/plugins/uptime/public/state/actions/index_patternts.ts
@@ -0,0 +1,12 @@
+/*
+ * 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 { createAction } from 'redux-actions';
+import { QueryParams } from './types';
+
+export const getIndexPattern = createAction('GET_INDEX_PATTERN');
+export const getIndexPatternSuccess = createAction('GET_INDEX_PATTERN_SUCCESS');
+export const getIndexPatternFail = createAction('GET_INDEX_PATTERN_FAIL');
diff --git a/x-pack/legacy/plugins/uptime/public/state/actions/ping.ts b/x-pack/legacy/plugins/uptime/public/state/actions/ping.ts
new file mode 100644
index 0000000000000..bb7258d9a54b2
--- /dev/null
+++ b/x-pack/legacy/plugins/uptime/public/state/actions/ping.ts
@@ -0,0 +1,12 @@
+/*
+ * 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 { createAction } from 'redux-actions';
+import { GetPingHistogramParams, HistogramResult } from '../../../common/types';
+
+export const getPingHistogram = createAction('GET_PING_HISTOGRAM');
+export const getPingHistogramSuccess = createAction('GET_PING_HISTOGRAM_SUCCESS');
+export const getPingHistogramFail = createAction('GET_PING_HISTOGRAM_FAIL');
diff --git a/x-pack/legacy/plugins/uptime/public/state/api/index.ts b/x-pack/legacy/plugins/uptime/public/state/api/index.ts
index 1d0cac5f87854..2d20638832335 100644
--- a/x-pack/legacy/plugins/uptime/public/state/api/index.ts
+++ b/x-pack/legacy/plugins/uptime/public/state/api/index.ts
@@ -8,3 +8,5 @@ export * from './monitor';
export * from './overview_filters';
export * from './snapshot';
export * from './monitor_status';
+export * from './index_pattern';
+export * from './ping';
diff --git a/x-pack/legacy/plugins/uptime/public/state/api/index_pattern.ts b/x-pack/legacy/plugins/uptime/public/state/api/index_pattern.ts
new file mode 100644
index 0000000000000..2669376d728ab
--- /dev/null
+++ b/x-pack/legacy/plugins/uptime/public/state/api/index_pattern.ts
@@ -0,0 +1,21 @@
+/*
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
+ * or more contributor license agreements. Licensed under the Elastic License;
+ * you may not use this file except in compliance with the Elastic License.
+ */
+
+import { getApiPath } from '../../lib/helper';
+
+interface APIParams {
+ basePath: string;
+}
+
+export const fetchIndexPattern = async ({ basePath }: APIParams) => {
+ const url = getApiPath(`/api/uptime/index_pattern`, basePath);
+
+ const response = await fetch(url);
+ if (!response.ok) {
+ throw new Error(response.statusText);
+ }
+ return await response.json();
+};
diff --git a/x-pack/legacy/plugins/uptime/public/state/api/monitor.ts b/x-pack/legacy/plugins/uptime/public/state/api/monitor.ts
index 8b1220830f091..80fd311c3ec7e 100644
--- a/x-pack/legacy/plugins/uptime/public/state/api/monitor.ts
+++ b/x-pack/legacy/plugins/uptime/public/state/api/monitor.ts
@@ -4,7 +4,7 @@
* you may not use this file except in compliance with the Elastic License.
*/
-import { ThrowReporter } from 'io-ts/lib/ThrowReporter';
+import { PathReporter } from 'io-ts/lib/PathReporter';
import { getApiPath } from '../../lib/helper';
import { BaseParams } from './types';
import {
@@ -41,7 +41,7 @@ export const fetchMonitorDetails = async ({
throw new Error(response.statusText);
}
return response.json().then(data => {
- ThrowReporter.report(MonitorDetailsType.decode(data));
+ PathReporter.report(MonitorDetailsType.decode(data));
return data;
});
};
@@ -68,7 +68,7 @@ export const fetchMonitorLocations = async ({
throw new Error(response.statusText);
}
return response.json().then(data => {
- ThrowReporter.report(MonitorLocationsType.decode(data));
+ PathReporter.report(MonitorLocationsType.decode(data));
return data;
});
};
diff --git a/x-pack/legacy/plugins/uptime/public/state/api/ping.ts b/x-pack/legacy/plugins/uptime/public/state/api/ping.ts
new file mode 100644
index 0000000000000..e0c358fe40e71
--- /dev/null
+++ b/x-pack/legacy/plugins/uptime/public/state/api/ping.ts
@@ -0,0 +1,35 @@
+/*
+ * 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 qs from 'querystring';
+import { getApiPath } from '../../lib/helper';
+import { APIFn } from './types';
+import { GetPingHistogramParams, HistogramResult } from '../../../common/types';
+
+export const fetchPingHistogram: APIFn = async ({
+ basePath,
+ monitorId,
+ dateStart,
+ dateEnd,
+ statusFilter,
+ filters,
+}) => {
+ const url = getApiPath(`/api/uptime/ping/histogram`, basePath);
+ const params = {
+ dateStart,
+ dateEnd,
+ ...(monitorId && { monitorId }),
+ ...(statusFilter && { statusFilter }),
+ ...(filters && { filters }),
+ };
+ const urlParams = qs.stringify(params).toString();
+ const response = await fetch(`${url}?${urlParams}`);
+ if (!response.ok) {
+ throw new Error(response.statusText);
+ }
+ const responseData = await response.json();
+ return responseData;
+};
diff --git a/x-pack/legacy/plugins/uptime/public/state/api/types.ts b/x-pack/legacy/plugins/uptime/public/state/api/types.ts
index 278cfce29986f..c88e111d778d5 100644
--- a/x-pack/legacy/plugins/uptime/public/state/api/types.ts
+++ b/x-pack/legacy/plugins/uptime/public/state/api/types.ts
@@ -12,3 +12,5 @@ export interface BaseParams {
statusFilter?: string;
location?: string;
}
+
+export type APIFn = (params: { basePath: string } & P) => Promise;
diff --git a/x-pack/legacy/plugins/uptime/public/state/effects/index.ts b/x-pack/legacy/plugins/uptime/public/state/effects/index.ts
index 41dda145edb4e..f809454cefb39 100644
--- a/x-pack/legacy/plugins/uptime/public/state/effects/index.ts
+++ b/x-pack/legacy/plugins/uptime/public/state/effects/index.ts
@@ -9,10 +9,14 @@ import { fetchMonitorDetailsEffect } from './monitor';
import { fetchOverviewFiltersEffect } from './overview_filters';
import { fetchSnapshotCountEffect } from './snapshot';
import { fetchMonitorStatusEffect } from './monitor_status';
+import { fetchIndexPatternEffect } from './index_pattern';
+import { fetchPingHistogramEffect } from './ping';
export function* rootEffect() {
yield fork(fetchMonitorDetailsEffect);
yield fork(fetchSnapshotCountEffect);
yield fork(fetchOverviewFiltersEffect);
yield fork(fetchMonitorStatusEffect);
+ yield fork(fetchIndexPatternEffect);
+ yield fork(fetchPingHistogramEffect);
}
diff --git a/x-pack/legacy/plugins/uptime/public/state/effects/index_pattern.ts b/x-pack/legacy/plugins/uptime/public/state/effects/index_pattern.ts
new file mode 100644
index 0000000000000..a6f9256d5ccd9
--- /dev/null
+++ b/x-pack/legacy/plugins/uptime/public/state/effects/index_pattern.ts
@@ -0,0 +1,17 @@
+/*
+ * 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 { takeLatest } from 'redux-saga/effects';
+import { getIndexPattern, getIndexPatternSuccess, getIndexPatternFail } from '../actions';
+import { fetchIndexPattern } from '../api';
+import { fetchEffectFactory } from './fetch_effect';
+
+export function* fetchIndexPatternEffect() {
+ yield takeLatest(
+ getIndexPattern,
+ fetchEffectFactory(fetchIndexPattern, getIndexPatternSuccess, getIndexPatternFail)
+ );
+}
diff --git a/x-pack/legacy/plugins/uptime/public/state/effects/ping.ts b/x-pack/legacy/plugins/uptime/public/state/effects/ping.ts
new file mode 100644
index 0000000000000..acb9b31915fa9
--- /dev/null
+++ b/x-pack/legacy/plugins/uptime/public/state/effects/ping.ts
@@ -0,0 +1,17 @@
+/*
+ * 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 { takeLatest } from 'redux-saga/effects';
+import { getPingHistogram, getPingHistogramSuccess, getPingHistogramFail } from '../actions';
+import { fetchPingHistogram } from '../api';
+import { fetchEffectFactory } from './fetch_effect';
+
+export function* fetchPingHistogramEffect() {
+ yield takeLatest(
+ String(getPingHistogram),
+ fetchEffectFactory(fetchPingHistogram, getPingHistogramSuccess, getPingHistogramFail)
+ );
+}
diff --git a/x-pack/legacy/plugins/uptime/public/state/reducers/index.ts b/x-pack/legacy/plugins/uptime/public/state/reducers/index.ts
index 5f915d970e543..842cb1e937108 100644
--- a/x-pack/legacy/plugins/uptime/public/state/reducers/index.ts
+++ b/x-pack/legacy/plugins/uptime/public/state/reducers/index.ts
@@ -10,6 +10,8 @@ import { overviewFiltersReducer } from './overview_filters';
import { snapshotReducer } from './snapshot';
import { uiReducer } from './ui';
import { monitorStatusReducer } from './monitor_status';
+import { indexPatternReducer } from './index_pattern';
+import { pingReducer } from './ping';
export const rootReducer = combineReducers({
monitor: monitorReducer,
@@ -17,4 +19,6 @@ export const rootReducer = combineReducers({
snapshot: snapshotReducer,
ui: uiReducer,
monitorStatus: monitorStatusReducer,
+ indexPattern: indexPatternReducer,
+ ping: pingReducer,
});
diff --git a/x-pack/legacy/plugins/uptime/public/state/reducers/index_pattern.ts b/x-pack/legacy/plugins/uptime/public/state/reducers/index_pattern.ts
new file mode 100644
index 0000000000000..dff043f81b95c
--- /dev/null
+++ b/x-pack/legacy/plugins/uptime/public/state/reducers/index_pattern.ts
@@ -0,0 +1,41 @@
+/*
+ * 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 { handleActions, Action } from 'redux-actions';
+import { getIndexPattern, getIndexPatternSuccess, getIndexPatternFail } from '../actions';
+
+export interface IndexPatternState {
+ index_pattern: any;
+ errors: any[];
+ loading: boolean;
+}
+
+const initialState: IndexPatternState = {
+ index_pattern: null,
+ loading: false,
+ errors: [],
+};
+
+export const indexPatternReducer = handleActions(
+ {
+ [String(getIndexPattern)]: state => ({
+ ...state,
+ loading: true,
+ }),
+
+ [String(getIndexPatternSuccess)]: (state, action: Action) => ({
+ ...state,
+ loading: false,
+ index_pattern: { ...action.payload },
+ }),
+
+ [String(getIndexPatternFail)]: (state, action: Action) => ({
+ ...state,
+ errors: [...state.errors, action.payload],
+ loading: false,
+ }),
+ },
+ initialState
+);
diff --git a/x-pack/legacy/plugins/uptime/public/state/reducers/ping.ts b/x-pack/legacy/plugins/uptime/public/state/reducers/ping.ts
new file mode 100644
index 0000000000000..76775e6a0a355
--- /dev/null
+++ b/x-pack/legacy/plugins/uptime/public/state/reducers/ping.ts
@@ -0,0 +1,45 @@
+/*
+ * 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 { handleActions, Action } from 'redux-actions';
+import { getPingHistogram, getPingHistogramSuccess, getPingHistogramFail } from '../actions';
+import { HistogramResult } from '../../../common/types';
+
+export interface PingState {
+ pingHistogram: HistogramResult | null;
+ errors: any[];
+ loading: boolean;
+}
+
+const initialState: PingState = {
+ pingHistogram: null,
+ loading: false,
+ errors: [],
+};
+
+type MonitorStatusPayload = HistogramResult & Error;
+
+export const pingReducer = handleActions(
+ {
+ [String(getPingHistogram)]: state => ({
+ ...state,
+ loading: true,
+ }),
+
+ [String(getPingHistogramSuccess)]: (state: PingState, action: Action) => ({
+ ...state,
+ loading: false,
+ pingHistogram: { ...action.payload },
+ }),
+
+ [String(getPingHistogramFail)]: (state, action: Action) => ({
+ ...state,
+ errors: [...state.errors, action.payload],
+ loading: false,
+ }),
+ },
+ initialState
+);
diff --git a/x-pack/legacy/plugins/uptime/public/state/selectors/__tests__/index.test.ts b/x-pack/legacy/plugins/uptime/public/state/selectors/__tests__/index.test.ts
index 38fb3edea4768..2e27431a5ff14 100644
--- a/x-pack/legacy/plugins/uptime/public/state/selectors/__tests__/index.test.ts
+++ b/x-pack/legacy/plugins/uptime/public/state/selectors/__tests__/index.test.ts
@@ -45,6 +45,16 @@ describe('state selectors', () => {
monitor: null,
loading: false,
},
+ indexPattern: {
+ index_pattern: null,
+ loading: false,
+ errors: [],
+ },
+ ping: {
+ pingHistogram: null,
+ loading: false,
+ errors: [],
+ },
};
it('selects base path from state', () => {
diff --git a/x-pack/legacy/plugins/uptime/public/state/selectors/index.ts b/x-pack/legacy/plugins/uptime/public/state/selectors/index.ts
index 337e99f6ede16..fe6a7a1b7eade 100644
--- a/x-pack/legacy/plugins/uptime/public/state/selectors/index.ts
+++ b/x-pack/legacy/plugins/uptime/public/state/selectors/index.ts
@@ -28,3 +28,11 @@ export const selectSelectedMonitor = (state: AppState) => {
export const selectMonitorStatus = (state: AppState) => {
return state.monitorStatus.status;
};
+
+export const selectIndexPattern = ({ indexPattern }: AppState) => {
+ return indexPattern.index_pattern;
+};
+
+export const selectPingHistogram = ({ ping, ui }: AppState) => {
+ return { data: ping.pingHistogram, loading: ping.loading, lastRefresh: ui.lastRefresh };
+};
diff --git a/x-pack/legacy/plugins/uptime/server/graphql/monitors/resolvers.ts b/x-pack/legacy/plugins/uptime/server/graphql/monitors/resolvers.ts
index 897d67dde807e..cc5744eac6ea1 100644
--- a/x-pack/legacy/plugins/uptime/server/graphql/monitors/resolvers.ts
+++ b/x-pack/legacy/plugins/uptime/server/graphql/monitors/resolvers.ts
@@ -4,19 +4,10 @@
* you may not use this file except in compliance with the Elastic License.
*/
-import { UMGqlRange } from '../../../common/domain_types';
import { UMResolver } from '../../../common/graphql/resolver_types';
-import {
- GetFilterBarQueryArgs,
- GetMonitorChartsDataQueryArgs,
- MonitorChart,
- GetSnapshotHistogramQueryArgs,
-} from '../../../common/graphql/types';
+import { GetMonitorChartsDataQueryArgs, MonitorChart } from '../../../common/graphql/types';
import { UMServerLibs } from '../../lib/lib';
import { CreateUMGraphQLResolvers, UMContext } from '../types';
-import { HistogramResult } from '../../../common/domain_types';
-
-export type UMMonitorsResolver = UMResolver, any, UMGqlRange, UMContext>;
export type UMGetMonitorChartsResolver = UMResolver<
any | Promise,
@@ -25,49 +16,20 @@ export type UMGetMonitorChartsResolver = UMResolver<
UMContext
>;
-export type UMGetFilterBarResolver = UMResolver<
- any | Promise,
- any,
- GetFilterBarQueryArgs,
- UMContext
->;
-
-export type UMGetSnapshotHistogram = UMResolver<
- HistogramResult | Promise,
- any,
- GetSnapshotHistogramQueryArgs,
- UMContext
->;
-
export const createMonitorsResolvers: CreateUMGraphQLResolvers = (
libs: UMServerLibs
): {
Query: {
- getSnapshotHistogram: UMGetSnapshotHistogram;
getMonitorChartsData: UMGetMonitorChartsResolver;
};
} => ({
Query: {
- async getSnapshotHistogram(
- _resolver,
- { dateRangeStart, dateRangeEnd, filters, monitorId, statusFilter },
- { APICaller }
- ): Promise {
- return await libs.pings.getPingHistogram({
- callES: APICaller,
- dateRangeStart,
- dateRangeEnd,
- filters,
- monitorId,
- statusFilter,
- });
- },
async getMonitorChartsData(
_resolver,
{ monitorId, dateRangeStart, dateRangeEnd, location },
{ APICaller }
): Promise {
- return await libs.monitors.getMonitorChartsData({
+ return libs.monitors.getMonitorChartsData({
callES: APICaller,
monitorId,
dateRangeStart,
diff --git a/x-pack/legacy/plugins/uptime/server/graphql/monitors/schema.gql.ts b/x-pack/legacy/plugins/uptime/server/graphql/monitors/schema.gql.ts
index 8a86d97b4cd8e..6b8a896c4c60b 100644
--- a/x-pack/legacy/plugins/uptime/server/graphql/monitors/schema.gql.ts
+++ b/x-pack/legacy/plugins/uptime/server/graphql/monitors/schema.gql.ts
@@ -7,19 +7,6 @@
import gql from 'graphql-tag';
export const monitorsSchema = gql`
- type HistogramDataPoint {
- upCount: Int
- downCount: Int
- x: UnsignedInteger
- x0: UnsignedInteger
- y: UnsignedInteger
- }
-
- type DataPoint {
- x: UnsignedInteger
- y: Float
- }
-
"Represents a bucket of monitor status information."
type StatusData {
"The timeseries point for this status data."
@@ -93,11 +80,6 @@ export const monitorsSchema = gql`
monitors: [LatestMonitor!]
}
- type HistogramResult {
- histogram: [HistogramDataPoint]!
- interval: UnsignedInteger!
- }
-
extend type Query {
getMonitors(
dateRangeStart: String!
@@ -106,14 +88,6 @@ export const monitorsSchema = gql`
statusFilter: String
): LatestMonitorsResult
- getSnapshotHistogram(
- dateRangeStart: String!
- dateRangeEnd: String!
- filters: String
- statusFilter: String
- monitorId: String
- ): HistogramResult
-
getMonitorChartsData(
monitorId: String!
dateRangeStart: String!
diff --git a/x-pack/legacy/plugins/uptime/server/lib/adapters/framework/adapter_types.ts b/x-pack/legacy/plugins/uptime/server/lib/adapters/framework/adapter_types.ts
index 2f72081a70988..fb2052bb4c87f 100644
--- a/x-pack/legacy/plugins/uptime/server/lib/adapters/framework/adapter_types.ts
+++ b/x-pack/legacy/plugins/uptime/server/lib/adapters/framework/adapter_types.ts
@@ -8,26 +8,12 @@ import { GraphQLSchema } from 'graphql';
import { UsageCollectionSetup } from 'src/plugins/usage_collection/server';
import {
SavedObjectsLegacyService,
- RequestHandler,
IRouter,
CallAPIOptions,
SavedObjectsClientContract,
} from 'src/core/server';
-import { ObjectType } from '@kbn/config-schema';
import { UMKibanaRoute } from '../../../rest_api';
-export interface UMFrameworkRouteOptions<
- P extends ObjectType,
- Q extends ObjectType,
- B extends ObjectType
-> {
- path: string;
- method: string;
- handler: RequestHandler;
- config?: any;
- validate: any;
-}
-
type APICaller = (
endpoint: string,
clientParams: Record,
diff --git a/x-pack/legacy/plugins/uptime/server/lib/adapters/index.ts b/x-pack/legacy/plugins/uptime/server/lib/adapters/index.ts
index f5ff3b8c62ba9..fbef70f106dd8 100644
--- a/x-pack/legacy/plugins/uptime/server/lib/adapters/index.ts
+++ b/x-pack/legacy/plugins/uptime/server/lib/adapters/index.ts
@@ -8,5 +8,5 @@ export * from './framework';
export * from './monitor_states';
export * from './monitors';
export * from './pings';
-export * from './saved_objects';
+export * from './stub_index_pattern';
export * from './telemetry';
diff --git a/x-pack/legacy/plugins/uptime/server/lib/adapters/pings/__tests__/__snapshots__/elasticsearch_pings_adapter.test.ts.snap b/x-pack/legacy/plugins/uptime/server/lib/adapters/pings/__tests__/__snapshots__/elasticsearch_pings_adapter.test.ts.snap
index b73595d539e93..1b31f44557df0 100644
--- a/x-pack/legacy/plugins/uptime/server/lib/adapters/pings/__tests__/__snapshots__/elasticsearch_pings_adapter.test.ts.snap
+++ b/x-pack/legacy/plugins/uptime/server/lib/adapters/pings/__tests__/__snapshots__/elasticsearch_pings_adapter.test.ts.snap
@@ -22,7 +22,7 @@ Object {
"y": 1,
},
],
- "interval": 36000,
+ "interval": "1m",
}
`;
@@ -48,7 +48,7 @@ Object {
"y": 1,
},
],
- "interval": 5609564928000,
+ "interval": "1h",
}
`;
@@ -68,7 +68,7 @@ Object {
"y": 1,
},
],
- "interval": 5609564928000,
+ "interval": "1d",
}
`;
@@ -88,7 +88,7 @@ Object {
"y": 1,
},
],
- "interval": 5609564928000,
+ "interval": "1s",
}
`;
@@ -102,7 +102,7 @@ Object {
"y": 1,
},
],
- "interval": 36000,
+ "interval": "10s",
}
`;
@@ -122,6 +122,6 @@ Object {
"y": 1,
},
],
- "interval": 36000,
+ "interval": "1m",
}
`;
diff --git a/x-pack/legacy/plugins/uptime/server/lib/adapters/pings/__tests__/elasticsearch_pings_adapter.test.ts b/x-pack/legacy/plugins/uptime/server/lib/adapters/pings/__tests__/elasticsearch_pings_adapter.test.ts
index e1e39ac9b2637..866ab110928b4 100644
--- a/x-pack/legacy/plugins/uptime/server/lib/adapters/pings/__tests__/elasticsearch_pings_adapter.test.ts
+++ b/x-pack/legacy/plugins/uptime/server/lib/adapters/pings/__tests__/elasticsearch_pings_adapter.test.ts
@@ -5,8 +5,7 @@
*/
import { set } from 'lodash';
-import { elasticsearchPingsAdapter as adapter } from '../elasticsearch_pings_adapter';
-import { assertCloseTo } from '../../../helper';
+import { elasticsearchPingsAdapter as adapter } from '../es_pings';
describe('ElasticsearchPingsAdapter class', () => {
let mockHits: any[];
@@ -35,6 +34,7 @@ describe('ElasticsearchPingsAdapter class', () => {
},
},
],
+ interval: '1s',
},
},
};
@@ -98,12 +98,11 @@ describe('ElasticsearchPingsAdapter class', () => {
});
const result = await adapter.getPingHistogram({
callES: mockEsClient,
- dateRangeStart: 'now-15m',
- dateRangeEnd: 'now',
- filters: null,
+ dateStart: 'now-15m',
+ dateEnd: 'now',
+ filters: '',
});
- assertCloseTo(result.interval, 36000, 100);
- result.interval = 36000;
+ result.interval = '10s';
expect(mockEsClient).toHaveBeenCalledTimes(1);
expect(result).toMatchSnapshot();
});
@@ -116,12 +115,11 @@ describe('ElasticsearchPingsAdapter class', () => {
const result = await adapter.getPingHistogram({
callES: mockEsClient,
- dateRangeStart: 'now-15m',
- dateRangeEnd: 'now',
- filters: null,
+ dateStart: 'now-15m',
+ dateEnd: 'now',
+ filters: '',
});
- assertCloseTo(result.interval, 36000, 100);
- result.interval = 36000;
+ result.interval = '1m';
expect(mockEsClient).toHaveBeenCalledTimes(1);
expect(result).toMatchSnapshot();
@@ -175,14 +173,13 @@ describe('ElasticsearchPingsAdapter class', () => {
};
const result = await adapter.getPingHistogram({
callES: mockEsClient,
- dateRangeStart: '1234',
- dateRangeEnd: '5678',
+ dateStart: '1234',
+ dateEnd: '5678',
filters: JSON.stringify(searchFilter),
monitorId: undefined,
statusFilter: 'down',
});
- assertCloseTo(result.interval, 5609564928000, 1000);
- result.interval = 5609564928000;
+ result.interval = '1h';
expect(mockEsClient).toHaveBeenCalledTimes(1);
expect(result).toMatchSnapshot();
@@ -229,13 +226,12 @@ describe('ElasticsearchPingsAdapter class', () => {
const filters = `{"bool":{"must":[{"simple_query_string":{"query":"http"}}]}}`;
const result = await adapter.getPingHistogram({
callES: mockEsClient,
- dateRangeStart: 'now-15m',
- dateRangeEnd: 'now',
+ dateStart: 'now-15m',
+ dateEnd: 'now',
filters,
});
- assertCloseTo(result.interval, 36000, 100);
- result.interval = 36000;
+ result.interval = '1m';
expect(mockEsClient).toHaveBeenCalledTimes(1);
expect(result).toMatchSnapshot();
});
@@ -246,14 +242,14 @@ describe('ElasticsearchPingsAdapter class', () => {
mockEsClient.mockReturnValue(standardMockResponse);
const result = await adapter.getPingHistogram({
callES: mockEsClient,
- dateRangeStart: '1234',
- dateRangeEnd: '5678',
+ dateStart: '1234',
+ dateEnd: '5678',
filters: '',
monitorId: undefined,
statusFilter: 'down',
});
- assertCloseTo(result.interval, 5609564928000, 1000);
- result.interval = 5609564928000;
+
+ result.interval = '1d';
expect(mockEsClient).toHaveBeenCalledTimes(1);
expect(result).toMatchSnapshot();
@@ -267,8 +263,8 @@ describe('ElasticsearchPingsAdapter class', () => {
const result = await adapter.getPingHistogram({
callES: mockEsClient,
- dateRangeStart: '1234',
- dateRangeEnd: '5678',
+ dateStart: '1234',
+ dateEnd: '5678',
filters: '',
monitorId: undefined,
statusFilter: 'up',
diff --git a/x-pack/legacy/plugins/uptime/server/lib/adapters/pings/es_get_ping_historgram.ts b/x-pack/legacy/plugins/uptime/server/lib/adapters/pings/es_get_ping_historgram.ts
new file mode 100644
index 0000000000000..66cae497eb081
--- /dev/null
+++ b/x-pack/legacy/plugins/uptime/server/lib/adapters/pings/es_get_ping_historgram.ts
@@ -0,0 +1,82 @@
+/*
+ * 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 { get } from 'lodash';
+import { INDEX_NAMES, QUERY } from '../../../../common/constants';
+import { parseFilterQuery, getFilterClause } from '../../helper';
+import { UMElasticsearchQueryFn } from '../framework';
+import { GetPingHistogramParams, HistogramResult } from '../../../../common/types';
+import { HistogramQueryResult } from './types';
+
+export const esGetPingHistogram: UMElasticsearchQueryFn<
+ GetPingHistogramParams,
+ HistogramResult
+> = async ({ callES, dateStart, dateEnd, filters, monitorId, statusFilter }) => {
+ const boolFilters = parseFilterQuery(filters);
+ const additionalFilters = [];
+ if (monitorId) {
+ additionalFilters.push({ match: { 'monitor.id': monitorId } });
+ }
+ if (boolFilters) {
+ additionalFilters.push(boolFilters);
+ }
+ const filter = getFilterClause(dateStart, dateEnd, additionalFilters);
+
+ const params = {
+ index: INDEX_NAMES.HEARTBEAT,
+ body: {
+ query: {
+ bool: {
+ filter,
+ },
+ },
+ size: 0,
+ aggs: {
+ timeseries: {
+ auto_date_histogram: {
+ field: '@timestamp',
+ buckets: QUERY.DEFAULT_BUCKET_COUNT,
+ },
+ aggs: {
+ down: {
+ filter: {
+ term: {
+ 'monitor.status': 'down',
+ },
+ },
+ },
+ up: {
+ filter: {
+ term: {
+ 'monitor.status': 'up',
+ },
+ },
+ },
+ },
+ },
+ },
+ },
+ };
+
+ const result = await callES('search', params);
+ const interval = result.aggregations.timeseries?.interval;
+ const buckets: HistogramQueryResult[] = get(result, 'aggregations.timeseries.buckets', []);
+ const histogram = buckets.map(bucket => {
+ const x: number = get(bucket, 'key');
+ const downCount: number = get(bucket, 'down.doc_count');
+ const upCount: number = get(bucket, 'up.doc_count');
+ return {
+ x,
+ downCount: statusFilter && statusFilter !== 'down' ? 0 : downCount,
+ upCount: statusFilter && statusFilter !== 'up' ? 0 : upCount,
+ y: 1,
+ };
+ });
+ return {
+ histogram,
+ interval,
+ };
+};
diff --git a/x-pack/legacy/plugins/uptime/server/lib/adapters/pings/elasticsearch_pings_adapter.ts b/x-pack/legacy/plugins/uptime/server/lib/adapters/pings/es_pings.ts
similarity index 67%
rename from x-pack/legacy/plugins/uptime/server/lib/adapters/pings/elasticsearch_pings_adapter.ts
rename to x-pack/legacy/plugins/uptime/server/lib/adapters/pings/es_pings.ts
index adabffcb1ea4a..93e3a1bd9397b 100644
--- a/x-pack/legacy/plugins/uptime/server/lib/adapters/pings/elasticsearch_pings_adapter.ts
+++ b/x-pack/legacy/plugins/uptime/server/lib/adapters/pings/es_pings.ts
@@ -7,9 +7,8 @@
import { get } from 'lodash';
import { INDEX_NAMES } from '../../../../common/constants';
import { HttpBody, Ping, PingResults } from '../../../../common/graphql/types';
-import { parseFilterQuery, getFilterClause, getHistogramIntervalFormatted } from '../../helper';
-import { UMPingsAdapter, HistogramQueryResult } from './adapter_types';
-import { getHistogramInterval } from '../../helper/get_histogram_interval';
+import { UMPingsAdapter } from './types';
+import { esGetPingHistogram } from './es_get_ping_historgram';
export const elasticsearchPingsAdapter: UMPingsAdapter = {
getAll: async ({
@@ -174,80 +173,7 @@ export const elasticsearchPingsAdapter: UMPingsAdapter = {
return result.hits.hits[0]?._source;
},
- getPingHistogram: async ({
- callES,
- dateRangeStart,
- dateRangeEnd,
- filters,
- monitorId,
- statusFilter,
- }) => {
- const boolFilters = parseFilterQuery(filters);
- const additionalFilters = [];
- if (monitorId) {
- additionalFilters.push({ match: { 'monitor.id': monitorId } });
- }
- if (boolFilters) {
- additionalFilters.push(boolFilters);
- }
- const filter = getFilterClause(dateRangeStart, dateRangeEnd, additionalFilters);
- const interval = getHistogramInterval(dateRangeStart, dateRangeEnd);
- const intervalFormatted = getHistogramIntervalFormatted(dateRangeStart, dateRangeEnd);
-
- const params = {
- index: INDEX_NAMES.HEARTBEAT,
- body: {
- query: {
- bool: {
- filter,
- },
- },
- size: 0,
- aggs: {
- timeseries: {
- date_histogram: {
- field: '@timestamp',
- fixed_interval: intervalFormatted,
- },
- aggs: {
- down: {
- filter: {
- term: {
- 'monitor.status': 'down',
- },
- },
- },
- up: {
- filter: {
- term: {
- 'monitor.status': 'up',
- },
- },
- },
- },
- },
- },
- },
- };
-
- const result = await callES('search', params);
- const buckets: HistogramQueryResult[] = get(result, 'aggregations.timeseries.buckets', []);
- const histogram = buckets.map(bucket => {
- const x: number = get(bucket, 'key');
- const downCount: number = get(bucket, 'down.doc_count');
- const upCount: number = get(bucket, 'up.doc_count');
- return {
- x,
- downCount: statusFilter && statusFilter !== 'down' ? 0 : downCount,
- upCount: statusFilter && statusFilter !== 'up' ? 0 : upCount,
- y: 1,
- };
- });
- return {
- histogram,
- interval,
- };
- },
+ getPingHistogram: esGetPingHistogram,
getDocCount: async ({ callES }) => {
const { count } = await callES('count', { index: INDEX_NAMES.HEARTBEAT });
diff --git a/x-pack/legacy/plugins/uptime/server/lib/adapters/pings/index.ts b/x-pack/legacy/plugins/uptime/server/lib/adapters/pings/index.ts
index 6d93785e01527..37324a8f521f6 100644
--- a/x-pack/legacy/plugins/uptime/server/lib/adapters/pings/index.ts
+++ b/x-pack/legacy/plugins/uptime/server/lib/adapters/pings/index.ts
@@ -4,5 +4,5 @@
* you may not use this file except in compliance with the Elastic License.
*/
-export * from './adapter_types';
-export { elasticsearchPingsAdapter } from './elasticsearch_pings_adapter';
+export * from './types';
+export { elasticsearchPingsAdapter } from './es_pings';
diff --git a/x-pack/legacy/plugins/uptime/server/lib/adapters/pings/adapter_types.ts b/x-pack/legacy/plugins/uptime/server/lib/adapters/pings/types.ts
similarity index 79%
rename from x-pack/legacy/plugins/uptime/server/lib/adapters/pings/adapter_types.ts
rename to x-pack/legacy/plugins/uptime/server/lib/adapters/pings/types.ts
index 8b2a49c0c9ffe..b1b1589af2ca7 100644
--- a/x-pack/legacy/plugins/uptime/server/lib/adapters/pings/adapter_types.ts
+++ b/x-pack/legacy/plugins/uptime/server/lib/adapters/pings/types.ts
@@ -5,8 +5,8 @@
*/
import { DocCount, Ping, PingResults } from '../../../../common/graphql/types';
-import { HistogramResult } from '../../../../common/domain_types';
import { UMElasticsearchQueryFn } from '../framework';
+import { GetPingHistogramParams, HistogramResult } from '../../../../common/types';
export interface GetAllParams {
/** @member dateRangeStart timestamp bounds */
@@ -42,19 +42,6 @@ export interface GetLatestMonitorDocsParams {
monitorId?: string | null;
}
-export interface GetPingHistogramParams {
- /** @member dateRangeStart timestamp bounds */
- dateRangeStart: string;
- /** @member dateRangeEnd timestamp bounds */
- dateRangeEnd: string;
- /** @member filters user-defined filters */
- filters?: string | null;
- /** @member monitorId optional limit to monitorId */
- monitorId?: string | null;
- /** @member statusFilter special filter targeting the latest status of each monitor */
- statusFilter?: string | null;
-}
-
/**
* Count the number of documents in heartbeat indices
*/
diff --git a/x-pack/legacy/plugins/uptime/server/lib/adapters/saved_objects/heartbeat_index_pattern.json b/x-pack/legacy/plugins/uptime/server/lib/adapters/saved_objects/heartbeat_index_pattern.json
deleted file mode 100644
index 444c7510c6a6d..0000000000000
--- a/x-pack/legacy/plugins/uptime/server/lib/adapters/saved_objects/heartbeat_index_pattern.json
+++ /dev/null
@@ -1,13 +0,0 @@
-{
- "attributes": {
- "fields": "[{\"name\":\"@timestamp\",\"type\":\"date\",\"esTypes\":[\"date\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"_id\",\"type\":\"string\",\"esTypes\":[\"_id\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":false},{\"name\":\"_index\",\"type\":\"string\",\"esTypes\":[\"_index\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":false},{\"name\":\"_score\",\"type\":\"number\",\"count\":0,\"scripted\":false,\"searchable\":false,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"_source\",\"type\":\"_source\",\"esTypes\":[\"_source\"],\"count\":0,\"scripted\":false,\"searchable\":false,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"_type\",\"type\":\"string\",\"esTypes\":[\"_type\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":false},{\"name\":\"agent.ephemeral_id\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"agent.hostname\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"agent.id\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"agent.name\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"agent.type\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"agent.version\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"client.address\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"client.bytes\",\"type\":\"number\",\"esTypes\":[\"long\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"client.domain\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"client.geo.city_name\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"client.geo.continent_name\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"client.geo.country_iso_code\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"client.geo.country_name\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"client.geo.location\",\"type\":\"geo_point\",\"esTypes\":[\"geo_point\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"client.geo.name\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"client.geo.region_iso_code\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"client.geo.region_name\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"client.ip\",\"type\":\"ip\",\"esTypes\":[\"ip\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"client.mac\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"client.packets\",\"type\":\"number\",\"esTypes\":[\"long\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"client.port\",\"type\":\"number\",\"esTypes\":[\"long\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"client.user.email\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"client.user.full_name\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"client.user.group.id\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"client.user.group.name\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"client.user.hash\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"client.user.id\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"client.user.name\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"cloud.account.id\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"cloud.availability_zone\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"cloud.image.id\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"cloud.instance.id\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"cloud.instance.name\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"cloud.machine.type\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"cloud.project.id\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"cloud.provider\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"cloud.region\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"container.id\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"container.image.name\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"container.image.tag\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"container.name\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"container.runtime\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"destination.address\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"destination.bytes\",\"type\":\"number\",\"esTypes\":[\"long\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"destination.domain\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"destination.geo.city_name\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"destination.geo.continent_name\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"destination.geo.country_iso_code\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"destination.geo.country_name\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"destination.geo.location\",\"type\":\"geo_point\",\"esTypes\":[\"geo_point\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"destination.geo.name\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"destination.geo.region_iso_code\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"destination.geo.region_name\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"destination.ip\",\"type\":\"ip\",\"esTypes\":[\"ip\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"destination.mac\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"destination.packets\",\"type\":\"number\",\"esTypes\":[\"long\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"destination.port\",\"type\":\"number\",\"esTypes\":[\"long\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"destination.user.email\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"destination.user.full_name\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"destination.user.group.id\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"destination.user.group.name\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"destination.user.hash\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"destination.user.id\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"destination.user.name\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"ecs.version\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"error.code\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"error.id\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"error.message\",\"type\":\"string\",\"esTypes\":[\"text\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"error.type\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"event.action\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"event.category\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"event.created\",\"type\":\"date\",\"esTypes\":[\"date\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"event.dataset\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"event.duration\",\"type\":\"number\",\"esTypes\":[\"long\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"event.end\",\"type\":\"date\",\"esTypes\":[\"date\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"event.hash\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"event.id\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"event.kind\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"event.module\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"event.original\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"event.outcome\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"event.risk_score\",\"type\":\"number\",\"esTypes\":[\"float\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"event.risk_score_norm\",\"type\":\"number\",\"esTypes\":[\"float\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"event.severity\",\"type\":\"number\",\"esTypes\":[\"long\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"event.start\",\"type\":\"date\",\"esTypes\":[\"date\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"event.timezone\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"event.type\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"file.ctime\",\"type\":\"date\",\"esTypes\":[\"date\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"file.device\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"file.extension\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"file.gid\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"file.group\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"file.inode\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"file.mode\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"file.mtime\",\"type\":\"date\",\"esTypes\":[\"date\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"file.owner\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"file.path\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"file.size\",\"type\":\"number\",\"esTypes\":[\"long\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"file.target_path\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"file.type\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"file.uid\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"geo.city_name\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"geo.continent_name\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"geo.country_iso_code\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"geo.country_name\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"geo.location\",\"type\":\"geo_point\",\"esTypes\":[\"geo_point\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"geo.name\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"geo.region_iso_code\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"geo.region_name\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"group.id\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"group.name\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"host.architecture\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"host.containerized\",\"type\":\"boolean\",\"esTypes\":[\"boolean\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"host.geo.city_name\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"host.geo.continent_name\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"host.geo.country_iso_code\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"host.geo.country_name\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"host.geo.location\",\"type\":\"geo_point\",\"esTypes\":[\"geo_point\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"host.geo.name\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"host.geo.region_iso_code\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"host.geo.region_name\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"host.hostname\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"host.id\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"host.ip\",\"type\":\"ip\",\"esTypes\":[\"ip\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"host.mac\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"host.name\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"host.os.build\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"host.os.codename\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"host.os.family\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"host.os.full\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"host.os.kernel\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"host.os.name\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"host.os.platform\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"host.os.version\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"host.type\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"host.user.email\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"host.user.full_name\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"host.user.group.id\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"host.user.group.name\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"host.user.hash\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"host.user.id\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"host.user.name\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"http.request.body.bytes\",\"type\":\"number\",\"esTypes\":[\"long\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"http.request.body.content\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"http.request.bytes\",\"type\":\"number\",\"esTypes\":[\"long\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"http.request.method\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"http.request.referrer\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"http.response.body.bytes\",\"type\":\"number\",\"esTypes\":[\"long\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"http.response.body.content\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"http.response.bytes\",\"type\":\"number\",\"esTypes\":[\"long\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"http.response.status_code\",\"type\":\"number\",\"esTypes\":[\"long\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"http.rtt.content.us\",\"type\":\"number\",\"esTypes\":[\"long\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"http.rtt.response_header.us\",\"type\":\"number\",\"esTypes\":[\"long\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"http.rtt.total.us\",\"type\":\"number\",\"esTypes\":[\"long\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"http.rtt.validate.us\",\"type\":\"number\",\"esTypes\":[\"long\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"http.rtt.validate_body.us\",\"type\":\"number\",\"esTypes\":[\"long\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"http.rtt.write_request.us\",\"type\":\"number\",\"esTypes\":[\"long\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"http.version\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"icmp.requests\",\"type\":\"number\",\"esTypes\":[\"long\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"icmp.rtt.us\",\"type\":\"number\",\"esTypes\":[\"long\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"jolokia.agent.id\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"jolokia.agent.version\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"jolokia.secured\",\"type\":\"boolean\",\"esTypes\":[\"boolean\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"jolokia.server.product\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"jolokia.server.vendor\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"jolokia.server.version\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"jolokia.url\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"kubernetes.container.image\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"kubernetes.container.name\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"kubernetes.deployment.name\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"kubernetes.namespace\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"kubernetes.node.name\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"kubernetes.pod.name\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"kubernetes.pod.uid\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"kubernetes.replicaset.name\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"kubernetes.statefulset.name\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"log.level\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"log.original\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"message\",\"type\":\"string\",\"esTypes\":[\"text\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"monitor.check_group\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"monitor.duration.us\",\"type\":\"number\",\"esTypes\":[\"long\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"monitor.id\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"monitor.ip\",\"type\":\"ip\",\"esTypes\":[\"ip\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"monitor.name\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"monitor.type\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"network.application\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"network.bytes\",\"type\":\"number\",\"esTypes\":[\"long\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"network.community_id\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"network.direction\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"network.forwarded_ip\",\"type\":\"ip\",\"esTypes\":[\"ip\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"network.iana_number\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"network.name\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"network.packets\",\"type\":\"number\",\"esTypes\":[\"long\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"network.protocol\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"network.transport\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"network.type\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"observer.geo.city_name\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"observer.geo.continent_name\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"observer.geo.country_iso_code\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"observer.geo.country_name\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"observer.geo.location\",\"type\":\"geo_point\",\"esTypes\":[\"geo_point\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"observer.geo.name\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"observer.geo.region_iso_code\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"observer.geo.region_name\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"observer.hostname\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"observer.ip\",\"type\":\"ip\",\"esTypes\":[\"ip\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"observer.mac\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"observer.os.family\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"observer.os.full\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"observer.os.kernel\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"observer.os.name\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"observer.os.platform\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"observer.os.version\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"observer.serial_number\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"observer.type\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"observer.vendor\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"observer.version\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"organization.id\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"organization.name\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"os.family\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"os.full\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"os.kernel\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"os.name\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"os.platform\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"os.version\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"process.args\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"process.executable\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"process.name\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"process.pid\",\"type\":\"number\",\"esTypes\":[\"long\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"process.ppid\",\"type\":\"number\",\"esTypes\":[\"long\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"process.start\",\"type\":\"date\",\"esTypes\":[\"date\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"process.thread.id\",\"type\":\"number\",\"esTypes\":[\"long\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"process.title\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"process.working_directory\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"related.ip\",\"type\":\"ip\",\"esTypes\":[\"ip\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"resolve.ip\",\"type\":\"ip\",\"esTypes\":[\"ip\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"resolve.rtt.us\",\"type\":\"number\",\"esTypes\":[\"long\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"server.address\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"server.bytes\",\"type\":\"number\",\"esTypes\":[\"long\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"server.domain\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"server.geo.city_name\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"server.geo.continent_name\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"server.geo.country_iso_code\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"server.geo.country_name\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"server.geo.location\",\"type\":\"geo_point\",\"esTypes\":[\"geo_point\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"server.geo.name\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"server.geo.region_iso_code\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"server.geo.region_name\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"server.ip\",\"type\":\"ip\",\"esTypes\":[\"ip\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"server.mac\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"server.packets\",\"type\":\"number\",\"esTypes\":[\"long\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"server.port\",\"type\":\"number\",\"esTypes\":[\"long\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"server.user.email\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"server.user.full_name\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"server.user.group.id\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"server.user.group.name\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"server.user.hash\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"server.user.id\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"server.user.name\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"service.ephemeral_id\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"service.id\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"service.name\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"service.state\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"service.type\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"service.version\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"socks5.rtt.connect.us\",\"type\":\"number\",\"esTypes\":[\"long\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"source.address\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"source.bytes\",\"type\":\"number\",\"esTypes\":[\"long\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"source.domain\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"source.geo.city_name\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"source.geo.continent_name\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"source.geo.country_iso_code\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"source.geo.country_name\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"source.geo.location\",\"type\":\"geo_point\",\"esTypes\":[\"geo_point\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"source.geo.name\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"source.geo.region_iso_code\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"source.geo.region_name\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"source.ip\",\"type\":\"ip\",\"esTypes\":[\"ip\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"source.mac\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"source.packets\",\"type\":\"number\",\"esTypes\":[\"long\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"source.port\",\"type\":\"number\",\"esTypes\":[\"long\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"source.user.email\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"source.user.full_name\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"source.user.group.id\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"source.user.group.name\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"source.user.hash\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"source.user.id\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"source.user.name\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"summary.down\",\"type\":\"number\",\"esTypes\":[\"long\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"summary.up\",\"type\":\"number\",\"esTypes\":[\"long\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"tags\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"tcp.rtt.connect.us\",\"type\":\"number\",\"esTypes\":[\"long\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"tcp.rtt.validate.us\",\"type\":\"number\",\"esTypes\":[\"long\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"timeseries.instance\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"tls.certificate_not_valid_after\",\"type\":\"date\",\"esTypes\":[\"date\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"tls.certificate_not_valid_before\",\"type\":\"date\",\"esTypes\":[\"date\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"tls.rtt.handshake.us\",\"type\":\"number\",\"esTypes\":[\"long\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"url.domain\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"url.fragment\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"url.full\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"url.original\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"url.password\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"url.path\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"url.port\",\"type\":\"number\",\"esTypes\":[\"long\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"url.query\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"url.scheme\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"url.username\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"user.email\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"user.full_name\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"user.group.id\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"user.group.name\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"user.hash\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"user.id\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"user.name\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"user_agent.device.name\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"user_agent.name\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"user_agent.original\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"user_agent.os.family\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"user_agent.os.full\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"user_agent.os.kernel\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"user_agent.os.name\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"user_agent.os.platform\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"user_agent.os.version\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"user_agent.version\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true}]",
- "timeFieldName": "@timestamp",
- "title": "heartbeat-8*"
- },
- "id": "heartbeat-8*",
- "migrationVersion": { "index-pattern": "6.5.0" },
- "references": [],
- "type": "index-pattern",
- "updated_at": "2019-08-20T17:45:34.286Z",
- "version": "1"
-}
diff --git a/x-pack/legacy/plugins/uptime/server/lib/adapters/saved_objects/kibana_saved_objects_adapter.ts b/x-pack/legacy/plugins/uptime/server/lib/adapters/saved_objects/kibana_saved_objects_adapter.ts
deleted file mode 100644
index 7628c5bac0660..0000000000000
--- a/x-pack/legacy/plugins/uptime/server/lib/adapters/saved_objects/kibana_saved_objects_adapter.ts
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * 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 { UMSavedObjectsAdapter } from './types';
-import uptimeIndexPattern from './heartbeat_index_pattern.json';
-
-export const savedObjectsAdapter: UMSavedObjectsAdapter = {
- getUptimeIndexPattern: async client => {
- try {
- return await client.get('index-pattern', uptimeIndexPattern.id);
- } catch (error) {
- return await client.create(
- 'index-pattern',
- {
- ...uptimeIndexPattern.attributes,
- title: 'UptimeIndexPattern',
- },
- { id: uptimeIndexPattern.id, overwrite: false }
- );
- }
- },
-};
diff --git a/x-pack/legacy/plugins/uptime/server/lib/adapters/saved_objects/types.ts b/x-pack/legacy/plugins/uptime/server/lib/adapters/stub_index_pattern/index.ts
similarity index 62%
rename from x-pack/legacy/plugins/uptime/server/lib/adapters/saved_objects/types.ts
rename to x-pack/legacy/plugins/uptime/server/lib/adapters/stub_index_pattern/index.ts
index 0fef1e1428e97..4ef6e3fa8a6bd 100644
--- a/x-pack/legacy/plugins/uptime/server/lib/adapters/saved_objects/types.ts
+++ b/x-pack/legacy/plugins/uptime/server/lib/adapters/stub_index_pattern/index.ts
@@ -4,8 +4,4 @@
* you may not use this file except in compliance with the Elastic License.
*/
-import { UMSavedObjectsQueryFn } from '../framework';
-
-export interface UMSavedObjectsAdapter {
- getUptimeIndexPattern: UMSavedObjectsQueryFn;
-}
+export { StubIndexPatternAdapter, stubIndexPatternAdapter } from './stub_index_pattern';
diff --git a/x-pack/legacy/plugins/uptime/server/lib/adapters/stub_index_pattern/stub_index_pattern.ts b/x-pack/legacy/plugins/uptime/server/lib/adapters/stub_index_pattern/stub_index_pattern.ts
new file mode 100644
index 0000000000000..49ec86af25040
--- /dev/null
+++ b/x-pack/legacy/plugins/uptime/server/lib/adapters/stub_index_pattern/stub_index_pattern.ts
@@ -0,0 +1,54 @@
+/*
+ * 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 { APICaller } from 'kibana/server';
+import {
+ IndexPatternsFetcher,
+ IIndexPattern,
+} from '../../../../../../../../src/plugins/data/server';
+import { INDEX_NAMES } from '../../../../common/constants';
+import { UMElasticsearchQueryFn } from '../framework';
+
+export interface StubIndexPatternAdapter {
+ getUptimeIndexPattern: UMElasticsearchQueryFn;
+}
+
+export const stubIndexPatternAdapter: StubIndexPatternAdapter = {
+ getUptimeIndexPattern: async callES => {
+ const indexPatternsFetcher = new IndexPatternsFetcher((...rest: Parameters) =>
+ callES(...rest)
+ );
+
+ // Since `getDynamicIndexPattern` is called in setup_request (and thus by every endpoint)
+ // and since `getFieldsForWildcard` will throw if the specified indices don't exist,
+ // we have to catch errors here to avoid all endpoints returning 500 for users without APM data
+ // (would be a bad first time experience)
+ try {
+ const fields = await indexPatternsFetcher.getFieldsForWildcard({
+ pattern: INDEX_NAMES.HEARTBEAT,
+ });
+
+ const indexPattern: IIndexPattern = {
+ fields,
+ title: INDEX_NAMES.HEARTBEAT,
+ };
+
+ return indexPattern;
+ } catch (e) {
+ const notExists = e.output?.statusCode === 404;
+ if (notExists) {
+ // eslint-disable-next-line no-console
+ console.error(
+ `Could not get dynamic index pattern because indices "${INDEX_NAMES.HEARTBEAT}" don't exist`
+ );
+ return;
+ }
+
+ // re-throw
+ throw e;
+ }
+ },
+};
diff --git a/x-pack/legacy/plugins/uptime/server/lib/compose/kibana.ts b/x-pack/legacy/plugins/uptime/server/lib/compose/kibana.ts
index cc11bf90da5f3..b44a890de3819 100644
--- a/x-pack/legacy/plugins/uptime/server/lib/compose/kibana.ts
+++ b/x-pack/legacy/plugins/uptime/server/lib/compose/kibana.ts
@@ -10,7 +10,7 @@ import { elasticsearchPingsAdapter } from '../adapters/pings';
import { licenseCheck } from '../domains';
import { UMDomainLibs, UMServerLibs } from '../lib';
import { elasticsearchMonitorStatesAdapter } from '../adapters/monitor_states';
-import { savedObjectsAdapter } from '../adapters/saved_objects';
+import { stubIndexPatternAdapter } from '../adapters/stub_index_pattern';
import { UptimeCorePlugins, UptimeCoreSetup } from '../adapters/framework';
export function compose(server: UptimeCoreSetup, plugins: UptimeCorePlugins): UMServerLibs {
@@ -21,7 +21,7 @@ export function compose(server: UptimeCoreSetup, plugins: UptimeCorePlugins): UM
monitors: elasticsearchMonitorsAdapter,
monitorStates: elasticsearchMonitorStatesAdapter,
pings: elasticsearchPingsAdapter,
- savedObjects: savedObjectsAdapter,
+ stubIndexPattern: stubIndexPatternAdapter,
};
return {
diff --git a/x-pack/legacy/plugins/uptime/server/lib/helper/assert_close_to.ts b/x-pack/legacy/plugins/uptime/server/lib/helper/assert_close_to.ts
index 13b6f3688809c..45b76ba25470b 100644
--- a/x-pack/legacy/plugins/uptime/server/lib/helper/assert_close_to.ts
+++ b/x-pack/legacy/plugins/uptime/server/lib/helper/assert_close_to.ts
@@ -8,4 +8,9 @@ export const assertCloseTo = (actual: number, expected: number, precision: numbe
if (Math.abs(expected - actual) > precision) {
throw new Error(`expected [${expected}] to be within ${precision} of ${actual}`);
}
+
+ // if actual is undefined above math condition will be NAN and it will be always false
+ if (actual === undefined) {
+ throw new Error(`expected close to [${expected}] but got [${actual}]`);
+ }
};
diff --git a/x-pack/legacy/plugins/uptime/server/lib/helper/index.ts b/x-pack/legacy/plugins/uptime/server/lib/helper/index.ts
index f9a8de81332d5..eae8023b66ff4 100644
--- a/x-pack/legacy/plugins/uptime/server/lib/helper/index.ts
+++ b/x-pack/legacy/plugins/uptime/server/lib/helper/index.ts
@@ -5,7 +5,6 @@
*/
export { getFilterClause } from './get_filter_clause';
-export { getHistogramInterval } from './get_histogram_interval';
export { getHistogramIntervalFormatted } from './get_histogram_interval_formatted';
export { parseFilterQuery } from './parse_filter_query';
export { assertCloseTo } from './assert_close_to';
diff --git a/x-pack/legacy/plugins/uptime/server/lib/lib.ts b/x-pack/legacy/plugins/uptime/server/lib/lib.ts
index da87c3ebfe301..e5ab9940d482d 100644
--- a/x-pack/legacy/plugins/uptime/server/lib/lib.ts
+++ b/x-pack/legacy/plugins/uptime/server/lib/lib.ts
@@ -9,7 +9,7 @@ import {
UMMonitorsAdapter,
UMMonitorStatesAdapter,
UMPingsAdapter,
- UMSavedObjectsAdapter,
+ StubIndexPatternAdapter,
} from './adapters';
import { UMLicenseCheck } from './domains';
@@ -18,7 +18,7 @@ export interface UMDomainLibs {
monitors: UMMonitorsAdapter;
monitorStates: UMMonitorStatesAdapter;
pings: UMPingsAdapter;
- savedObjects: UMSavedObjectsAdapter;
+ stubIndexPattern: StubIndexPatternAdapter;
}
export interface UMServerLibs extends UMDomainLibs {
diff --git a/x-pack/legacy/plugins/uptime/server/rest_api/index.ts b/x-pack/legacy/plugins/uptime/server/rest_api/index.ts
index e64b317e67f98..91936b499d8e6 100644
--- a/x-pack/legacy/plugins/uptime/server/rest_api/index.ts
+++ b/x-pack/legacy/plugins/uptime/server/rest_api/index.ts
@@ -16,6 +16,7 @@ import {
createGetMonitorLocationsRoute,
createGetStatusBarRoute,
} from './monitors';
+import { createGetPingHistogramRoute } from './pings/get_ping_histogram';
export * from './types';
export { createRouteWithAuth } from './create_route_with_auth';
@@ -31,4 +32,5 @@ export const restApiRoutes: UMRestApiRouteFactory[] = [
createGetSnapshotCount,
createLogMonitorPageRoute,
createLogOverviewPageRoute,
+ createGetPingHistogramRoute,
];
diff --git a/x-pack/legacy/plugins/uptime/server/rest_api/index_pattern/get_index_pattern.ts b/x-pack/legacy/plugins/uptime/server/rest_api/index_pattern/get_index_pattern.ts
index f061307807a42..cee8eaf3f9cae 100644
--- a/x-pack/legacy/plugins/uptime/server/rest_api/index_pattern/get_index_pattern.ts
+++ b/x-pack/legacy/plugins/uptime/server/rest_api/index_pattern/get_index_pattern.ts
@@ -14,11 +14,11 @@ export const createGetIndexPatternRoute: UMRestApiRouteFactory = (libs: UMServer
options: {
tags: ['access:uptime'],
},
- handler: async ({ savedObjectsClient: client }, _context, _request, response): Promise => {
+ handler: async ({ callES }, _context, _request, response): Promise => {
try {
return response.ok({
body: {
- ...(await libs.savedObjects.getUptimeIndexPattern(client, undefined)),
+ ...(await libs.stubIndexPattern.getUptimeIndexPattern(callES)),
},
});
} catch (e) {
diff --git a/x-pack/legacy/plugins/uptime/server/rest_api/pings/get_ping_histogram.ts b/x-pack/legacy/plugins/uptime/server/rest_api/pings/get_ping_histogram.ts
new file mode 100644
index 0000000000000..c8eb2a1e40ad4
--- /dev/null
+++ b/x-pack/legacy/plugins/uptime/server/rest_api/pings/get_ping_histogram.ts
@@ -0,0 +1,44 @@
+/*
+ * 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 { schema } from '@kbn/config-schema';
+import { UMServerLibs } from '../../lib/lib';
+import { UMRestApiRouteFactory } from '../types';
+
+export const createGetPingHistogramRoute: UMRestApiRouteFactory = (libs: UMServerLibs) => ({
+ method: 'GET',
+ path: '/api/uptime/ping/histogram',
+ validate: {
+ query: schema.object({
+ dateStart: schema.string(),
+ dateEnd: schema.string(),
+ monitorId: schema.maybe(schema.string()),
+ statusFilter: schema.maybe(schema.string()),
+ filters: schema.maybe(schema.string()),
+ }),
+ },
+ options: {
+ tags: ['access:uptime'],
+ },
+ handler: async ({ callES }, _context, request, response): Promise => {
+ const { dateStart, dateEnd, statusFilter, monitorId, filters } = request.query;
+
+ const result = await libs.pings.getPingHistogram({
+ callES,
+ dateStart,
+ dateEnd,
+ monitorId,
+ statusFilter,
+ filters,
+ });
+
+ return response.ok({
+ body: {
+ ...result,
+ },
+ });
+ },
+});
diff --git a/x-pack/plugins/console_extensions/kibana.json b/x-pack/plugins/console_extensions/kibana.json
new file mode 100644
index 0000000000000..9411523d3f6dd
--- /dev/null
+++ b/x-pack/plugins/console_extensions/kibana.json
@@ -0,0 +1,8 @@
+{
+ "id": "consoleExtensions",
+ "version": "1.0.0",
+ "kibanaVersion": "kibana",
+ "requiredPlugins": ["console"],
+ "server": true,
+ "ui": false
+}
diff --git a/x-pack/legacy/plugins/uptime/public/lib/helper/to_static_index_pattern.ts b/x-pack/plugins/console_extensions/server/config.ts
similarity index 56%
rename from x-pack/legacy/plugins/uptime/public/lib/helper/to_static_index_pattern.ts
rename to x-pack/plugins/console_extensions/server/config.ts
index b8a12c1e578e3..c429e0fce13fa 100644
--- a/x-pack/legacy/plugins/uptime/public/lib/helper/to_static_index_pattern.ts
+++ b/x-pack/plugins/console_extensions/server/config.ts
@@ -3,9 +3,10 @@
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
+import { schema, TypeOf } from '@kbn/config-schema';
-export const toStaticIndexPattern = (indexPattern: any) => ({
- ...indexPattern,
- fields: JSON.parse(indexPattern.attributes.fields),
- title: indexPattern.id,
+export type ConfigType = TypeOf;
+
+export const config = schema.object({
+ enabled: schema.boolean({ defaultValue: true }),
});
diff --git a/x-pack/plugins/console_extensions/server/index.ts b/x-pack/plugins/console_extensions/server/index.ts
new file mode 100644
index 0000000000000..7fc16d4507da9
--- /dev/null
+++ b/x-pack/plugins/console_extensions/server/index.ts
@@ -0,0 +1,15 @@
+/*
+ * 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 { PluginInitializerContext, PluginConfigDescriptor } from 'kibana/server';
+
+import { config as configSchema, ConfigType } from './config';
+import { ConsoleExtensionsServerPlugin } from './plugin';
+
+export const plugin = (ctx: PluginInitializerContext) => new ConsoleExtensionsServerPlugin(ctx);
+
+export const config: PluginConfigDescriptor = {
+ schema: configSchema,
+};
diff --git a/x-pack/plugins/console_extensions/server/plugin.ts b/x-pack/plugins/console_extensions/server/plugin.ts
new file mode 100644
index 0000000000000..f4c41aa0a0ad5
--- /dev/null
+++ b/x-pack/plugins/console_extensions/server/plugin.ts
@@ -0,0 +1,32 @@
+/*
+ * 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 { join } from 'path';
+import { CoreSetup, Logger, Plugin, PluginInitializerContext } from 'kibana/server';
+
+import { ConsoleSetup } from '../../../../src/plugins/console/server';
+
+import { processors } from './spec/ingest/index';
+
+interface SetupDependencies {
+ console: ConsoleSetup;
+}
+
+export class ConsoleExtensionsServerPlugin implements Plugin {
+ log: Logger;
+ constructor(private readonly ctx: PluginInitializerContext) {
+ this.log = this.ctx.logger.get();
+ }
+
+ setup(
+ core: CoreSetup,
+ { console: { addProcessorDefinition, addExtensionSpecFilePath } }: SetupDependencies
+ ) {
+ addExtensionSpecFilePath(join(__dirname, 'spec/'));
+ processors.forEach(processor => addProcessorDefinition(processor));
+ this.log.debug('Installed console autocomplete extensions.');
+ }
+ start() {}
+}
diff --git a/x-pack/legacy/plugins/console_extensions/spec/generated/ccr.delete_auto_follow_pattern.json b/x-pack/plugins/console_extensions/server/spec/generated/ccr.delete_auto_follow_pattern.json
similarity index 100%
rename from x-pack/legacy/plugins/console_extensions/spec/generated/ccr.delete_auto_follow_pattern.json
rename to x-pack/plugins/console_extensions/server/spec/generated/ccr.delete_auto_follow_pattern.json
diff --git a/x-pack/legacy/plugins/console_extensions/spec/generated/ccr.follow.json b/x-pack/plugins/console_extensions/server/spec/generated/ccr.follow.json
similarity index 100%
rename from x-pack/legacy/plugins/console_extensions/spec/generated/ccr.follow.json
rename to x-pack/plugins/console_extensions/server/spec/generated/ccr.follow.json
diff --git a/x-pack/legacy/plugins/console_extensions/spec/generated/ccr.follow_info.json b/x-pack/plugins/console_extensions/server/spec/generated/ccr.follow_info.json
similarity index 100%
rename from x-pack/legacy/plugins/console_extensions/spec/generated/ccr.follow_info.json
rename to x-pack/plugins/console_extensions/server/spec/generated/ccr.follow_info.json
diff --git a/x-pack/legacy/plugins/console_extensions/spec/generated/ccr.follow_stats.json b/x-pack/plugins/console_extensions/server/spec/generated/ccr.follow_stats.json
similarity index 100%
rename from x-pack/legacy/plugins/console_extensions/spec/generated/ccr.follow_stats.json
rename to x-pack/plugins/console_extensions/server/spec/generated/ccr.follow_stats.json
diff --git a/x-pack/legacy/plugins/console_extensions/spec/generated/ccr.forget_follower.json b/x-pack/plugins/console_extensions/server/spec/generated/ccr.forget_follower.json
similarity index 100%
rename from x-pack/legacy/plugins/console_extensions/spec/generated/ccr.forget_follower.json
rename to x-pack/plugins/console_extensions/server/spec/generated/ccr.forget_follower.json
diff --git a/x-pack/legacy/plugins/console_extensions/spec/generated/ccr.get_auto_follow_pattern.json b/x-pack/plugins/console_extensions/server/spec/generated/ccr.get_auto_follow_pattern.json
similarity index 100%
rename from x-pack/legacy/plugins/console_extensions/spec/generated/ccr.get_auto_follow_pattern.json
rename to x-pack/plugins/console_extensions/server/spec/generated/ccr.get_auto_follow_pattern.json
diff --git a/x-pack/legacy/plugins/console_extensions/spec/generated/ccr.pause_auto_follow_pattern.json b/x-pack/plugins/console_extensions/server/spec/generated/ccr.pause_auto_follow_pattern.json
similarity index 100%
rename from x-pack/legacy/plugins/console_extensions/spec/generated/ccr.pause_auto_follow_pattern.json
rename to x-pack/plugins/console_extensions/server/spec/generated/ccr.pause_auto_follow_pattern.json
diff --git a/x-pack/legacy/plugins/console_extensions/spec/generated/ccr.pause_follow.json b/x-pack/plugins/console_extensions/server/spec/generated/ccr.pause_follow.json
similarity index 100%
rename from x-pack/legacy/plugins/console_extensions/spec/generated/ccr.pause_follow.json
rename to x-pack/plugins/console_extensions/server/spec/generated/ccr.pause_follow.json
diff --git a/x-pack/legacy/plugins/console_extensions/spec/generated/ccr.put_auto_follow_pattern.json b/x-pack/plugins/console_extensions/server/spec/generated/ccr.put_auto_follow_pattern.json
similarity index 100%
rename from x-pack/legacy/plugins/console_extensions/spec/generated/ccr.put_auto_follow_pattern.json
rename to x-pack/plugins/console_extensions/server/spec/generated/ccr.put_auto_follow_pattern.json
diff --git a/x-pack/legacy/plugins/console_extensions/spec/generated/ccr.resume_auto_follow_pattern.json b/x-pack/plugins/console_extensions/server/spec/generated/ccr.resume_auto_follow_pattern.json
similarity index 100%
rename from x-pack/legacy/plugins/console_extensions/spec/generated/ccr.resume_auto_follow_pattern.json
rename to x-pack/plugins/console_extensions/server/spec/generated/ccr.resume_auto_follow_pattern.json
diff --git a/x-pack/legacy/plugins/console_extensions/spec/generated/ccr.resume_follow.json b/x-pack/plugins/console_extensions/server/spec/generated/ccr.resume_follow.json
similarity index 100%
rename from x-pack/legacy/plugins/console_extensions/spec/generated/ccr.resume_follow.json
rename to x-pack/plugins/console_extensions/server/spec/generated/ccr.resume_follow.json
diff --git a/x-pack/legacy/plugins/console_extensions/spec/generated/ccr.stats.json b/x-pack/plugins/console_extensions/server/spec/generated/ccr.stats.json
similarity index 100%
rename from x-pack/legacy/plugins/console_extensions/spec/generated/ccr.stats.json
rename to x-pack/plugins/console_extensions/server/spec/generated/ccr.stats.json
diff --git a/x-pack/legacy/plugins/console_extensions/spec/generated/ccr.unfollow.json b/x-pack/plugins/console_extensions/server/spec/generated/ccr.unfollow.json
similarity index 100%
rename from x-pack/legacy/plugins/console_extensions/spec/generated/ccr.unfollow.json
rename to x-pack/plugins/console_extensions/server/spec/generated/ccr.unfollow.json
diff --git a/x-pack/legacy/plugins/console_extensions/spec/generated/enrich.delete_policy.json b/x-pack/plugins/console_extensions/server/spec/generated/enrich.delete_policy.json
similarity index 100%
rename from x-pack/legacy/plugins/console_extensions/spec/generated/enrich.delete_policy.json
rename to x-pack/plugins/console_extensions/server/spec/generated/enrich.delete_policy.json
diff --git a/x-pack/legacy/plugins/console_extensions/spec/generated/enrich.execute_policy.json b/x-pack/plugins/console_extensions/server/spec/generated/enrich.execute_policy.json
similarity index 100%
rename from x-pack/legacy/plugins/console_extensions/spec/generated/enrich.execute_policy.json
rename to x-pack/plugins/console_extensions/server/spec/generated/enrich.execute_policy.json
diff --git a/x-pack/legacy/plugins/console_extensions/spec/generated/enrich.get_policy.json b/x-pack/plugins/console_extensions/server/spec/generated/enrich.get_policy.json
similarity index 100%
rename from x-pack/legacy/plugins/console_extensions/spec/generated/enrich.get_policy.json
rename to x-pack/plugins/console_extensions/server/spec/generated/enrich.get_policy.json
diff --git a/x-pack/legacy/plugins/console_extensions/spec/generated/enrich.put_policy.json b/x-pack/plugins/console_extensions/server/spec/generated/enrich.put_policy.json
similarity index 100%
rename from x-pack/legacy/plugins/console_extensions/spec/generated/enrich.put_policy.json
rename to x-pack/plugins/console_extensions/server/spec/generated/enrich.put_policy.json
diff --git a/x-pack/legacy/plugins/console_extensions/spec/generated/enrich.stats.json b/x-pack/plugins/console_extensions/server/spec/generated/enrich.stats.json
similarity index 100%
rename from x-pack/legacy/plugins/console_extensions/spec/generated/enrich.stats.json
rename to x-pack/plugins/console_extensions/server/spec/generated/enrich.stats.json
diff --git a/x-pack/legacy/plugins/console_extensions/spec/generated/graph.explore.json b/x-pack/plugins/console_extensions/server/spec/generated/graph.explore.json
similarity index 100%
rename from x-pack/legacy/plugins/console_extensions/spec/generated/graph.explore.json
rename to x-pack/plugins/console_extensions/server/spec/generated/graph.explore.json
diff --git a/x-pack/legacy/plugins/console_extensions/spec/generated/ilm.delete_lifecycle.json b/x-pack/plugins/console_extensions/server/spec/generated/ilm.delete_lifecycle.json
similarity index 100%
rename from x-pack/legacy/plugins/console_extensions/spec/generated/ilm.delete_lifecycle.json
rename to x-pack/plugins/console_extensions/server/spec/generated/ilm.delete_lifecycle.json
diff --git a/x-pack/legacy/plugins/console_extensions/spec/generated/ilm.explain_lifecycle.json b/x-pack/plugins/console_extensions/server/spec/generated/ilm.explain_lifecycle.json
similarity index 100%
rename from x-pack/legacy/plugins/console_extensions/spec/generated/ilm.explain_lifecycle.json
rename to x-pack/plugins/console_extensions/server/spec/generated/ilm.explain_lifecycle.json
diff --git a/x-pack/legacy/plugins/console_extensions/spec/generated/ilm.get_lifecycle.json b/x-pack/plugins/console_extensions/server/spec/generated/ilm.get_lifecycle.json
similarity index 100%
rename from x-pack/legacy/plugins/console_extensions/spec/generated/ilm.get_lifecycle.json
rename to x-pack/plugins/console_extensions/server/spec/generated/ilm.get_lifecycle.json
diff --git a/x-pack/legacy/plugins/console_extensions/spec/generated/ilm.get_status.json b/x-pack/plugins/console_extensions/server/spec/generated/ilm.get_status.json
similarity index 100%
rename from x-pack/legacy/plugins/console_extensions/spec/generated/ilm.get_status.json
rename to x-pack/plugins/console_extensions/server/spec/generated/ilm.get_status.json
diff --git a/x-pack/legacy/plugins/console_extensions/spec/generated/ilm.move_to_step.json b/x-pack/plugins/console_extensions/server/spec/generated/ilm.move_to_step.json
similarity index 100%
rename from x-pack/legacy/plugins/console_extensions/spec/generated/ilm.move_to_step.json
rename to x-pack/plugins/console_extensions/server/spec/generated/ilm.move_to_step.json
diff --git a/x-pack/legacy/plugins/console_extensions/spec/generated/ilm.put_lifecycle.json b/x-pack/plugins/console_extensions/server/spec/generated/ilm.put_lifecycle.json
similarity index 100%
rename from x-pack/legacy/plugins/console_extensions/spec/generated/ilm.put_lifecycle.json
rename to x-pack/plugins/console_extensions/server/spec/generated/ilm.put_lifecycle.json
diff --git a/x-pack/legacy/plugins/console_extensions/spec/generated/ilm.remove_policy.json b/x-pack/plugins/console_extensions/server/spec/generated/ilm.remove_policy.json
similarity index 100%
rename from x-pack/legacy/plugins/console_extensions/spec/generated/ilm.remove_policy.json
rename to x-pack/plugins/console_extensions/server/spec/generated/ilm.remove_policy.json
diff --git a/x-pack/legacy/plugins/console_extensions/spec/generated/ilm.retry.json b/x-pack/plugins/console_extensions/server/spec/generated/ilm.retry.json
similarity index 100%
rename from x-pack/legacy/plugins/console_extensions/spec/generated/ilm.retry.json
rename to x-pack/plugins/console_extensions/server/spec/generated/ilm.retry.json
diff --git a/x-pack/legacy/plugins/console_extensions/spec/generated/ilm.set_policy.json b/x-pack/plugins/console_extensions/server/spec/generated/ilm.set_policy.json
similarity index 100%
rename from x-pack/legacy/plugins/console_extensions/spec/generated/ilm.set_policy.json
rename to x-pack/plugins/console_extensions/server/spec/generated/ilm.set_policy.json
diff --git a/x-pack/legacy/plugins/console_extensions/spec/generated/ilm.start.json b/x-pack/plugins/console_extensions/server/spec/generated/ilm.start.json
similarity index 100%
rename from x-pack/legacy/plugins/console_extensions/spec/generated/ilm.start.json
rename to x-pack/plugins/console_extensions/server/spec/generated/ilm.start.json
diff --git a/x-pack/legacy/plugins/console_extensions/spec/generated/ilm.stop.json b/x-pack/plugins/console_extensions/server/spec/generated/ilm.stop.json
similarity index 100%
rename from x-pack/legacy/plugins/console_extensions/spec/generated/ilm.stop.json
rename to x-pack/plugins/console_extensions/server/spec/generated/ilm.stop.json
diff --git a/x-pack/legacy/plugins/console_extensions/spec/generated/indices.freeze.json b/x-pack/plugins/console_extensions/server/spec/generated/indices.freeze.json
similarity index 100%
rename from x-pack/legacy/plugins/console_extensions/spec/generated/indices.freeze.json
rename to x-pack/plugins/console_extensions/server/spec/generated/indices.freeze.json
diff --git a/x-pack/legacy/plugins/console_extensions/spec/generated/indices.reload_search_analyzers.json b/x-pack/plugins/console_extensions/server/spec/generated/indices.reload_search_analyzers.json
similarity index 100%
rename from x-pack/legacy/plugins/console_extensions/spec/generated/indices.reload_search_analyzers.json
rename to x-pack/plugins/console_extensions/server/spec/generated/indices.reload_search_analyzers.json
diff --git a/x-pack/legacy/plugins/console_extensions/spec/generated/indices.unfreeze.json b/x-pack/plugins/console_extensions/server/spec/generated/indices.unfreeze.json
similarity index 100%
rename from x-pack/legacy/plugins/console_extensions/spec/generated/indices.unfreeze.json
rename to x-pack/plugins/console_extensions/server/spec/generated/indices.unfreeze.json
diff --git a/x-pack/legacy/plugins/console_extensions/spec/generated/license.delete.json b/x-pack/plugins/console_extensions/server/spec/generated/license.delete.json
similarity index 100%
rename from x-pack/legacy/plugins/console_extensions/spec/generated/license.delete.json
rename to x-pack/plugins/console_extensions/server/spec/generated/license.delete.json
diff --git a/x-pack/legacy/plugins/console_extensions/spec/generated/license.get.json b/x-pack/plugins/console_extensions/server/spec/generated/license.get.json
similarity index 100%
rename from x-pack/legacy/plugins/console_extensions/spec/generated/license.get.json
rename to x-pack/plugins/console_extensions/server/spec/generated/license.get.json
diff --git a/x-pack/legacy/plugins/console_extensions/spec/generated/license.get_basic_status.json b/x-pack/plugins/console_extensions/server/spec/generated/license.get_basic_status.json
similarity index 100%
rename from x-pack/legacy/plugins/console_extensions/spec/generated/license.get_basic_status.json
rename to x-pack/plugins/console_extensions/server/spec/generated/license.get_basic_status.json
diff --git a/x-pack/legacy/plugins/console_extensions/spec/generated/license.get_trial_status.json b/x-pack/plugins/console_extensions/server/spec/generated/license.get_trial_status.json
similarity index 100%
rename from x-pack/legacy/plugins/console_extensions/spec/generated/license.get_trial_status.json
rename to x-pack/plugins/console_extensions/server/spec/generated/license.get_trial_status.json
diff --git a/x-pack/legacy/plugins/console_extensions/spec/generated/license.post.json b/x-pack/plugins/console_extensions/server/spec/generated/license.post.json
similarity index 100%
rename from x-pack/legacy/plugins/console_extensions/spec/generated/license.post.json
rename to x-pack/plugins/console_extensions/server/spec/generated/license.post.json
diff --git a/x-pack/legacy/plugins/console_extensions/spec/generated/license.post_start_basic.json b/x-pack/plugins/console_extensions/server/spec/generated/license.post_start_basic.json
similarity index 100%
rename from x-pack/legacy/plugins/console_extensions/spec/generated/license.post_start_basic.json
rename to x-pack/plugins/console_extensions/server/spec/generated/license.post_start_basic.json
diff --git a/x-pack/legacy/plugins/console_extensions/spec/generated/license.post_start_trial.json b/x-pack/plugins/console_extensions/server/spec/generated/license.post_start_trial.json
similarity index 100%
rename from x-pack/legacy/plugins/console_extensions/spec/generated/license.post_start_trial.json
rename to x-pack/plugins/console_extensions/server/spec/generated/license.post_start_trial.json
diff --git a/x-pack/legacy/plugins/console_extensions/spec/generated/migration.deprecations.json b/x-pack/plugins/console_extensions/server/spec/generated/migration.deprecations.json
similarity index 100%
rename from x-pack/legacy/plugins/console_extensions/spec/generated/migration.deprecations.json
rename to x-pack/plugins/console_extensions/server/spec/generated/migration.deprecations.json
diff --git a/x-pack/legacy/plugins/console_extensions/spec/generated/migration.get_assistance.json b/x-pack/plugins/console_extensions/server/spec/generated/migration.get_assistance.json
similarity index 100%
rename from x-pack/legacy/plugins/console_extensions/spec/generated/migration.get_assistance.json
rename to x-pack/plugins/console_extensions/server/spec/generated/migration.get_assistance.json
diff --git a/x-pack/legacy/plugins/console_extensions/spec/generated/migration.upgrade.json b/x-pack/plugins/console_extensions/server/spec/generated/migration.upgrade.json
similarity index 100%
rename from x-pack/legacy/plugins/console_extensions/spec/generated/migration.upgrade.json
rename to x-pack/plugins/console_extensions/server/spec/generated/migration.upgrade.json
diff --git a/x-pack/legacy/plugins/console_extensions/spec/generated/ml.close_job.json b/x-pack/plugins/console_extensions/server/spec/generated/ml.close_job.json
similarity index 100%
rename from x-pack/legacy/plugins/console_extensions/spec/generated/ml.close_job.json
rename to x-pack/plugins/console_extensions/server/spec/generated/ml.close_job.json
diff --git a/x-pack/legacy/plugins/console_extensions/spec/generated/ml.delete_calendar.json b/x-pack/plugins/console_extensions/server/spec/generated/ml.delete_calendar.json
similarity index 100%
rename from x-pack/legacy/plugins/console_extensions/spec/generated/ml.delete_calendar.json
rename to x-pack/plugins/console_extensions/server/spec/generated/ml.delete_calendar.json
diff --git a/x-pack/legacy/plugins/console_extensions/spec/generated/ml.delete_calendar_event.json b/x-pack/plugins/console_extensions/server/spec/generated/ml.delete_calendar_event.json
similarity index 100%
rename from x-pack/legacy/plugins/console_extensions/spec/generated/ml.delete_calendar_event.json
rename to x-pack/plugins/console_extensions/server/spec/generated/ml.delete_calendar_event.json
diff --git a/x-pack/legacy/plugins/console_extensions/spec/generated/ml.delete_calendar_job.json b/x-pack/plugins/console_extensions/server/spec/generated/ml.delete_calendar_job.json
similarity index 100%
rename from x-pack/legacy/plugins/console_extensions/spec/generated/ml.delete_calendar_job.json
rename to x-pack/plugins/console_extensions/server/spec/generated/ml.delete_calendar_job.json
diff --git a/x-pack/legacy/plugins/console_extensions/spec/generated/ml.delete_data_frame_analytics.json b/x-pack/plugins/console_extensions/server/spec/generated/ml.delete_data_frame_analytics.json
similarity index 100%
rename from x-pack/legacy/plugins/console_extensions/spec/generated/ml.delete_data_frame_analytics.json
rename to x-pack/plugins/console_extensions/server/spec/generated/ml.delete_data_frame_analytics.json
diff --git a/x-pack/legacy/plugins/console_extensions/spec/generated/ml.delete_datafeed.json b/x-pack/plugins/console_extensions/server/spec/generated/ml.delete_datafeed.json
similarity index 100%
rename from x-pack/legacy/plugins/console_extensions/spec/generated/ml.delete_datafeed.json
rename to x-pack/plugins/console_extensions/server/spec/generated/ml.delete_datafeed.json
diff --git a/x-pack/legacy/plugins/console_extensions/spec/generated/ml.delete_expired_data.json b/x-pack/plugins/console_extensions/server/spec/generated/ml.delete_expired_data.json
similarity index 100%
rename from x-pack/legacy/plugins/console_extensions/spec/generated/ml.delete_expired_data.json
rename to x-pack/plugins/console_extensions/server/spec/generated/ml.delete_expired_data.json
diff --git a/x-pack/legacy/plugins/console_extensions/spec/generated/ml.delete_filter.json b/x-pack/plugins/console_extensions/server/spec/generated/ml.delete_filter.json
similarity index 100%
rename from x-pack/legacy/plugins/console_extensions/spec/generated/ml.delete_filter.json
rename to x-pack/plugins/console_extensions/server/spec/generated/ml.delete_filter.json
diff --git a/x-pack/legacy/plugins/console_extensions/spec/generated/ml.delete_forecast.json b/x-pack/plugins/console_extensions/server/spec/generated/ml.delete_forecast.json
similarity index 100%
rename from x-pack/legacy/plugins/console_extensions/spec/generated/ml.delete_forecast.json
rename to x-pack/plugins/console_extensions/server/spec/generated/ml.delete_forecast.json
diff --git a/x-pack/legacy/plugins/console_extensions/spec/generated/ml.delete_job.json b/x-pack/plugins/console_extensions/server/spec/generated/ml.delete_job.json
similarity index 100%
rename from x-pack/legacy/plugins/console_extensions/spec/generated/ml.delete_job.json
rename to x-pack/plugins/console_extensions/server/spec/generated/ml.delete_job.json
diff --git a/x-pack/legacy/plugins/console_extensions/spec/generated/ml.delete_model_snapshot.json b/x-pack/plugins/console_extensions/server/spec/generated/ml.delete_model_snapshot.json
similarity index 100%
rename from x-pack/legacy/plugins/console_extensions/spec/generated/ml.delete_model_snapshot.json
rename to x-pack/plugins/console_extensions/server/spec/generated/ml.delete_model_snapshot.json
diff --git a/x-pack/legacy/plugins/console_extensions/spec/generated/ml.delete_trained_model.json b/x-pack/plugins/console_extensions/server/spec/generated/ml.delete_trained_model.json
similarity index 100%
rename from x-pack/legacy/plugins/console_extensions/spec/generated/ml.delete_trained_model.json
rename to x-pack/plugins/console_extensions/server/spec/generated/ml.delete_trained_model.json
diff --git a/x-pack/legacy/plugins/console_extensions/spec/generated/ml.estimate_memory_usage.json b/x-pack/plugins/console_extensions/server/spec/generated/ml.estimate_memory_usage.json
similarity index 100%
rename from x-pack/legacy/plugins/console_extensions/spec/generated/ml.estimate_memory_usage.json
rename to x-pack/plugins/console_extensions/server/spec/generated/ml.estimate_memory_usage.json
diff --git a/x-pack/legacy/plugins/console_extensions/spec/generated/ml.evaluate_data_frame.json b/x-pack/plugins/console_extensions/server/spec/generated/ml.evaluate_data_frame.json
similarity index 100%
rename from x-pack/legacy/plugins/console_extensions/spec/generated/ml.evaluate_data_frame.json
rename to x-pack/plugins/console_extensions/server/spec/generated/ml.evaluate_data_frame.json
diff --git a/x-pack/legacy/plugins/console_extensions/spec/generated/ml.explain_data_frame_analytics.json b/x-pack/plugins/console_extensions/server/spec/generated/ml.explain_data_frame_analytics.json
similarity index 100%
rename from x-pack/legacy/plugins/console_extensions/spec/generated/ml.explain_data_frame_analytics.json
rename to x-pack/plugins/console_extensions/server/spec/generated/ml.explain_data_frame_analytics.json
diff --git a/x-pack/legacy/plugins/console_extensions/spec/generated/ml.find_file_structure.json b/x-pack/plugins/console_extensions/server/spec/generated/ml.find_file_structure.json
similarity index 100%
rename from x-pack/legacy/plugins/console_extensions/spec/generated/ml.find_file_structure.json
rename to x-pack/plugins/console_extensions/server/spec/generated/ml.find_file_structure.json
diff --git a/x-pack/legacy/plugins/console_extensions/spec/generated/ml.flush_job.json b/x-pack/plugins/console_extensions/server/spec/generated/ml.flush_job.json
similarity index 100%
rename from x-pack/legacy/plugins/console_extensions/spec/generated/ml.flush_job.json
rename to x-pack/plugins/console_extensions/server/spec/generated/ml.flush_job.json
diff --git a/x-pack/legacy/plugins/console_extensions/spec/generated/ml.forecast.json b/x-pack/plugins/console_extensions/server/spec/generated/ml.forecast.json
similarity index 100%
rename from x-pack/legacy/plugins/console_extensions/spec/generated/ml.forecast.json
rename to x-pack/plugins/console_extensions/server/spec/generated/ml.forecast.json
diff --git a/x-pack/legacy/plugins/console_extensions/spec/generated/ml.get_buckets.json b/x-pack/plugins/console_extensions/server/spec/generated/ml.get_buckets.json
similarity index 100%
rename from x-pack/legacy/plugins/console_extensions/spec/generated/ml.get_buckets.json
rename to x-pack/plugins/console_extensions/server/spec/generated/ml.get_buckets.json
diff --git a/x-pack/legacy/plugins/console_extensions/spec/generated/ml.get_calendar_events.json b/x-pack/plugins/console_extensions/server/spec/generated/ml.get_calendar_events.json
similarity index 100%
rename from x-pack/legacy/plugins/console_extensions/spec/generated/ml.get_calendar_events.json
rename to x-pack/plugins/console_extensions/server/spec/generated/ml.get_calendar_events.json
diff --git a/x-pack/legacy/plugins/console_extensions/spec/generated/ml.get_calendars.json b/x-pack/plugins/console_extensions/server/spec/generated/ml.get_calendars.json
similarity index 100%
rename from x-pack/legacy/plugins/console_extensions/spec/generated/ml.get_calendars.json
rename to x-pack/plugins/console_extensions/server/spec/generated/ml.get_calendars.json
diff --git a/x-pack/legacy/plugins/console_extensions/spec/generated/ml.get_categories.json b/x-pack/plugins/console_extensions/server/spec/generated/ml.get_categories.json
similarity index 100%
rename from x-pack/legacy/plugins/console_extensions/spec/generated/ml.get_categories.json
rename to x-pack/plugins/console_extensions/server/spec/generated/ml.get_categories.json
diff --git a/x-pack/legacy/plugins/console_extensions/spec/generated/ml.get_data_frame_analytics.json b/x-pack/plugins/console_extensions/server/spec/generated/ml.get_data_frame_analytics.json
similarity index 100%
rename from x-pack/legacy/plugins/console_extensions/spec/generated/ml.get_data_frame_analytics.json
rename to x-pack/plugins/console_extensions/server/spec/generated/ml.get_data_frame_analytics.json
diff --git a/x-pack/legacy/plugins/console_extensions/spec/generated/ml.get_data_frame_analytics_stats.json b/x-pack/plugins/console_extensions/server/spec/generated/ml.get_data_frame_analytics_stats.json
similarity index 100%
rename from x-pack/legacy/plugins/console_extensions/spec/generated/ml.get_data_frame_analytics_stats.json
rename to x-pack/plugins/console_extensions/server/spec/generated/ml.get_data_frame_analytics_stats.json
diff --git a/x-pack/legacy/plugins/console_extensions/spec/generated/ml.get_datafeed_stats.json b/x-pack/plugins/console_extensions/server/spec/generated/ml.get_datafeed_stats.json
similarity index 100%
rename from x-pack/legacy/plugins/console_extensions/spec/generated/ml.get_datafeed_stats.json
rename to x-pack/plugins/console_extensions/server/spec/generated/ml.get_datafeed_stats.json
diff --git a/x-pack/legacy/plugins/console_extensions/spec/generated/ml.get_datafeeds.json b/x-pack/plugins/console_extensions/server/spec/generated/ml.get_datafeeds.json
similarity index 100%
rename from x-pack/legacy/plugins/console_extensions/spec/generated/ml.get_datafeeds.json
rename to x-pack/plugins/console_extensions/server/spec/generated/ml.get_datafeeds.json
diff --git a/x-pack/legacy/plugins/console_extensions/spec/generated/ml.get_filters.json b/x-pack/plugins/console_extensions/server/spec/generated/ml.get_filters.json
similarity index 100%
rename from x-pack/legacy/plugins/console_extensions/spec/generated/ml.get_filters.json
rename to x-pack/plugins/console_extensions/server/spec/generated/ml.get_filters.json
diff --git a/x-pack/legacy/plugins/console_extensions/spec/generated/ml.get_influencers.json b/x-pack/plugins/console_extensions/server/spec/generated/ml.get_influencers.json
similarity index 100%
rename from x-pack/legacy/plugins/console_extensions/spec/generated/ml.get_influencers.json
rename to x-pack/plugins/console_extensions/server/spec/generated/ml.get_influencers.json
diff --git a/x-pack/legacy/plugins/console_extensions/spec/generated/ml.get_job_stats.json b/x-pack/plugins/console_extensions/server/spec/generated/ml.get_job_stats.json
similarity index 100%
rename from x-pack/legacy/plugins/console_extensions/spec/generated/ml.get_job_stats.json
rename to x-pack/plugins/console_extensions/server/spec/generated/ml.get_job_stats.json
diff --git a/x-pack/legacy/plugins/console_extensions/spec/generated/ml.get_jobs.json b/x-pack/plugins/console_extensions/server/spec/generated/ml.get_jobs.json
similarity index 100%
rename from x-pack/legacy/plugins/console_extensions/spec/generated/ml.get_jobs.json
rename to x-pack/plugins/console_extensions/server/spec/generated/ml.get_jobs.json
diff --git a/x-pack/legacy/plugins/console_extensions/spec/generated/ml.get_model_snapshots.json b/x-pack/plugins/console_extensions/server/spec/generated/ml.get_model_snapshots.json
similarity index 100%
rename from x-pack/legacy/plugins/console_extensions/spec/generated/ml.get_model_snapshots.json
rename to x-pack/plugins/console_extensions/server/spec/generated/ml.get_model_snapshots.json
diff --git a/x-pack/legacy/plugins/console_extensions/spec/generated/ml.get_overall_buckets.json b/x-pack/plugins/console_extensions/server/spec/generated/ml.get_overall_buckets.json
similarity index 100%
rename from x-pack/legacy/plugins/console_extensions/spec/generated/ml.get_overall_buckets.json
rename to x-pack/plugins/console_extensions/server/spec/generated/ml.get_overall_buckets.json
diff --git a/x-pack/legacy/plugins/console_extensions/spec/generated/ml.get_records.json b/x-pack/plugins/console_extensions/server/spec/generated/ml.get_records.json
similarity index 100%
rename from x-pack/legacy/plugins/console_extensions/spec/generated/ml.get_records.json
rename to x-pack/plugins/console_extensions/server/spec/generated/ml.get_records.json
diff --git a/x-pack/legacy/plugins/console_extensions/spec/generated/ml.get_trained_models.json b/x-pack/plugins/console_extensions/server/spec/generated/ml.get_trained_models.json
similarity index 100%
rename from x-pack/legacy/plugins/console_extensions/spec/generated/ml.get_trained_models.json
rename to x-pack/plugins/console_extensions/server/spec/generated/ml.get_trained_models.json
diff --git a/x-pack/legacy/plugins/console_extensions/spec/generated/ml.get_trained_models_stats.json b/x-pack/plugins/console_extensions/server/spec/generated/ml.get_trained_models_stats.json
similarity index 100%
rename from x-pack/legacy/plugins/console_extensions/spec/generated/ml.get_trained_models_stats.json
rename to x-pack/plugins/console_extensions/server/spec/generated/ml.get_trained_models_stats.json
diff --git a/x-pack/legacy/plugins/console_extensions/spec/generated/ml.info.json b/x-pack/plugins/console_extensions/server/spec/generated/ml.info.json
similarity index 100%
rename from x-pack/legacy/plugins/console_extensions/spec/generated/ml.info.json
rename to x-pack/plugins/console_extensions/server/spec/generated/ml.info.json
diff --git a/x-pack/legacy/plugins/console_extensions/spec/generated/ml.open_job.json b/x-pack/plugins/console_extensions/server/spec/generated/ml.open_job.json
similarity index 100%
rename from x-pack/legacy/plugins/console_extensions/spec/generated/ml.open_job.json
rename to x-pack/plugins/console_extensions/server/spec/generated/ml.open_job.json
diff --git a/x-pack/legacy/plugins/console_extensions/spec/generated/ml.post_calendar_events.json b/x-pack/plugins/console_extensions/server/spec/generated/ml.post_calendar_events.json
similarity index 100%
rename from x-pack/legacy/plugins/console_extensions/spec/generated/ml.post_calendar_events.json
rename to x-pack/plugins/console_extensions/server/spec/generated/ml.post_calendar_events.json
diff --git a/x-pack/legacy/plugins/console_extensions/spec/generated/ml.post_data.json b/x-pack/plugins/console_extensions/server/spec/generated/ml.post_data.json
similarity index 100%
rename from x-pack/legacy/plugins/console_extensions/spec/generated/ml.post_data.json
rename to x-pack/plugins/console_extensions/server/spec/generated/ml.post_data.json
diff --git a/x-pack/legacy/plugins/console_extensions/spec/generated/ml.preview_datafeed.json b/x-pack/plugins/console_extensions/server/spec/generated/ml.preview_datafeed.json
similarity index 100%
rename from x-pack/legacy/plugins/console_extensions/spec/generated/ml.preview_datafeed.json
rename to x-pack/plugins/console_extensions/server/spec/generated/ml.preview_datafeed.json
diff --git a/x-pack/legacy/plugins/console_extensions/spec/generated/ml.put_calendar.json b/x-pack/plugins/console_extensions/server/spec/generated/ml.put_calendar.json
similarity index 100%
rename from x-pack/legacy/plugins/console_extensions/spec/generated/ml.put_calendar.json
rename to x-pack/plugins/console_extensions/server/spec/generated/ml.put_calendar.json
diff --git a/x-pack/legacy/plugins/console_extensions/spec/generated/ml.put_calendar_job.json b/x-pack/plugins/console_extensions/server/spec/generated/ml.put_calendar_job.json
similarity index 100%
rename from x-pack/legacy/plugins/console_extensions/spec/generated/ml.put_calendar_job.json
rename to x-pack/plugins/console_extensions/server/spec/generated/ml.put_calendar_job.json
diff --git a/x-pack/legacy/plugins/console_extensions/spec/generated/ml.put_data_frame_analytics.json b/x-pack/plugins/console_extensions/server/spec/generated/ml.put_data_frame_analytics.json
similarity index 100%
rename from x-pack/legacy/plugins/console_extensions/spec/generated/ml.put_data_frame_analytics.json
rename to x-pack/plugins/console_extensions/server/spec/generated/ml.put_data_frame_analytics.json
diff --git a/x-pack/legacy/plugins/console_extensions/spec/generated/ml.put_datafeed.json b/x-pack/plugins/console_extensions/server/spec/generated/ml.put_datafeed.json
similarity index 100%
rename from x-pack/legacy/plugins/console_extensions/spec/generated/ml.put_datafeed.json
rename to x-pack/plugins/console_extensions/server/spec/generated/ml.put_datafeed.json
diff --git a/x-pack/legacy/plugins/console_extensions/spec/generated/ml.put_filter.json b/x-pack/plugins/console_extensions/server/spec/generated/ml.put_filter.json
similarity index 100%
rename from x-pack/legacy/plugins/console_extensions/spec/generated/ml.put_filter.json
rename to x-pack/plugins/console_extensions/server/spec/generated/ml.put_filter.json
diff --git a/x-pack/legacy/plugins/console_extensions/spec/generated/ml.put_job.json b/x-pack/plugins/console_extensions/server/spec/generated/ml.put_job.json
similarity index 100%
rename from x-pack/legacy/plugins/console_extensions/spec/generated/ml.put_job.json
rename to x-pack/plugins/console_extensions/server/spec/generated/ml.put_job.json
diff --git a/x-pack/legacy/plugins/console_extensions/spec/generated/ml.put_trained_model.json b/x-pack/plugins/console_extensions/server/spec/generated/ml.put_trained_model.json
similarity index 100%
rename from x-pack/legacy/plugins/console_extensions/spec/generated/ml.put_trained_model.json
rename to x-pack/plugins/console_extensions/server/spec/generated/ml.put_trained_model.json
diff --git a/x-pack/legacy/plugins/console_extensions/spec/generated/ml.revert_model_snapshot.json b/x-pack/plugins/console_extensions/server/spec/generated/ml.revert_model_snapshot.json
similarity index 100%
rename from x-pack/legacy/plugins/console_extensions/spec/generated/ml.revert_model_snapshot.json
rename to x-pack/plugins/console_extensions/server/spec/generated/ml.revert_model_snapshot.json
diff --git a/x-pack/legacy/plugins/console_extensions/spec/generated/ml.set_upgrade_mode.json b/x-pack/plugins/console_extensions/server/spec/generated/ml.set_upgrade_mode.json
similarity index 100%
rename from x-pack/legacy/plugins/console_extensions/spec/generated/ml.set_upgrade_mode.json
rename to x-pack/plugins/console_extensions/server/spec/generated/ml.set_upgrade_mode.json
diff --git a/x-pack/legacy/plugins/console_extensions/spec/generated/ml.start_data_frame_analytics.json b/x-pack/plugins/console_extensions/server/spec/generated/ml.start_data_frame_analytics.json
similarity index 100%
rename from x-pack/legacy/plugins/console_extensions/spec/generated/ml.start_data_frame_analytics.json
rename to x-pack/plugins/console_extensions/server/spec/generated/ml.start_data_frame_analytics.json
diff --git a/x-pack/legacy/plugins/console_extensions/spec/generated/ml.start_datafeed.json b/x-pack/plugins/console_extensions/server/spec/generated/ml.start_datafeed.json
similarity index 100%
rename from x-pack/legacy/plugins/console_extensions/spec/generated/ml.start_datafeed.json
rename to x-pack/plugins/console_extensions/server/spec/generated/ml.start_datafeed.json
diff --git a/x-pack/legacy/plugins/console_extensions/spec/generated/ml.stop_data_frame_analytics.json b/x-pack/plugins/console_extensions/server/spec/generated/ml.stop_data_frame_analytics.json
similarity index 100%
rename from x-pack/legacy/plugins/console_extensions/spec/generated/ml.stop_data_frame_analytics.json
rename to x-pack/plugins/console_extensions/server/spec/generated/ml.stop_data_frame_analytics.json
diff --git a/x-pack/legacy/plugins/console_extensions/spec/generated/ml.stop_datafeed.json b/x-pack/plugins/console_extensions/server/spec/generated/ml.stop_datafeed.json
similarity index 100%
rename from x-pack/legacy/plugins/console_extensions/spec/generated/ml.stop_datafeed.json
rename to x-pack/plugins/console_extensions/server/spec/generated/ml.stop_datafeed.json
diff --git a/x-pack/legacy/plugins/console_extensions/spec/generated/ml.update_datafeed.json b/x-pack/plugins/console_extensions/server/spec/generated/ml.update_datafeed.json
similarity index 100%
rename from x-pack/legacy/plugins/console_extensions/spec/generated/ml.update_datafeed.json
rename to x-pack/plugins/console_extensions/server/spec/generated/ml.update_datafeed.json
diff --git a/x-pack/legacy/plugins/console_extensions/spec/generated/ml.update_filter.json b/x-pack/plugins/console_extensions/server/spec/generated/ml.update_filter.json
similarity index 100%
rename from x-pack/legacy/plugins/console_extensions/spec/generated/ml.update_filter.json
rename to x-pack/plugins/console_extensions/server/spec/generated/ml.update_filter.json
diff --git a/x-pack/legacy/plugins/console_extensions/spec/generated/ml.update_job.json b/x-pack/plugins/console_extensions/server/spec/generated/ml.update_job.json
similarity index 100%
rename from x-pack/legacy/plugins/console_extensions/spec/generated/ml.update_job.json
rename to x-pack/plugins/console_extensions/server/spec/generated/ml.update_job.json
diff --git a/x-pack/legacy/plugins/console_extensions/spec/generated/ml.update_model_snapshot.json b/x-pack/plugins/console_extensions/server/spec/generated/ml.update_model_snapshot.json
similarity index 100%
rename from x-pack/legacy/plugins/console_extensions/spec/generated/ml.update_model_snapshot.json
rename to x-pack/plugins/console_extensions/server/spec/generated/ml.update_model_snapshot.json
diff --git a/x-pack/legacy/plugins/console_extensions/spec/generated/ml.upgrade.json b/x-pack/plugins/console_extensions/server/spec/generated/ml.upgrade.json
similarity index 100%
rename from x-pack/legacy/plugins/console_extensions/spec/generated/ml.upgrade.json
rename to x-pack/plugins/console_extensions/server/spec/generated/ml.upgrade.json
diff --git a/x-pack/legacy/plugins/console_extensions/spec/generated/ml.validate.json b/x-pack/plugins/console_extensions/server/spec/generated/ml.validate.json
similarity index 100%
rename from x-pack/legacy/plugins/console_extensions/spec/generated/ml.validate.json
rename to x-pack/plugins/console_extensions/server/spec/generated/ml.validate.json
diff --git a/x-pack/legacy/plugins/console_extensions/spec/generated/ml.validate_detector.json b/x-pack/plugins/console_extensions/server/spec/generated/ml.validate_detector.json
similarity index 100%
rename from x-pack/legacy/plugins/console_extensions/spec/generated/ml.validate_detector.json
rename to x-pack/plugins/console_extensions/server/spec/generated/ml.validate_detector.json
diff --git a/x-pack/legacy/plugins/console_extensions/spec/generated/monitoring.bulk.json b/x-pack/plugins/console_extensions/server/spec/generated/monitoring.bulk.json
similarity index 100%
rename from x-pack/legacy/plugins/console_extensions/spec/generated/monitoring.bulk.json
rename to x-pack/plugins/console_extensions/server/spec/generated/monitoring.bulk.json
diff --git a/x-pack/legacy/plugins/console_extensions/spec/generated/rollup.delete_job.json b/x-pack/plugins/console_extensions/server/spec/generated/rollup.delete_job.json
similarity index 100%
rename from x-pack/legacy/plugins/console_extensions/spec/generated/rollup.delete_job.json
rename to x-pack/plugins/console_extensions/server/spec/generated/rollup.delete_job.json
diff --git a/x-pack/legacy/plugins/console_extensions/spec/generated/rollup.get_jobs.json b/x-pack/plugins/console_extensions/server/spec/generated/rollup.get_jobs.json
similarity index 100%
rename from x-pack/legacy/plugins/console_extensions/spec/generated/rollup.get_jobs.json
rename to x-pack/plugins/console_extensions/server/spec/generated/rollup.get_jobs.json
diff --git a/x-pack/legacy/plugins/console_extensions/spec/generated/rollup.get_rollup_caps.json b/x-pack/plugins/console_extensions/server/spec/generated/rollup.get_rollup_caps.json
similarity index 100%
rename from x-pack/legacy/plugins/console_extensions/spec/generated/rollup.get_rollup_caps.json
rename to x-pack/plugins/console_extensions/server/spec/generated/rollup.get_rollup_caps.json
diff --git a/x-pack/legacy/plugins/console_extensions/spec/generated/rollup.get_rollup_index_caps.json b/x-pack/plugins/console_extensions/server/spec/generated/rollup.get_rollup_index_caps.json
similarity index 100%
rename from x-pack/legacy/plugins/console_extensions/spec/generated/rollup.get_rollup_index_caps.json
rename to x-pack/plugins/console_extensions/server/spec/generated/rollup.get_rollup_index_caps.json
diff --git a/x-pack/legacy/plugins/console_extensions/spec/generated/rollup.put_job.json b/x-pack/plugins/console_extensions/server/spec/generated/rollup.put_job.json
similarity index 100%
rename from x-pack/legacy/plugins/console_extensions/spec/generated/rollup.put_job.json
rename to x-pack/plugins/console_extensions/server/spec/generated/rollup.put_job.json
diff --git a/x-pack/legacy/plugins/console_extensions/spec/generated/rollup.rollup_search.json b/x-pack/plugins/console_extensions/server/spec/generated/rollup.rollup_search.json
similarity index 100%
rename from x-pack/legacy/plugins/console_extensions/spec/generated/rollup.rollup_search.json
rename to x-pack/plugins/console_extensions/server/spec/generated/rollup.rollup_search.json
diff --git a/x-pack/legacy/plugins/console_extensions/spec/generated/rollup.start_job.json b/x-pack/plugins/console_extensions/server/spec/generated/rollup.start_job.json
similarity index 100%
rename from x-pack/legacy/plugins/console_extensions/spec/generated/rollup.start_job.json
rename to x-pack/plugins/console_extensions/server/spec/generated/rollup.start_job.json
diff --git a/x-pack/legacy/plugins/console_extensions/spec/generated/rollup.stop_job.json b/x-pack/plugins/console_extensions/server/spec/generated/rollup.stop_job.json
similarity index 100%
rename from x-pack/legacy/plugins/console_extensions/spec/generated/rollup.stop_job.json
rename to x-pack/plugins/console_extensions/server/spec/generated/rollup.stop_job.json
diff --git a/x-pack/legacy/plugins/console_extensions/spec/generated/security.authenticate.json b/x-pack/plugins/console_extensions/server/spec/generated/security.authenticate.json
similarity index 100%
rename from x-pack/legacy/plugins/console_extensions/spec/generated/security.authenticate.json
rename to x-pack/plugins/console_extensions/server/spec/generated/security.authenticate.json
diff --git a/x-pack/legacy/plugins/console_extensions/spec/generated/security.change_password.json b/x-pack/plugins/console_extensions/server/spec/generated/security.change_password.json
similarity index 100%
rename from x-pack/legacy/plugins/console_extensions/spec/generated/security.change_password.json
rename to x-pack/plugins/console_extensions/server/spec/generated/security.change_password.json
diff --git a/x-pack/legacy/plugins/console_extensions/spec/generated/security.clear_cached_realms.json b/x-pack/plugins/console_extensions/server/spec/generated/security.clear_cached_realms.json
similarity index 100%
rename from x-pack/legacy/plugins/console_extensions/spec/generated/security.clear_cached_realms.json
rename to x-pack/plugins/console_extensions/server/spec/generated/security.clear_cached_realms.json
diff --git a/x-pack/legacy/plugins/console_extensions/spec/generated/security.clear_cached_roles.json b/x-pack/plugins/console_extensions/server/spec/generated/security.clear_cached_roles.json
similarity index 100%
rename from x-pack/legacy/plugins/console_extensions/spec/generated/security.clear_cached_roles.json
rename to x-pack/plugins/console_extensions/server/spec/generated/security.clear_cached_roles.json
diff --git a/x-pack/legacy/plugins/console_extensions/spec/generated/security.create_api_key.json b/x-pack/plugins/console_extensions/server/spec/generated/security.create_api_key.json
similarity index 100%
rename from x-pack/legacy/plugins/console_extensions/spec/generated/security.create_api_key.json
rename to x-pack/plugins/console_extensions/server/spec/generated/security.create_api_key.json
diff --git a/x-pack/legacy/plugins/console_extensions/spec/generated/security.delete_privileges.json b/x-pack/plugins/console_extensions/server/spec/generated/security.delete_privileges.json
similarity index 100%
rename from x-pack/legacy/plugins/console_extensions/spec/generated/security.delete_privileges.json
rename to x-pack/plugins/console_extensions/server/spec/generated/security.delete_privileges.json
diff --git a/x-pack/legacy/plugins/console_extensions/spec/generated/security.delete_role.json b/x-pack/plugins/console_extensions/server/spec/generated/security.delete_role.json
similarity index 100%
rename from x-pack/legacy/plugins/console_extensions/spec/generated/security.delete_role.json
rename to x-pack/plugins/console_extensions/server/spec/generated/security.delete_role.json
diff --git a/x-pack/legacy/plugins/console_extensions/spec/generated/security.delete_role_mapping.json b/x-pack/plugins/console_extensions/server/spec/generated/security.delete_role_mapping.json
similarity index 100%
rename from x-pack/legacy/plugins/console_extensions/spec/generated/security.delete_role_mapping.json
rename to x-pack/plugins/console_extensions/server/spec/generated/security.delete_role_mapping.json
diff --git a/x-pack/legacy/plugins/console_extensions/spec/generated/security.delete_user.json b/x-pack/plugins/console_extensions/server/spec/generated/security.delete_user.json
similarity index 100%
rename from x-pack/legacy/plugins/console_extensions/spec/generated/security.delete_user.json
rename to x-pack/plugins/console_extensions/server/spec/generated/security.delete_user.json
diff --git a/x-pack/legacy/plugins/console_extensions/spec/generated/security.disable_user.json b/x-pack/plugins/console_extensions/server/spec/generated/security.disable_user.json
similarity index 100%
rename from x-pack/legacy/plugins/console_extensions/spec/generated/security.disable_user.json
rename to x-pack/plugins/console_extensions/server/spec/generated/security.disable_user.json
diff --git a/x-pack/legacy/plugins/console_extensions/spec/generated/security.enable_user.json b/x-pack/plugins/console_extensions/server/spec/generated/security.enable_user.json
similarity index 100%
rename from x-pack/legacy/plugins/console_extensions/spec/generated/security.enable_user.json
rename to x-pack/plugins/console_extensions/server/spec/generated/security.enable_user.json
diff --git a/x-pack/legacy/plugins/console_extensions/spec/generated/security.get_api_key.json b/x-pack/plugins/console_extensions/server/spec/generated/security.get_api_key.json
similarity index 100%
rename from x-pack/legacy/plugins/console_extensions/spec/generated/security.get_api_key.json
rename to x-pack/plugins/console_extensions/server/spec/generated/security.get_api_key.json
diff --git a/x-pack/legacy/plugins/console_extensions/spec/generated/security.get_builtin_privileges.json b/x-pack/plugins/console_extensions/server/spec/generated/security.get_builtin_privileges.json
similarity index 100%
rename from x-pack/legacy/plugins/console_extensions/spec/generated/security.get_builtin_privileges.json
rename to x-pack/plugins/console_extensions/server/spec/generated/security.get_builtin_privileges.json
diff --git a/x-pack/legacy/plugins/console_extensions/spec/generated/security.get_privileges.json b/x-pack/plugins/console_extensions/server/spec/generated/security.get_privileges.json
similarity index 100%
rename from x-pack/legacy/plugins/console_extensions/spec/generated/security.get_privileges.json
rename to x-pack/plugins/console_extensions/server/spec/generated/security.get_privileges.json
diff --git a/x-pack/legacy/plugins/console_extensions/spec/generated/security.get_role.json b/x-pack/plugins/console_extensions/server/spec/generated/security.get_role.json
similarity index 100%
rename from x-pack/legacy/plugins/console_extensions/spec/generated/security.get_role.json
rename to x-pack/plugins/console_extensions/server/spec/generated/security.get_role.json
diff --git a/x-pack/legacy/plugins/console_extensions/spec/generated/security.get_role_mapping.json b/x-pack/plugins/console_extensions/server/spec/generated/security.get_role_mapping.json
similarity index 100%
rename from x-pack/legacy/plugins/console_extensions/spec/generated/security.get_role_mapping.json
rename to x-pack/plugins/console_extensions/server/spec/generated/security.get_role_mapping.json
diff --git a/x-pack/legacy/plugins/console_extensions/spec/generated/security.get_token.json b/x-pack/plugins/console_extensions/server/spec/generated/security.get_token.json
similarity index 100%
rename from x-pack/legacy/plugins/console_extensions/spec/generated/security.get_token.json
rename to x-pack/plugins/console_extensions/server/spec/generated/security.get_token.json
diff --git a/x-pack/legacy/plugins/console_extensions/spec/generated/security.get_user.json b/x-pack/plugins/console_extensions/server/spec/generated/security.get_user.json
similarity index 100%
rename from x-pack/legacy/plugins/console_extensions/spec/generated/security.get_user.json
rename to x-pack/plugins/console_extensions/server/spec/generated/security.get_user.json
diff --git a/x-pack/legacy/plugins/console_extensions/spec/generated/security.get_user_privileges.json b/x-pack/plugins/console_extensions/server/spec/generated/security.get_user_privileges.json
similarity index 100%
rename from x-pack/legacy/plugins/console_extensions/spec/generated/security.get_user_privileges.json
rename to x-pack/plugins/console_extensions/server/spec/generated/security.get_user_privileges.json
diff --git a/x-pack/legacy/plugins/console_extensions/spec/generated/security.has_privileges.json b/x-pack/plugins/console_extensions/server/spec/generated/security.has_privileges.json
similarity index 100%
rename from x-pack/legacy/plugins/console_extensions/spec/generated/security.has_privileges.json
rename to x-pack/plugins/console_extensions/server/spec/generated/security.has_privileges.json
diff --git a/x-pack/legacy/plugins/console_extensions/spec/generated/security.invalidate_api_key.json b/x-pack/plugins/console_extensions/server/spec/generated/security.invalidate_api_key.json
similarity index 100%
rename from x-pack/legacy/plugins/console_extensions/spec/generated/security.invalidate_api_key.json
rename to x-pack/plugins/console_extensions/server/spec/generated/security.invalidate_api_key.json
diff --git a/x-pack/legacy/plugins/console_extensions/spec/generated/security.invalidate_token.json b/x-pack/plugins/console_extensions/server/spec/generated/security.invalidate_token.json
similarity index 100%
rename from x-pack/legacy/plugins/console_extensions/spec/generated/security.invalidate_token.json
rename to x-pack/plugins/console_extensions/server/spec/generated/security.invalidate_token.json
diff --git a/x-pack/legacy/plugins/console_extensions/spec/generated/security.put_privileges.json b/x-pack/plugins/console_extensions/server/spec/generated/security.put_privileges.json
similarity index 89%
rename from x-pack/legacy/plugins/console_extensions/spec/generated/security.put_privileges.json
rename to x-pack/plugins/console_extensions/server/spec/generated/security.put_privileges.json
index 7ecffc780c066..a42d5eb6c953e 100644
--- a/x-pack/legacy/plugins/console_extensions/spec/generated/security.put_privileges.json
+++ b/x-pack/plugins/console_extensions/server/spec/generated/security.put_privileges.json
@@ -12,7 +12,7 @@
"POST"
],
"patterns": [
- "_security/privilege/"
+ "_security/privilege"
],
"documentation": "TODO"
}
diff --git a/x-pack/legacy/plugins/console_extensions/spec/generated/security.put_role.json b/x-pack/plugins/console_extensions/server/spec/generated/security.put_role.json
similarity index 100%
rename from x-pack/legacy/plugins/console_extensions/spec/generated/security.put_role.json
rename to x-pack/plugins/console_extensions/server/spec/generated/security.put_role.json
diff --git a/x-pack/legacy/plugins/console_extensions/spec/generated/security.put_role_mapping.json b/x-pack/plugins/console_extensions/server/spec/generated/security.put_role_mapping.json
similarity index 100%
rename from x-pack/legacy/plugins/console_extensions/spec/generated/security.put_role_mapping.json
rename to x-pack/plugins/console_extensions/server/spec/generated/security.put_role_mapping.json
diff --git a/x-pack/legacy/plugins/console_extensions/spec/generated/security.put_user.json b/x-pack/plugins/console_extensions/server/spec/generated/security.put_user.json
similarity index 100%
rename from x-pack/legacy/plugins/console_extensions/spec/generated/security.put_user.json
rename to x-pack/plugins/console_extensions/server/spec/generated/security.put_user.json
diff --git a/x-pack/legacy/plugins/console_extensions/spec/generated/slm.delete_lifecycle.json b/x-pack/plugins/console_extensions/server/spec/generated/slm.delete_lifecycle.json
similarity index 100%
rename from x-pack/legacy/plugins/console_extensions/spec/generated/slm.delete_lifecycle.json
rename to x-pack/plugins/console_extensions/server/spec/generated/slm.delete_lifecycle.json
diff --git a/x-pack/legacy/plugins/console_extensions/spec/generated/slm.execute_lifecycle.json b/x-pack/plugins/console_extensions/server/spec/generated/slm.execute_lifecycle.json
similarity index 100%
rename from x-pack/legacy/plugins/console_extensions/spec/generated/slm.execute_lifecycle.json
rename to x-pack/plugins/console_extensions/server/spec/generated/slm.execute_lifecycle.json
diff --git a/x-pack/legacy/plugins/console_extensions/spec/generated/slm.execute_retention.json b/x-pack/plugins/console_extensions/server/spec/generated/slm.execute_retention.json
similarity index 100%
rename from x-pack/legacy/plugins/console_extensions/spec/generated/slm.execute_retention.json
rename to x-pack/plugins/console_extensions/server/spec/generated/slm.execute_retention.json
diff --git a/x-pack/legacy/plugins/console_extensions/spec/generated/slm.get_lifecycle.json b/x-pack/plugins/console_extensions/server/spec/generated/slm.get_lifecycle.json
similarity index 100%
rename from x-pack/legacy/plugins/console_extensions/spec/generated/slm.get_lifecycle.json
rename to x-pack/plugins/console_extensions/server/spec/generated/slm.get_lifecycle.json
diff --git a/x-pack/legacy/plugins/console_extensions/spec/generated/slm.get_stats.json b/x-pack/plugins/console_extensions/server/spec/generated/slm.get_stats.json
similarity index 100%
rename from x-pack/legacy/plugins/console_extensions/spec/generated/slm.get_stats.json
rename to x-pack/plugins/console_extensions/server/spec/generated/slm.get_stats.json
diff --git a/x-pack/legacy/plugins/console_extensions/spec/generated/slm.get_status.json b/x-pack/plugins/console_extensions/server/spec/generated/slm.get_status.json
similarity index 100%
rename from x-pack/legacy/plugins/console_extensions/spec/generated/slm.get_status.json
rename to x-pack/plugins/console_extensions/server/spec/generated/slm.get_status.json
diff --git a/x-pack/legacy/plugins/console_extensions/spec/generated/slm.put_lifecycle.json b/x-pack/plugins/console_extensions/server/spec/generated/slm.put_lifecycle.json
similarity index 100%
rename from x-pack/legacy/plugins/console_extensions/spec/generated/slm.put_lifecycle.json
rename to x-pack/plugins/console_extensions/server/spec/generated/slm.put_lifecycle.json
diff --git a/x-pack/legacy/plugins/console_extensions/spec/generated/slm.start.json b/x-pack/plugins/console_extensions/server/spec/generated/slm.start.json
similarity index 100%
rename from x-pack/legacy/plugins/console_extensions/spec/generated/slm.start.json
rename to x-pack/plugins/console_extensions/server/spec/generated/slm.start.json
diff --git a/x-pack/legacy/plugins/console_extensions/spec/generated/slm.stop.json b/x-pack/plugins/console_extensions/server/spec/generated/slm.stop.json
similarity index 100%
rename from x-pack/legacy/plugins/console_extensions/spec/generated/slm.stop.json
rename to x-pack/plugins/console_extensions/server/spec/generated/slm.stop.json
diff --git a/x-pack/legacy/plugins/console_extensions/spec/generated/sql.clear_cursor.json b/x-pack/plugins/console_extensions/server/spec/generated/sql.clear_cursor.json
similarity index 100%
rename from x-pack/legacy/plugins/console_extensions/spec/generated/sql.clear_cursor.json
rename to x-pack/plugins/console_extensions/server/spec/generated/sql.clear_cursor.json
diff --git a/x-pack/legacy/plugins/console_extensions/spec/generated/sql.query.json b/x-pack/plugins/console_extensions/server/spec/generated/sql.query.json
similarity index 100%
rename from x-pack/legacy/plugins/console_extensions/spec/generated/sql.query.json
rename to x-pack/plugins/console_extensions/server/spec/generated/sql.query.json
diff --git a/x-pack/legacy/plugins/console_extensions/spec/generated/sql.translate.json b/x-pack/plugins/console_extensions/server/spec/generated/sql.translate.json
similarity index 100%
rename from x-pack/legacy/plugins/console_extensions/spec/generated/sql.translate.json
rename to x-pack/plugins/console_extensions/server/spec/generated/sql.translate.json
diff --git a/x-pack/legacy/plugins/console_extensions/spec/generated/ssl.certificates.json b/x-pack/plugins/console_extensions/server/spec/generated/ssl.certificates.json
similarity index 100%
rename from x-pack/legacy/plugins/console_extensions/spec/generated/ssl.certificates.json
rename to x-pack/plugins/console_extensions/server/spec/generated/ssl.certificates.json
diff --git a/x-pack/legacy/plugins/console_extensions/spec/generated/transform.delete_transform.json b/x-pack/plugins/console_extensions/server/spec/generated/transform.delete_transform.json
similarity index 100%
rename from x-pack/legacy/plugins/console_extensions/spec/generated/transform.delete_transform.json
rename to x-pack/plugins/console_extensions/server/spec/generated/transform.delete_transform.json
diff --git a/x-pack/legacy/plugins/console_extensions/spec/generated/transform.get_transform.json b/x-pack/plugins/console_extensions/server/spec/generated/transform.get_transform.json
similarity index 100%
rename from x-pack/legacy/plugins/console_extensions/spec/generated/transform.get_transform.json
rename to x-pack/plugins/console_extensions/server/spec/generated/transform.get_transform.json
diff --git a/x-pack/legacy/plugins/console_extensions/spec/generated/transform.get_transform_stats.json b/x-pack/plugins/console_extensions/server/spec/generated/transform.get_transform_stats.json
similarity index 100%
rename from x-pack/legacy/plugins/console_extensions/spec/generated/transform.get_transform_stats.json
rename to x-pack/plugins/console_extensions/server/spec/generated/transform.get_transform_stats.json
diff --git a/x-pack/legacy/plugins/console_extensions/spec/generated/transform.preview_transform.json b/x-pack/plugins/console_extensions/server/spec/generated/transform.preview_transform.json
similarity index 100%
rename from x-pack/legacy/plugins/console_extensions/spec/generated/transform.preview_transform.json
rename to x-pack/plugins/console_extensions/server/spec/generated/transform.preview_transform.json
diff --git a/x-pack/legacy/plugins/console_extensions/spec/generated/transform.put_transform.json b/x-pack/plugins/console_extensions/server/spec/generated/transform.put_transform.json
similarity index 100%
rename from x-pack/legacy/plugins/console_extensions/spec/generated/transform.put_transform.json
rename to x-pack/plugins/console_extensions/server/spec/generated/transform.put_transform.json
diff --git a/x-pack/legacy/plugins/console_extensions/spec/generated/transform.start_transform.json b/x-pack/plugins/console_extensions/server/spec/generated/transform.start_transform.json
similarity index 100%
rename from x-pack/legacy/plugins/console_extensions/spec/generated/transform.start_transform.json
rename to x-pack/plugins/console_extensions/server/spec/generated/transform.start_transform.json
diff --git a/x-pack/legacy/plugins/console_extensions/spec/generated/transform.stop_transform.json b/x-pack/plugins/console_extensions/server/spec/generated/transform.stop_transform.json
similarity index 100%
rename from x-pack/legacy/plugins/console_extensions/spec/generated/transform.stop_transform.json
rename to x-pack/plugins/console_extensions/server/spec/generated/transform.stop_transform.json
diff --git a/x-pack/legacy/plugins/console_extensions/spec/generated/transform.update_transform.json b/x-pack/plugins/console_extensions/server/spec/generated/transform.update_transform.json
similarity index 100%
rename from x-pack/legacy/plugins/console_extensions/spec/generated/transform.update_transform.json
rename to x-pack/plugins/console_extensions/server/spec/generated/transform.update_transform.json
diff --git a/x-pack/legacy/plugins/console_extensions/spec/generated/watcher.ack_watch.json b/x-pack/plugins/console_extensions/server/spec/generated/watcher.ack_watch.json
similarity index 100%
rename from x-pack/legacy/plugins/console_extensions/spec/generated/watcher.ack_watch.json
rename to x-pack/plugins/console_extensions/server/spec/generated/watcher.ack_watch.json
diff --git a/x-pack/legacy/plugins/console_extensions/spec/generated/watcher.activate_watch.json b/x-pack/plugins/console_extensions/server/spec/generated/watcher.activate_watch.json
similarity index 100%
rename from x-pack/legacy/plugins/console_extensions/spec/generated/watcher.activate_watch.json
rename to x-pack/plugins/console_extensions/server/spec/generated/watcher.activate_watch.json
diff --git a/x-pack/legacy/plugins/console_extensions/spec/generated/watcher.deactivate_watch.json b/x-pack/plugins/console_extensions/server/spec/generated/watcher.deactivate_watch.json
similarity index 100%
rename from x-pack/legacy/plugins/console_extensions/spec/generated/watcher.deactivate_watch.json
rename to x-pack/plugins/console_extensions/server/spec/generated/watcher.deactivate_watch.json
diff --git a/x-pack/legacy/plugins/console_extensions/spec/generated/watcher.delete_watch.json b/x-pack/plugins/console_extensions/server/spec/generated/watcher.delete_watch.json
similarity index 100%
rename from x-pack/legacy/plugins/console_extensions/spec/generated/watcher.delete_watch.json
rename to x-pack/plugins/console_extensions/server/spec/generated/watcher.delete_watch.json
diff --git a/x-pack/legacy/plugins/console_extensions/spec/generated/watcher.execute_watch.json b/x-pack/plugins/console_extensions/server/spec/generated/watcher.execute_watch.json
similarity index 100%
rename from x-pack/legacy/plugins/console_extensions/spec/generated/watcher.execute_watch.json
rename to x-pack/plugins/console_extensions/server/spec/generated/watcher.execute_watch.json
diff --git a/x-pack/legacy/plugins/console_extensions/spec/generated/watcher.get_watch.json b/x-pack/plugins/console_extensions/server/spec/generated/watcher.get_watch.json
similarity index 100%
rename from x-pack/legacy/plugins/console_extensions/spec/generated/watcher.get_watch.json
rename to x-pack/plugins/console_extensions/server/spec/generated/watcher.get_watch.json
diff --git a/x-pack/legacy/plugins/console_extensions/spec/generated/watcher.put_watch.json b/x-pack/plugins/console_extensions/server/spec/generated/watcher.put_watch.json
similarity index 100%
rename from x-pack/legacy/plugins/console_extensions/spec/generated/watcher.put_watch.json
rename to x-pack/plugins/console_extensions/server/spec/generated/watcher.put_watch.json
diff --git a/x-pack/legacy/plugins/console_extensions/spec/generated/watcher.start.json b/x-pack/plugins/console_extensions/server/spec/generated/watcher.start.json
similarity index 100%
rename from x-pack/legacy/plugins/console_extensions/spec/generated/watcher.start.json
rename to x-pack/plugins/console_extensions/server/spec/generated/watcher.start.json
diff --git a/x-pack/legacy/plugins/console_extensions/spec/generated/watcher.stats.json b/x-pack/plugins/console_extensions/server/spec/generated/watcher.stats.json
similarity index 100%
rename from x-pack/legacy/plugins/console_extensions/spec/generated/watcher.stats.json
rename to x-pack/plugins/console_extensions/server/spec/generated/watcher.stats.json
diff --git a/x-pack/legacy/plugins/console_extensions/spec/generated/watcher.stop.json b/x-pack/plugins/console_extensions/server/spec/generated/watcher.stop.json
similarity index 100%
rename from x-pack/legacy/plugins/console_extensions/spec/generated/watcher.stop.json
rename to x-pack/plugins/console_extensions/server/spec/generated/watcher.stop.json
diff --git a/x-pack/legacy/plugins/console_extensions/spec/generated/xpack.info.json b/x-pack/plugins/console_extensions/server/spec/generated/xpack.info.json
similarity index 100%
rename from x-pack/legacy/plugins/console_extensions/spec/generated/xpack.info.json
rename to x-pack/plugins/console_extensions/server/spec/generated/xpack.info.json
diff --git a/x-pack/legacy/plugins/console_extensions/spec/generated/xpack.ssl.certificates.json b/x-pack/plugins/console_extensions/server/spec/generated/xpack.ssl.certificates.json
similarity index 100%
rename from x-pack/legacy/plugins/console_extensions/spec/generated/xpack.ssl.certificates.json
rename to x-pack/plugins/console_extensions/server/spec/generated/xpack.ssl.certificates.json
diff --git a/x-pack/legacy/plugins/console_extensions/spec/generated/xpack.usage.json b/x-pack/plugins/console_extensions/server/spec/generated/xpack.usage.json
similarity index 100%
rename from x-pack/legacy/plugins/console_extensions/spec/generated/xpack.usage.json
rename to x-pack/plugins/console_extensions/server/spec/generated/xpack.usage.json
diff --git a/x-pack/legacy/plugins/console_extensions/spec/ingest/index.js b/x-pack/plugins/console_extensions/server/spec/ingest/index.ts
similarity index 100%
rename from x-pack/legacy/plugins/console_extensions/spec/ingest/index.js
rename to x-pack/plugins/console_extensions/server/spec/ingest/index.ts
diff --git a/x-pack/legacy/plugins/console_extensions/spec/overrides/ccr.follow.json b/x-pack/plugins/console_extensions/server/spec/overrides/ccr.follow.json
similarity index 100%
rename from x-pack/legacy/plugins/console_extensions/spec/overrides/ccr.follow.json
rename to x-pack/plugins/console_extensions/server/spec/overrides/ccr.follow.json
diff --git a/x-pack/legacy/plugins/console_extensions/spec/overrides/ccr.forget_follower.json b/x-pack/plugins/console_extensions/server/spec/overrides/ccr.forget_follower.json
similarity index 100%
rename from x-pack/legacy/plugins/console_extensions/spec/overrides/ccr.forget_follower.json
rename to x-pack/plugins/console_extensions/server/spec/overrides/ccr.forget_follower.json
diff --git a/x-pack/legacy/plugins/console_extensions/spec/overrides/ccr.put_auto_follow_pattern.json b/x-pack/plugins/console_extensions/server/spec/overrides/ccr.put_auto_follow_pattern.json
similarity index 100%
rename from x-pack/legacy/plugins/console_extensions/spec/overrides/ccr.put_auto_follow_pattern.json
rename to x-pack/plugins/console_extensions/server/spec/overrides/ccr.put_auto_follow_pattern.json
diff --git a/x-pack/legacy/plugins/console_extensions/spec/overrides/ccr.resume_follow.json b/x-pack/plugins/console_extensions/server/spec/overrides/ccr.resume_follow.json
similarity index 100%
rename from x-pack/legacy/plugins/console_extensions/spec/overrides/ccr.resume_follow.json
rename to x-pack/plugins/console_extensions/server/spec/overrides/ccr.resume_follow.json
diff --git a/x-pack/legacy/plugins/console_extensions/spec/overrides/enrich.put_policy.json b/x-pack/plugins/console_extensions/server/spec/overrides/enrich.put_policy.json
similarity index 100%
rename from x-pack/legacy/plugins/console_extensions/spec/overrides/enrich.put_policy.json
rename to x-pack/plugins/console_extensions/server/spec/overrides/enrich.put_policy.json
diff --git a/x-pack/legacy/plugins/console_extensions/spec/overrides/ilm.move_to_step.json b/x-pack/plugins/console_extensions/server/spec/overrides/ilm.move_to_step.json
similarity index 100%
rename from x-pack/legacy/plugins/console_extensions/spec/overrides/ilm.move_to_step.json
rename to x-pack/plugins/console_extensions/server/spec/overrides/ilm.move_to_step.json
diff --git a/x-pack/legacy/plugins/console_extensions/spec/overrides/ilm.put_lifecycle.json b/x-pack/plugins/console_extensions/server/spec/overrides/ilm.put_lifecycle.json
similarity index 100%
rename from x-pack/legacy/plugins/console_extensions/spec/overrides/ilm.put_lifecycle.json
rename to x-pack/plugins/console_extensions/server/spec/overrides/ilm.put_lifecycle.json
diff --git a/x-pack/legacy/plugins/console_extensions/spec/overrides/ml.estimate_memory_usage.json b/x-pack/plugins/console_extensions/server/spec/overrides/ml.estimate_memory_usage.json
similarity index 100%
rename from x-pack/legacy/plugins/console_extensions/spec/overrides/ml.estimate_memory_usage.json
rename to x-pack/plugins/console_extensions/server/spec/overrides/ml.estimate_memory_usage.json
diff --git a/x-pack/legacy/plugins/console_extensions/spec/overrides/ml.evaluate_data_frame.json b/x-pack/plugins/console_extensions/server/spec/overrides/ml.evaluate_data_frame.json
similarity index 100%
rename from x-pack/legacy/plugins/console_extensions/spec/overrides/ml.evaluate_data_frame.json
rename to x-pack/plugins/console_extensions/server/spec/overrides/ml.evaluate_data_frame.json
diff --git a/x-pack/legacy/plugins/console_extensions/spec/overrides/ml.explain_data_frame_analytics.json b/x-pack/plugins/console_extensions/server/spec/overrides/ml.explain_data_frame_analytics.json
similarity index 100%
rename from x-pack/legacy/plugins/console_extensions/spec/overrides/ml.explain_data_frame_analytics.json
rename to x-pack/plugins/console_extensions/server/spec/overrides/ml.explain_data_frame_analytics.json
diff --git a/x-pack/legacy/plugins/console_extensions/spec/overrides/ml.get_buckets.json b/x-pack/plugins/console_extensions/server/spec/overrides/ml.get_buckets.json
similarity index 100%
rename from x-pack/legacy/plugins/console_extensions/spec/overrides/ml.get_buckets.json
rename to x-pack/plugins/console_extensions/server/spec/overrides/ml.get_buckets.json
diff --git a/x-pack/legacy/plugins/console_extensions/spec/overrides/ml.get_calendar_events.json b/x-pack/plugins/console_extensions/server/spec/overrides/ml.get_calendar_events.json
similarity index 100%
rename from x-pack/legacy/plugins/console_extensions/spec/overrides/ml.get_calendar_events.json
rename to x-pack/plugins/console_extensions/server/spec/overrides/ml.get_calendar_events.json
diff --git a/x-pack/legacy/plugins/console_extensions/spec/overrides/ml.get_calendars.json b/x-pack/plugins/console_extensions/server/spec/overrides/ml.get_calendars.json
similarity index 100%
rename from x-pack/legacy/plugins/console_extensions/spec/overrides/ml.get_calendars.json
rename to x-pack/plugins/console_extensions/server/spec/overrides/ml.get_calendars.json
diff --git a/x-pack/legacy/plugins/console_extensions/spec/overrides/ml.get_categories.json b/x-pack/plugins/console_extensions/server/spec/overrides/ml.get_categories.json
similarity index 100%
rename from x-pack/legacy/plugins/console_extensions/spec/overrides/ml.get_categories.json
rename to x-pack/plugins/console_extensions/server/spec/overrides/ml.get_categories.json
diff --git a/x-pack/legacy/plugins/console_extensions/spec/overrides/ml.get_influencers.json b/x-pack/plugins/console_extensions/server/spec/overrides/ml.get_influencers.json
similarity index 100%
rename from x-pack/legacy/plugins/console_extensions/spec/overrides/ml.get_influencers.json
rename to x-pack/plugins/console_extensions/server/spec/overrides/ml.get_influencers.json
diff --git a/x-pack/legacy/plugins/console_extensions/spec/overrides/ml.get_model_snapshots.json b/x-pack/plugins/console_extensions/server/spec/overrides/ml.get_model_snapshots.json
similarity index 100%
rename from x-pack/legacy/plugins/console_extensions/spec/overrides/ml.get_model_snapshots.json
rename to x-pack/plugins/console_extensions/server/spec/overrides/ml.get_model_snapshots.json
diff --git a/x-pack/legacy/plugins/console_extensions/spec/overrides/ml.get_overall_buckets.json b/x-pack/plugins/console_extensions/server/spec/overrides/ml.get_overall_buckets.json
similarity index 100%
rename from x-pack/legacy/plugins/console_extensions/spec/overrides/ml.get_overall_buckets.json
rename to x-pack/plugins/console_extensions/server/spec/overrides/ml.get_overall_buckets.json
diff --git a/x-pack/legacy/plugins/console_extensions/spec/overrides/ml.get_records.json b/x-pack/plugins/console_extensions/server/spec/overrides/ml.get_records.json
similarity index 100%
rename from x-pack/legacy/plugins/console_extensions/spec/overrides/ml.get_records.json
rename to x-pack/plugins/console_extensions/server/spec/overrides/ml.get_records.json
diff --git a/x-pack/legacy/plugins/console_extensions/spec/overrides/ml.post_calendar_events.json b/x-pack/plugins/console_extensions/server/spec/overrides/ml.post_calendar_events.json
similarity index 100%
rename from x-pack/legacy/plugins/console_extensions/spec/overrides/ml.post_calendar_events.json
rename to x-pack/plugins/console_extensions/server/spec/overrides/ml.post_calendar_events.json
diff --git a/x-pack/legacy/plugins/console_extensions/spec/overrides/ml.put_calendar.json b/x-pack/plugins/console_extensions/server/spec/overrides/ml.put_calendar.json
similarity index 100%
rename from x-pack/legacy/plugins/console_extensions/spec/overrides/ml.put_calendar.json
rename to x-pack/plugins/console_extensions/server/spec/overrides/ml.put_calendar.json
diff --git a/x-pack/legacy/plugins/console_extensions/spec/overrides/ml.put_data_frame_analytics.json b/x-pack/plugins/console_extensions/server/spec/overrides/ml.put_data_frame_analytics.json
similarity index 100%
rename from x-pack/legacy/plugins/console_extensions/spec/overrides/ml.put_data_frame_analytics.json
rename to x-pack/plugins/console_extensions/server/spec/overrides/ml.put_data_frame_analytics.json
diff --git a/x-pack/legacy/plugins/console_extensions/spec/overrides/ml.put_datafeed.json b/x-pack/plugins/console_extensions/server/spec/overrides/ml.put_datafeed.json
similarity index 100%
rename from x-pack/legacy/plugins/console_extensions/spec/overrides/ml.put_datafeed.json
rename to x-pack/plugins/console_extensions/server/spec/overrides/ml.put_datafeed.json
diff --git a/x-pack/legacy/plugins/console_extensions/spec/overrides/ml.put_job.json b/x-pack/plugins/console_extensions/server/spec/overrides/ml.put_job.json
similarity index 100%
rename from x-pack/legacy/plugins/console_extensions/spec/overrides/ml.put_job.json
rename to x-pack/plugins/console_extensions/server/spec/overrides/ml.put_job.json
diff --git a/x-pack/legacy/plugins/console_extensions/spec/overrides/ml.put_trained_model.json b/x-pack/plugins/console_extensions/server/spec/overrides/ml.put_trained_model.json
similarity index 100%
rename from x-pack/legacy/plugins/console_extensions/spec/overrides/ml.put_trained_model.json
rename to x-pack/plugins/console_extensions/server/spec/overrides/ml.put_trained_model.json
diff --git a/x-pack/legacy/plugins/console_extensions/spec/overrides/ml.revert_model_snapshot.json b/x-pack/plugins/console_extensions/server/spec/overrides/ml.revert_model_snapshot.json
similarity index 100%
rename from x-pack/legacy/plugins/console_extensions/spec/overrides/ml.revert_model_snapshot.json
rename to x-pack/plugins/console_extensions/server/spec/overrides/ml.revert_model_snapshot.json
diff --git a/x-pack/legacy/plugins/console_extensions/spec/overrides/ml.update_datafeed.json b/x-pack/plugins/console_extensions/server/spec/overrides/ml.update_datafeed.json
similarity index 100%
rename from x-pack/legacy/plugins/console_extensions/spec/overrides/ml.update_datafeed.json
rename to x-pack/plugins/console_extensions/server/spec/overrides/ml.update_datafeed.json
diff --git a/x-pack/legacy/plugins/console_extensions/spec/overrides/ml.update_job.json b/x-pack/plugins/console_extensions/server/spec/overrides/ml.update_job.json
similarity index 100%
rename from x-pack/legacy/plugins/console_extensions/spec/overrides/ml.update_job.json
rename to x-pack/plugins/console_extensions/server/spec/overrides/ml.update_job.json
diff --git a/x-pack/legacy/plugins/console_extensions/spec/overrides/ml.update_model_snapshot.json b/x-pack/plugins/console_extensions/server/spec/overrides/ml.update_model_snapshot.json
similarity index 100%
rename from x-pack/legacy/plugins/console_extensions/spec/overrides/ml.update_model_snapshot.json
rename to x-pack/plugins/console_extensions/server/spec/overrides/ml.update_model_snapshot.json
diff --git a/x-pack/legacy/plugins/console_extensions/spec/overrides/security.authenticate.json b/x-pack/plugins/console_extensions/server/spec/overrides/security.authenticate.json
similarity index 100%
rename from x-pack/legacy/plugins/console_extensions/spec/overrides/security.authenticate.json
rename to x-pack/plugins/console_extensions/server/spec/overrides/security.authenticate.json
diff --git a/x-pack/legacy/plugins/console_extensions/spec/overrides/security.change_password.json b/x-pack/plugins/console_extensions/server/spec/overrides/security.change_password.json
similarity index 100%
rename from x-pack/legacy/plugins/console_extensions/spec/overrides/security.change_password.json
rename to x-pack/plugins/console_extensions/server/spec/overrides/security.change_password.json
diff --git a/x-pack/legacy/plugins/console_extensions/spec/overrides/security.create_api_key.json b/x-pack/plugins/console_extensions/server/spec/overrides/security.create_api_key.json
similarity index 100%
rename from x-pack/legacy/plugins/console_extensions/spec/overrides/security.create_api_key.json
rename to x-pack/plugins/console_extensions/server/spec/overrides/security.create_api_key.json
diff --git a/x-pack/legacy/plugins/console_extensions/spec/overrides/security.delete_privileges.json b/x-pack/plugins/console_extensions/server/spec/overrides/security.delete_privileges.json
similarity index 76%
rename from x-pack/legacy/plugins/console_extensions/spec/overrides/security.delete_privileges.json
rename to x-pack/plugins/console_extensions/server/spec/overrides/security.delete_privileges.json
index 35fb78c532c12..5486098ff7bd8 100644
--- a/x-pack/legacy/plugins/console_extensions/spec/overrides/security.delete_privileges.json
+++ b/x-pack/plugins/console_extensions/server/spec/overrides/security.delete_privileges.json
@@ -1,3 +1,5 @@
{
+ "security.delete_privileges": {
"documentation": "https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-delete-privilege.html"
+ }
}
diff --git a/x-pack/legacy/plugins/console_extensions/spec/overrides/security.get_token.json b/x-pack/plugins/console_extensions/server/spec/overrides/security.get_token.json
similarity index 100%
rename from x-pack/legacy/plugins/console_extensions/spec/overrides/security.get_token.json
rename to x-pack/plugins/console_extensions/server/spec/overrides/security.get_token.json
diff --git a/x-pack/legacy/plugins/console_extensions/spec/overrides/security.has_privileges.json b/x-pack/plugins/console_extensions/server/spec/overrides/security.has_privileges.json
similarity index 100%
rename from x-pack/legacy/plugins/console_extensions/spec/overrides/security.has_privileges.json
rename to x-pack/plugins/console_extensions/server/spec/overrides/security.has_privileges.json
diff --git a/x-pack/legacy/plugins/console_extensions/spec/overrides/security.invalidate_api_key.json b/x-pack/plugins/console_extensions/server/spec/overrides/security.invalidate_api_key.json
similarity index 100%
rename from x-pack/legacy/plugins/console_extensions/spec/overrides/security.invalidate_api_key.json
rename to x-pack/plugins/console_extensions/server/spec/overrides/security.invalidate_api_key.json
diff --git a/x-pack/legacy/plugins/console_extensions/spec/overrides/security.invalidate_token.json b/x-pack/plugins/console_extensions/server/spec/overrides/security.invalidate_token.json
similarity index 100%
rename from x-pack/legacy/plugins/console_extensions/spec/overrides/security.invalidate_token.json
rename to x-pack/plugins/console_extensions/server/spec/overrides/security.invalidate_token.json
diff --git a/x-pack/legacy/plugins/console_extensions/spec/overrides/security.put_privileges.json b/x-pack/plugins/console_extensions/server/spec/overrides/security.put_privileges.json
similarity index 77%
rename from x-pack/legacy/plugins/console_extensions/spec/overrides/security.put_privileges.json
rename to x-pack/plugins/console_extensions/server/spec/overrides/security.put_privileges.json
index ae37d9a889543..9ebb1046047a7 100644
--- a/x-pack/legacy/plugins/console_extensions/spec/overrides/security.put_privileges.json
+++ b/x-pack/plugins/console_extensions/server/spec/overrides/security.put_privileges.json
@@ -1,3 +1,5 @@
{
+ "security.put_privileges": {
"documentation": "https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-put-privileges.html"
+ }
}
diff --git a/x-pack/legacy/plugins/console_extensions/spec/overrides/security.put_role.json b/x-pack/plugins/console_extensions/server/spec/overrides/security.put_role.json
similarity index 100%
rename from x-pack/legacy/plugins/console_extensions/spec/overrides/security.put_role.json
rename to x-pack/plugins/console_extensions/server/spec/overrides/security.put_role.json
diff --git a/x-pack/legacy/plugins/console_extensions/spec/overrides/security.put_role_mapping.json b/x-pack/plugins/console_extensions/server/spec/overrides/security.put_role_mapping.json
similarity index 100%
rename from x-pack/legacy/plugins/console_extensions/spec/overrides/security.put_role_mapping.json
rename to x-pack/plugins/console_extensions/server/spec/overrides/security.put_role_mapping.json
diff --git a/x-pack/legacy/plugins/console_extensions/spec/overrides/security.put_user.json b/x-pack/plugins/console_extensions/server/spec/overrides/security.put_user.json
similarity index 100%
rename from x-pack/legacy/plugins/console_extensions/spec/overrides/security.put_user.json
rename to x-pack/plugins/console_extensions/server/spec/overrides/security.put_user.json
diff --git a/x-pack/legacy/plugins/console_extensions/spec/overrides/slm.put_lifecycle.json b/x-pack/plugins/console_extensions/server/spec/overrides/slm.put_lifecycle.json
similarity index 100%
rename from x-pack/legacy/plugins/console_extensions/spec/overrides/slm.put_lifecycle.json
rename to x-pack/plugins/console_extensions/server/spec/overrides/slm.put_lifecycle.json
diff --git a/x-pack/legacy/plugins/console_extensions/spec/overrides/slm.start.json b/x-pack/plugins/console_extensions/server/spec/overrides/slm.start.json
similarity index 100%
rename from x-pack/legacy/plugins/console_extensions/spec/overrides/slm.start.json
rename to x-pack/plugins/console_extensions/server/spec/overrides/slm.start.json
diff --git a/x-pack/legacy/plugins/console_extensions/spec/overrides/slm.stop.json b/x-pack/plugins/console_extensions/server/spec/overrides/slm.stop.json
similarity index 100%
rename from x-pack/legacy/plugins/console_extensions/spec/overrides/slm.stop.json
rename to x-pack/plugins/console_extensions/server/spec/overrides/slm.stop.json
diff --git a/x-pack/legacy/plugins/console_extensions/spec/overrides/sql.query.json b/x-pack/plugins/console_extensions/server/spec/overrides/sql.query.json
similarity index 100%
rename from x-pack/legacy/plugins/console_extensions/spec/overrides/sql.query.json
rename to x-pack/plugins/console_extensions/server/spec/overrides/sql.query.json
diff --git a/x-pack/legacy/plugins/console_extensions/spec/overrides/transform.get_transform_stats.json b/x-pack/plugins/console_extensions/server/spec/overrides/transform.get_transform_stats.json
similarity index 100%
rename from x-pack/legacy/plugins/console_extensions/spec/overrides/transform.get_transform_stats.json
rename to x-pack/plugins/console_extensions/server/spec/overrides/transform.get_transform_stats.json
diff --git a/x-pack/legacy/plugins/console_extensions/spec/overrides/transform.preview_transform.json b/x-pack/plugins/console_extensions/server/spec/overrides/transform.preview_transform.json
similarity index 100%
rename from x-pack/legacy/plugins/console_extensions/spec/overrides/transform.preview_transform.json
rename to x-pack/plugins/console_extensions/server/spec/overrides/transform.preview_transform.json
diff --git a/x-pack/legacy/plugins/console_extensions/spec/overrides/transform.put_transform.json b/x-pack/plugins/console_extensions/server/spec/overrides/transform.put_transform.json
similarity index 100%
rename from x-pack/legacy/plugins/console_extensions/spec/overrides/transform.put_transform.json
rename to x-pack/plugins/console_extensions/server/spec/overrides/transform.put_transform.json
diff --git a/x-pack/legacy/plugins/console_extensions/spec/overrides/transform.stop_transform.json b/x-pack/plugins/console_extensions/server/spec/overrides/transform.stop_transform.json
similarity index 100%
rename from x-pack/legacy/plugins/console_extensions/spec/overrides/transform.stop_transform.json
rename to x-pack/plugins/console_extensions/server/spec/overrides/transform.stop_transform.json
diff --git a/x-pack/legacy/plugins/console_extensions/spec/overrides/transform.update_transform.json b/x-pack/plugins/console_extensions/server/spec/overrides/transform.update_transform.json
similarity index 100%
rename from x-pack/legacy/plugins/console_extensions/spec/overrides/transform.update_transform.json
rename to x-pack/plugins/console_extensions/server/spec/overrides/transform.update_transform.json
diff --git a/x-pack/legacy/plugins/console_extensions/spec/overrides/xpack.graph.explore.json b/x-pack/plugins/console_extensions/server/spec/overrides/xpack.graph.explore.json
similarity index 100%
rename from x-pack/legacy/plugins/console_extensions/spec/overrides/xpack.graph.explore.json
rename to x-pack/plugins/console_extensions/server/spec/overrides/xpack.graph.explore.json
diff --git a/x-pack/legacy/plugins/console_extensions/spec/overrides/xpack.info.json b/x-pack/plugins/console_extensions/server/spec/overrides/xpack.info.json
similarity index 100%
rename from x-pack/legacy/plugins/console_extensions/spec/overrides/xpack.info.json
rename to x-pack/plugins/console_extensions/server/spec/overrides/xpack.info.json
diff --git a/x-pack/legacy/plugins/console_extensions/spec/overrides/xpack.license.post.json b/x-pack/plugins/console_extensions/server/spec/overrides/xpack.license.post.json
similarity index 100%
rename from x-pack/legacy/plugins/console_extensions/spec/overrides/xpack.license.post.json
rename to x-pack/plugins/console_extensions/server/spec/overrides/xpack.license.post.json
diff --git a/x-pack/legacy/plugins/console_extensions/spec/overrides/xpack.rollup.delete_job.json b/x-pack/plugins/console_extensions/server/spec/overrides/xpack.rollup.delete_job.json
similarity index 100%
rename from x-pack/legacy/plugins/console_extensions/spec/overrides/xpack.rollup.delete_job.json
rename to x-pack/plugins/console_extensions/server/spec/overrides/xpack.rollup.delete_job.json
diff --git a/x-pack/legacy/plugins/console_extensions/spec/overrides/xpack.rollup.put_job.json b/x-pack/plugins/console_extensions/server/spec/overrides/xpack.rollup.put_job.json
similarity index 100%
rename from x-pack/legacy/plugins/console_extensions/spec/overrides/xpack.rollup.put_job.json
rename to x-pack/plugins/console_extensions/server/spec/overrides/xpack.rollup.put_job.json
diff --git a/x-pack/legacy/plugins/console_extensions/spec/overrides/xpack.rollup.rollup_search.json b/x-pack/plugins/console_extensions/server/spec/overrides/xpack.rollup.rollup_search.json
similarity index 100%
rename from x-pack/legacy/plugins/console_extensions/spec/overrides/xpack.rollup.rollup_search.json
rename to x-pack/plugins/console_extensions/server/spec/overrides/xpack.rollup.rollup_search.json
diff --git a/x-pack/legacy/plugins/console_extensions/spec/overrides/xpack.security.authenticate.json b/x-pack/plugins/console_extensions/server/spec/overrides/xpack.security.authenticate.json
similarity index 100%
rename from x-pack/legacy/plugins/console_extensions/spec/overrides/xpack.security.authenticate.json
rename to x-pack/plugins/console_extensions/server/spec/overrides/xpack.security.authenticate.json
diff --git a/x-pack/legacy/plugins/console_extensions/spec/overrides/xpack.security.change_password.json b/x-pack/plugins/console_extensions/server/spec/overrides/xpack.security.change_password.json
similarity index 100%
rename from x-pack/legacy/plugins/console_extensions/spec/overrides/xpack.security.change_password.json
rename to x-pack/plugins/console_extensions/server/spec/overrides/xpack.security.change_password.json
diff --git a/x-pack/legacy/plugins/console_extensions/spec/overrides/xpack.security.get_token.json b/x-pack/plugins/console_extensions/server/spec/overrides/xpack.security.get_token.json
similarity index 100%
rename from x-pack/legacy/plugins/console_extensions/spec/overrides/xpack.security.get_token.json
rename to x-pack/plugins/console_extensions/server/spec/overrides/xpack.security.get_token.json
diff --git a/x-pack/legacy/plugins/console_extensions/spec/overrides/xpack.security.invalidate_token.json b/x-pack/plugins/console_extensions/server/spec/overrides/xpack.security.invalidate_token.json
similarity index 100%
rename from x-pack/legacy/plugins/console_extensions/spec/overrides/xpack.security.invalidate_token.json
rename to x-pack/plugins/console_extensions/server/spec/overrides/xpack.security.invalidate_token.json
diff --git a/x-pack/legacy/plugins/console_extensions/spec/overrides/xpack.security.put_role.json b/x-pack/plugins/console_extensions/server/spec/overrides/xpack.security.put_role.json
similarity index 100%
rename from x-pack/legacy/plugins/console_extensions/spec/overrides/xpack.security.put_role.json
rename to x-pack/plugins/console_extensions/server/spec/overrides/xpack.security.put_role.json
diff --git a/x-pack/legacy/plugins/console_extensions/spec/overrides/xpack.security.put_role_mapping.json b/x-pack/plugins/console_extensions/server/spec/overrides/xpack.security.put_role_mapping.json
similarity index 100%
rename from x-pack/legacy/plugins/console_extensions/spec/overrides/xpack.security.put_role_mapping.json
rename to x-pack/plugins/console_extensions/server/spec/overrides/xpack.security.put_role_mapping.json
diff --git a/x-pack/legacy/plugins/console_extensions/spec/overrides/xpack.security.put_user.json b/x-pack/plugins/console_extensions/server/spec/overrides/xpack.security.put_user.json
similarity index 100%
rename from x-pack/legacy/plugins/console_extensions/spec/overrides/xpack.security.put_user.json
rename to x-pack/plugins/console_extensions/server/spec/overrides/xpack.security.put_user.json
diff --git a/x-pack/legacy/plugins/console_extensions/spec/overrides/xpack.watcher.execute_watch.json b/x-pack/plugins/console_extensions/server/spec/overrides/xpack.watcher.execute_watch.json
similarity index 100%
rename from x-pack/legacy/plugins/console_extensions/spec/overrides/xpack.watcher.execute_watch.json
rename to x-pack/plugins/console_extensions/server/spec/overrides/xpack.watcher.execute_watch.json
diff --git a/x-pack/legacy/plugins/console_extensions/spec/overrides/xpack.watcher.put_watch.json b/x-pack/plugins/console_extensions/server/spec/overrides/xpack.watcher.put_watch.json
similarity index 100%
rename from x-pack/legacy/plugins/console_extensions/spec/overrides/xpack.watcher.put_watch.json
rename to x-pack/plugins/console_extensions/server/spec/overrides/xpack.watcher.put_watch.json
diff --git a/x-pack/test/api_integration/apis/uptime/graphql/fixtures/snapshot_histogram.json b/x-pack/test/api_integration/apis/uptime/graphql/fixtures/snapshot_histogram.json
deleted file mode 100644
index cf88ccae9cb99..0000000000000
--- a/x-pack/test/api_integration/apis/uptime/graphql/fixtures/snapshot_histogram.json
+++ /dev/null
@@ -1,188 +0,0 @@
-{
- "queryResult": {
- "histogram": [
- {
- "upCount": 93,
- "downCount": 7,
- "x": 1568172657286,
- "x0": null,
- "y": 1
- },
- {
- "upCount": 93,
- "downCount": 7,
- "x": 1568172680087,
- "x0": null,
- "y": 1
- },
- {
- "upCount": 93,
- "downCount": 7,
- "x": 1568172702888,
- "x0": null,
- "y": 1
- },
- {
- "upCount": 0,
- "downCount": 0,
- "x": 1568172725689,
- "x0": null,
- "y": 1
- },
- {
- "upCount": 93,
- "downCount": 7,
- "x": 1568172748490,
- "x0": null,
- "y": 1
- },
- {
- "upCount": 93,
- "downCount": 7,
- "x": 1568172771291,
- "x0": null,
- "y": 1
- },
- {
- "upCount": 92,
- "downCount": 8,
- "x": 1568172794092,
- "x0": null,
- "y": 1
- },
- {
- "upCount": 0,
- "downCount": 0,
- "x": 1568172816893,
- "x0": null,
- "y": 1
- },
- {
- "upCount": 93,
- "downCount": 7,
- "x": 1568172839694,
- "x0": null,
- "y": 1
- },
- {
- "upCount": 93,
- "downCount": 7,
- "x": 1568172862495,
- "x0": null,
- "y": 1
- },
- {
- "upCount": 93,
- "downCount": 7,
- "x": 1568172885296,
- "x0": null,
- "y": 1
- },
- {
- "upCount": 0,
- "downCount": 0,
- "x": 1568172908097,
- "x0": null,
- "y": 1
- },
- {
- "upCount": 93,
- "downCount": 7,
- "x": 1568172930898,
- "x0": null,
- "y": 1
- },
- {
- "upCount": 93,
- "downCount": 7,
- "x": 1568172953699,
- "x0": null,
- "y": 1
- },
- {
- "upCount": 92,
- "downCount": 8,
- "x": 1568172976500,
- "x0": null,
- "y": 1
- },
- {
- "upCount": 0,
- "downCount": 0,
- "x": 1568172999301,
- "x0": null,
- "y": 1
- },
- {
- "upCount": 93,
- "downCount": 7,
- "x": 1568173022102,
- "x0": null,
- "y": 1
- },
- {
- "upCount": 93,
- "downCount": 7,
- "x": 1568173044903,
- "x0": null,
- "y": 1
- },
- {
- "upCount": 93,
- "downCount": 7,
- "x": 1568173067704,
- "x0": null,
- "y": 1
- },
- {
- "upCount": 0,
- "downCount": 0,
- "x": 1568173090505,
- "x0": null,
- "y": 1
- },
- {
- "upCount": 93,
- "downCount": 7,
- "x": 1568173113306,
- "x0": null,
- "y": 1
- },
- {
- "upCount": 93,
- "downCount": 7,
- "x": 1568173136107,
- "x0": null,
- "y": 1
- },
- {
- "upCount": 92,
- "downCount": 8,
- "x": 1568173158908,
- "x0": null,
- "y": 1
- },
- {
- "upCount": 93,
- "downCount": 7,
- "x": 1568173181709,
- "x0": null,
- "y": 1
- },
- {
- "upCount": 0,
- "downCount": 0,
- "x": 1568173204510,
- "x0": null,
- "y": 1
- },
- {
- "upCount": 93,
- "downCount": 7,
- "x": 1568173227311,
- "x0": null,
- "y": 1
- }
- ]
- }
-}
\ No newline at end of file
diff --git a/x-pack/test/api_integration/apis/uptime/graphql/fixtures/snapshot_histogram_by_filter.json b/x-pack/test/api_integration/apis/uptime/graphql/fixtures/snapshot_histogram_by_filter.json
deleted file mode 100644
index 383d4acd96340..0000000000000
--- a/x-pack/test/api_integration/apis/uptime/graphql/fixtures/snapshot_histogram_by_filter.json
+++ /dev/null
@@ -1,188 +0,0 @@
-{
- "queryResult": {
- "histogram": [
- {
- "upCount": 93,
- "downCount": 0,
- "x": 1568172657286,
- "x0": null,
- "y": 1
- },
- {
- "upCount": 93,
- "downCount": 0,
- "x": 1568172680087,
- "x0": null,
- "y": 1
- },
- {
- "upCount": 93,
- "downCount": 0,
- "x": 1568172702888,
- "x0": null,
- "y": 1
- },
- {
- "upCount": 0,
- "downCount": 0,
- "x": 1568172725689,
- "x0": null,
- "y": 1
- },
- {
- "upCount": 93,
- "downCount": 0,
- "x": 1568172748490,
- "x0": null,
- "y": 1
- },
- {
- "upCount": 93,
- "downCount": 0,
- "x": 1568172771291,
- "x0": null,
- "y": 1
- },
- {
- "upCount": 92,
- "downCount": 0,
- "x": 1568172794092,
- "x0": null,
- "y": 1
- },
- {
- "upCount": 0,
- "downCount": 0,
- "x": 1568172816893,
- "x0": null,
- "y": 1
- },
- {
- "upCount": 93,
- "downCount": 0,
- "x": 1568172839694,
- "x0": null,
- "y": 1
- },
- {
- "upCount": 93,
- "downCount": 0,
- "x": 1568172862495,
- "x0": null,
- "y": 1
- },
- {
- "upCount": 93,
- "downCount": 0,
- "x": 1568172885296,
- "x0": null,
- "y": 1
- },
- {
- "upCount": 0,
- "downCount": 0,
- "x": 1568172908097,
- "x0": null,
- "y": 1
- },
- {
- "upCount": 93,
- "downCount": 0,
- "x": 1568172930898,
- "x0": null,
- "y": 1
- },
- {
- "upCount": 93,
- "downCount": 0,
- "x": 1568172953699,
- "x0": null,
- "y": 1
- },
- {
- "upCount": 92,
- "downCount": 0,
- "x": 1568172976500,
- "x0": null,
- "y": 1
- },
- {
- "upCount": 0,
- "downCount": 0,
- "x": 1568172999301,
- "x0": null,
- "y": 1
- },
- {
- "upCount": 93,
- "downCount": 0,
- "x": 1568173022102,
- "x0": null,
- "y": 1
- },
- {
- "upCount": 93,
- "downCount": 0,
- "x": 1568173044903,
- "x0": null,
- "y": 1
- },
- {
- "upCount": 93,
- "downCount": 0,
- "x": 1568173067704,
- "x0": null,
- "y": 1
- },
- {
- "upCount": 0,
- "downCount": 0,
- "x": 1568173090505,
- "x0": null,
- "y": 1
- },
- {
- "upCount": 93,
- "downCount": 0,
- "x": 1568173113306,
- "x0": null,
- "y": 1
- },
- {
- "upCount": 93,
- "downCount": 0,
- "x": 1568173136107,
- "x0": null,
- "y": 1
- },
- {
- "upCount": 92,
- "downCount": 0,
- "x": 1568173158908,
- "x0": null,
- "y": 1
- },
- {
- "upCount": 93,
- "downCount": 0,
- "x": 1568173181709,
- "x0": null,
- "y": 1
- },
- {
- "upCount": 0,
- "downCount": 0,
- "x": 1568173204510,
- "x0": null,
- "y": 1
- },
- {
- "upCount": 93,
- "downCount": 0,
- "x": 1568173227311,
- "x0": null,
- "y": 1
- }
- ]
- }
-}
\ No newline at end of file
diff --git a/x-pack/test/api_integration/apis/uptime/graphql/fixtures/snapshot_histogram_by_id.json b/x-pack/test/api_integration/apis/uptime/graphql/fixtures/snapshot_histogram_by_id.json
deleted file mode 100644
index cf88ccae9cb99..0000000000000
--- a/x-pack/test/api_integration/apis/uptime/graphql/fixtures/snapshot_histogram_by_id.json
+++ /dev/null
@@ -1,188 +0,0 @@
-{
- "queryResult": {
- "histogram": [
- {
- "upCount": 93,
- "downCount": 7,
- "x": 1568172657286,
- "x0": null,
- "y": 1
- },
- {
- "upCount": 93,
- "downCount": 7,
- "x": 1568172680087,
- "x0": null,
- "y": 1
- },
- {
- "upCount": 93,
- "downCount": 7,
- "x": 1568172702888,
- "x0": null,
- "y": 1
- },
- {
- "upCount": 0,
- "downCount": 0,
- "x": 1568172725689,
- "x0": null,
- "y": 1
- },
- {
- "upCount": 93,
- "downCount": 7,
- "x": 1568172748490,
- "x0": null,
- "y": 1
- },
- {
- "upCount": 93,
- "downCount": 7,
- "x": 1568172771291,
- "x0": null,
- "y": 1
- },
- {
- "upCount": 92,
- "downCount": 8,
- "x": 1568172794092,
- "x0": null,
- "y": 1
- },
- {
- "upCount": 0,
- "downCount": 0,
- "x": 1568172816893,
- "x0": null,
- "y": 1
- },
- {
- "upCount": 93,
- "downCount": 7,
- "x": 1568172839694,
- "x0": null,
- "y": 1
- },
- {
- "upCount": 93,
- "downCount": 7,
- "x": 1568172862495,
- "x0": null,
- "y": 1
- },
- {
- "upCount": 93,
- "downCount": 7,
- "x": 1568172885296,
- "x0": null,
- "y": 1
- },
- {
- "upCount": 0,
- "downCount": 0,
- "x": 1568172908097,
- "x0": null,
- "y": 1
- },
- {
- "upCount": 93,
- "downCount": 7,
- "x": 1568172930898,
- "x0": null,
- "y": 1
- },
- {
- "upCount": 93,
- "downCount": 7,
- "x": 1568172953699,
- "x0": null,
- "y": 1
- },
- {
- "upCount": 92,
- "downCount": 8,
- "x": 1568172976500,
- "x0": null,
- "y": 1
- },
- {
- "upCount": 0,
- "downCount": 0,
- "x": 1568172999301,
- "x0": null,
- "y": 1
- },
- {
- "upCount": 93,
- "downCount": 7,
- "x": 1568173022102,
- "x0": null,
- "y": 1
- },
- {
- "upCount": 93,
- "downCount": 7,
- "x": 1568173044903,
- "x0": null,
- "y": 1
- },
- {
- "upCount": 93,
- "downCount": 7,
- "x": 1568173067704,
- "x0": null,
- "y": 1
- },
- {
- "upCount": 0,
- "downCount": 0,
- "x": 1568173090505,
- "x0": null,
- "y": 1
- },
- {
- "upCount": 93,
- "downCount": 7,
- "x": 1568173113306,
- "x0": null,
- "y": 1
- },
- {
- "upCount": 93,
- "downCount": 7,
- "x": 1568173136107,
- "x0": null,
- "y": 1
- },
- {
- "upCount": 92,
- "downCount": 8,
- "x": 1568173158908,
- "x0": null,
- "y": 1
- },
- {
- "upCount": 93,
- "downCount": 7,
- "x": 1568173181709,
- "x0": null,
- "y": 1
- },
- {
- "upCount": 0,
- "downCount": 0,
- "x": 1568173204510,
- "x0": null,
- "y": 1
- },
- {
- "upCount": 93,
- "downCount": 7,
- "x": 1568173227311,
- "x0": null,
- "y": 1
- }
- ]
- }
-}
\ No newline at end of file
diff --git a/x-pack/test/api_integration/apis/uptime/graphql/index.js b/x-pack/test/api_integration/apis/uptime/graphql/index.js
index 64999761fde4e..54284377ec430 100644
--- a/x-pack/test/api_integration/apis/uptime/graphql/index.js
+++ b/x-pack/test/api_integration/apis/uptime/graphql/index.js
@@ -14,6 +14,5 @@ export default function({ loadTestFile }) {
loadTestFile(require.resolve('./monitor_charts'));
loadTestFile(require.resolve('./monitor_states'));
loadTestFile(require.resolve('./ping_list'));
- loadTestFile(require.resolve('./snapshot_histogram'));
});
}
diff --git a/x-pack/test/api_integration/apis/uptime/graphql/snapshot_histogram.ts b/x-pack/test/api_integration/apis/uptime/graphql/snapshot_histogram.ts
deleted file mode 100644
index 02fd3fd630d4b..0000000000000
--- a/x-pack/test/api_integration/apis/uptime/graphql/snapshot_histogram.ts
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * 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 { snapshotHistogramQueryString } from '../../../../../legacy/plugins/uptime/public/queries/snapshot_histogram_query';
-import { expectFixtureEql } from './helpers/expect_fixture_eql';
-import { FtrProviderContext } from '../../../ftr_provider_context';
-import { assertCloseTo } from '../../../../../legacy/plugins/uptime/server/lib/helper';
-
-export default function({ getService }: FtrProviderContext) {
- describe('snapshotHistogram', () => {
- before('load heartbeat data', () => getService('esArchiver').load('uptime/full_heartbeat'));
- after('unload heartbeat index', () => getService('esArchiver').unload('uptime/full_heartbeat'));
-
- const supertest = getService('supertest');
-
- it('will fetch histogram data for all monitors', async () => {
- const getSnapshotHistogramQuery = {
- operationName: 'SnapshotHistogram',
- query: snapshotHistogramQueryString,
- variables: {
- dateRangeStart: '2019-09-11T03:31:04.380Z',
- dateRangeEnd: '2019-09-11T03:40:34.410Z',
- },
- };
-
- const {
- body: { data },
- } = await supertest
- .post('/api/uptime/graphql')
- .set('kbn-xsrf', 'foo')
- .send({ ...getSnapshotHistogramQuery });
- // manually testing this value and then removing it to avoid flakiness
- const { interval } = data.queryResult;
- assertCloseTo(interval, 22801, 100);
- delete data.queryResult.interval;
- expectFixtureEql(data, 'snapshot_histogram');
- });
-
- it('will fetch histogram data for a given monitor id', async () => {
- const getSnapshotHistogramQuery = {
- operationName: 'SnapshotHistogram',
- query: snapshotHistogramQueryString,
- variables: {
- dateRangeStart: '2019-09-11T03:31:04.380Z',
- dateRangeEnd: '2019-09-11T03:40:34.410Z',
- },
- };
-
- const {
- body: { data },
- } = await supertest
- .post('/api/uptime/graphql')
- .set('kbn-xsrf', 'foo')
- .send({ ...getSnapshotHistogramQuery });
- const { interval } = data.queryResult;
- assertCloseTo(interval, 22801, 100);
- delete data.queryResult.interval;
- expectFixtureEql(data, 'snapshot_histogram_by_id');
- });
-
- it('will fetch histogram data for a given filter', async () => {
- const getSnapshotHistogramQuery = {
- operationName: 'SnapshotHistogram',
- query: snapshotHistogramQueryString,
- variables: {
- dateRangeStart: '2019-09-11T03:31:04.380Z',
- dateRangeEnd: '2019-09-11T03:40:34.410Z',
- filters:
- '{"bool":{"must":[{"match":{"monitor.status":{"query":"up","operator":"and"}}}]}}',
- },
- };
-
- const {
- body: { data },
- } = await supertest
- .post('/api/uptime/graphql')
- .set('kbn-xsrf', 'foo')
- .send({ ...getSnapshotHistogramQuery });
- const { interval } = data.queryResult;
- assertCloseTo(interval, 22801, 100);
- delete data.queryResult.interval;
- expectFixtureEql(data, 'snapshot_histogram_by_filter');
- });
- });
-}
diff --git a/x-pack/test/api_integration/apis/uptime/rest/fixtures/ping_histogram.json b/x-pack/test/api_integration/apis/uptime/rest/fixtures/ping_histogram.json
new file mode 100644
index 0000000000000..972d1fd51760c
--- /dev/null
+++ b/x-pack/test/api_integration/apis/uptime/rest/fixtures/ping_histogram.json
@@ -0,0 +1,24 @@
+{
+ "histogram": [
+ { "x": 1568172664000, "downCount": 7, "upCount": 93, "y": 1 },
+ { "x": 1568172694000, "downCount": 7, "upCount": 93, "y": 1 },
+ { "x": 1568172724000, "downCount": 7, "upCount": 93, "y": 1 },
+ { "x": 1568172754000, "downCount": 7, "upCount": 93, "y": 1 },
+ { "x": 1568172784000, "downCount": 7, "upCount": 93, "y": 1 },
+ { "x": 1568172814000, "downCount": 8, "upCount": 92, "y": 1 },
+ { "x": 1568172844000, "downCount": 7, "upCount": 93, "y": 1 },
+ { "x": 1568172874000, "downCount": 7, "upCount": 93, "y": 1 },
+ { "x": 1568172904000, "downCount": 7, "upCount": 93, "y": 1 },
+ { "x": 1568172934000, "downCount": 7, "upCount": 93, "y": 1 },
+ { "x": 1568172964000, "downCount": 7, "upCount": 93, "y": 1 },
+ { "x": 1568172994000, "downCount": 8, "upCount": 92, "y": 1 },
+ { "x": 1568173024000, "downCount": 7, "upCount": 93, "y": 1 },
+ { "x": 1568173054000, "downCount": 7, "upCount": 93, "y": 1 },
+ { "x": 1568173084000, "downCount": 7, "upCount": 93, "y": 1 },
+ { "x": 1568173114000, "downCount": 7, "upCount": 93, "y": 1 },
+ { "x": 1568173144000, "downCount": 7, "upCount": 93, "y": 1 },
+ { "x": 1568173174000, "downCount": 8, "upCount": 92, "y": 1 },
+ { "x": 1568173204000, "downCount": 7, "upCount": 93, "y": 1 },
+ { "x": 1568173234000, "downCount": 7, "upCount": 93, "y": 1 }
+ ]
+}
diff --git a/x-pack/test/api_integration/apis/uptime/rest/fixtures/ping_histogram_by_filter.json b/x-pack/test/api_integration/apis/uptime/rest/fixtures/ping_histogram_by_filter.json
new file mode 100644
index 0000000000000..72b2d5276e025
--- /dev/null
+++ b/x-pack/test/api_integration/apis/uptime/rest/fixtures/ping_histogram_by_filter.json
@@ -0,0 +1,24 @@
+{
+ "histogram": [
+ { "x": 1568172664000, "downCount": 0, "upCount": 93, "y": 1 },
+ { "x": 1568172694000, "downCount": 0, "upCount": 93, "y": 1 },
+ { "x": 1568172724000, "downCount": 0, "upCount": 93, "y": 1 },
+ { "x": 1568172754000, "downCount": 0, "upCount": 93, "y": 1 },
+ { "x": 1568172784000, "downCount": 0, "upCount": 93, "y": 1 },
+ { "x": 1568172814000, "downCount": 0, "upCount": 92, "y": 1 },
+ { "x": 1568172844000, "downCount": 0, "upCount": 93, "y": 1 },
+ { "x": 1568172874000, "downCount": 0, "upCount": 93, "y": 1 },
+ { "x": 1568172904000, "downCount": 0, "upCount": 93, "y": 1 },
+ { "x": 1568172934000, "downCount": 0, "upCount": 93, "y": 1 },
+ { "x": 1568172964000, "downCount": 0, "upCount": 93, "y": 1 },
+ { "x": 1568172994000, "downCount": 0, "upCount": 92, "y": 1 },
+ { "x": 1568173024000, "downCount": 0, "upCount": 93, "y": 1 },
+ { "x": 1568173054000, "downCount": 0, "upCount": 93, "y": 1 },
+ { "x": 1568173084000, "downCount": 0, "upCount": 93, "y": 1 },
+ { "x": 1568173114000, "downCount": 0, "upCount": 93, "y": 1 },
+ { "x": 1568173144000, "downCount": 0, "upCount": 93, "y": 1 },
+ { "x": 1568173174000, "downCount": 0, "upCount": 92, "y": 1 },
+ { "x": 1568173204000, "downCount": 0, "upCount": 93, "y": 1 },
+ { "x": 1568173234000, "downCount": 0, "upCount": 93, "y": 1 }
+ ]
+}
diff --git a/x-pack/test/api_integration/apis/uptime/rest/fixtures/ping_histogram_by_id.json b/x-pack/test/api_integration/apis/uptime/rest/fixtures/ping_histogram_by_id.json
new file mode 100644
index 0000000000000..8e184b247ab52
--- /dev/null
+++ b/x-pack/test/api_integration/apis/uptime/rest/fixtures/ping_histogram_by_id.json
@@ -0,0 +1,24 @@
+{
+ "histogram": [
+ { "x": 1568172664000, "downCount": 0, "upCount": 1, "y": 1 },
+ { "x": 1568172694000, "downCount": 0, "upCount": 1, "y": 1 },
+ { "x": 1568172724000, "downCount": 0, "upCount": 1, "y": 1 },
+ { "x": 1568172754000, "downCount": 0, "upCount": 1, "y": 1 },
+ { "x": 1568172784000, "downCount": 0, "upCount": 1, "y": 1 },
+ { "x": 1568172814000, "downCount": 0, "upCount": 1, "y": 1 },
+ { "x": 1568172844000, "downCount": 0, "upCount": 1, "y": 1 },
+ { "x": 1568172874000, "downCount": 0, "upCount": 1, "y": 1 },
+ { "x": 1568172904000, "downCount": 0, "upCount": 1, "y": 1 },
+ { "x": 1568172934000, "downCount": 0, "upCount": 1, "y": 1 },
+ { "x": 1568172964000, "downCount": 0, "upCount": 1, "y": 1 },
+ { "x": 1568172994000, "downCount": 0, "upCount": 1, "y": 1 },
+ { "x": 1568173024000, "downCount": 0, "upCount": 1, "y": 1 },
+ { "x": 1568173054000, "downCount": 0, "upCount": 1, "y": 1 },
+ { "x": 1568173084000, "downCount": 0, "upCount": 1, "y": 1 },
+ { "x": 1568173114000, "downCount": 0, "upCount": 1, "y": 1 },
+ { "x": 1568173144000, "downCount": 0, "upCount": 1, "y": 1 },
+ { "x": 1568173174000, "downCount": 0, "upCount": 1, "y": 1 },
+ { "x": 1568173204000, "downCount": 0, "upCount": 1, "y": 1 },
+ { "x": 1568173234000, "downCount": 0, "upCount": 1, "y": 1 }
+ ]
+}
diff --git a/x-pack/test/api_integration/apis/uptime/rest/index.ts b/x-pack/test/api_integration/apis/uptime/rest/index.ts
index a86411f7c49ec..30c301c5ecb17 100644
--- a/x-pack/test/api_integration/apis/uptime/rest/index.ts
+++ b/x-pack/test/api_integration/apis/uptime/rest/index.ts
@@ -19,6 +19,7 @@ export default function({ getService, loadTestFile }: FtrProviderContext) {
after('unload', () => esArchiver.unload('uptime/full_heartbeat'));
loadTestFile(require.resolve('./monitor_latest_status'));
loadTestFile(require.resolve('./selected_monitor'));
+ loadTestFile(require.resolve('./ping_histogram'));
});
});
}
diff --git a/x-pack/test/api_integration/apis/uptime/rest/ping_histogram.ts b/x-pack/test/api_integration/apis/uptime/rest/ping_histogram.ts
new file mode 100644
index 0000000000000..429f50ec0aa5b
--- /dev/null
+++ b/x-pack/test/api_integration/apis/uptime/rest/ping_histogram.ts
@@ -0,0 +1,64 @@
+/*
+ * 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 { expectFixtureEql } from '../graphql/helpers/expect_fixture_eql';
+import { FtrProviderContext } from '../../../ftr_provider_context';
+import { assertCloseTo } from '../../../../../legacy/plugins/uptime/server/lib/helper';
+
+export default function({ getService }: FtrProviderContext) {
+ describe('pingHistogram', () => {
+ const supertest = getService('supertest');
+
+ it('will fetch histogram data for all monitors', async () => {
+ const dateStart = '2019-09-11T03:31:04.380Z';
+ const dateEnd = '2019-09-11T03:40:34.410Z';
+
+ const apiResponse = await supertest.get(
+ `/api/uptime/ping/histogram?dateStart=${dateStart}&dateEnd=${dateEnd}`
+ );
+ const data = apiResponse.body;
+
+ // manually testing this value and then removing it to avoid flakiness
+ const { interval } = data;
+ assertCloseTo(interval, 22801, 100);
+ delete data.interval;
+ expectFixtureEql(data, 'ping_histogram');
+ });
+
+ it('will fetch histogram data for a given monitor id', async () => {
+ const dateStart = '2019-09-11T03:31:04.380Z';
+ const dateEnd = '2019-09-11T03:40:34.410Z';
+ const monitorId = '0002-up';
+
+ const apiResponse = await supertest.get(
+ `/api/uptime/ping/histogram?monitorId=${monitorId}&dateStart=${dateStart}&dateEnd=${dateEnd}`
+ );
+ const data = apiResponse.body;
+
+ const { interval } = data;
+ assertCloseTo(interval, 22801, 100);
+ delete data.interval;
+ expectFixtureEql(data, 'ping_histogram_by_id');
+ });
+
+ it('will fetch histogram data for a given filter', async () => {
+ const dateStart = '2019-09-11T03:31:04.380Z';
+ const dateEnd = '2019-09-11T03:40:34.410Z';
+ const filters =
+ '{"bool":{"must":[{"match":{"monitor.status":{"query":"up","operator":"and"}}}]}}';
+
+ const apiResponse = await supertest.get(
+ `/api/uptime/ping/histogram?dateStart=${dateStart}&dateEnd=${dateEnd}&filters=${filters}`
+ );
+ const data = apiResponse.body;
+
+ const { interval } = data;
+ assertCloseTo(interval, 22801, 100);
+ delete data.interval;
+ expectFixtureEql(data, 'ping_histogram_by_filter');
+ });
+ });
+}
diff --git a/x-pack/test/functional/apps/uptime/index.ts b/x-pack/test/functional/apps/uptime/index.ts
index c1bc8f856c467..273b7659b5f46 100644
--- a/x-pack/test/functional/apps/uptime/index.ts
+++ b/x-pack/test/functional/apps/uptime/index.ts
@@ -13,15 +13,23 @@ export default ({ loadTestFile, getService }: FtrProviderContext) => {
const kibanaServer = getService('kibanaServer');
describe('Uptime app', function() {
- before(async () => {
- await esArchiver.load(ARCHIVE);
- await kibanaServer.uiSettings.replace({ 'dateFormat:tz': 'UTC' });
- });
- after(async () => await esArchiver.unload(ARCHIVE));
this.tags('ciGroup6');
+ describe('with generated data', () => {
+ before('load heartbeat data', async () => await esArchiver.load('uptime/blank'));
+ after('unload', async () => await esArchiver.unload('uptime/blank'));
+
+ loadTestFile(require.resolve('./locations'));
+ });
+ describe('with real-world data', () => {
+ before(async () => {
+ await esArchiver.load(ARCHIVE);
+ await kibanaServer.uiSettings.replace({ 'dateFormat:tz': 'UTC' });
+ });
+ after(async () => await esArchiver.unload(ARCHIVE));
- loadTestFile(require.resolve('./feature_controls'));
- loadTestFile(require.resolve('./overview'));
- loadTestFile(require.resolve('./monitor'));
+ loadTestFile(require.resolve('./feature_controls'));
+ loadTestFile(require.resolve('./overview'));
+ loadTestFile(require.resolve('./monitor'));
+ });
});
};
diff --git a/x-pack/test/functional/apps/uptime/locations.ts b/x-pack/test/functional/apps/uptime/locations.ts
new file mode 100644
index 0000000000000..fe9030109145d
--- /dev/null
+++ b/x-pack/test/functional/apps/uptime/locations.ts
@@ -0,0 +1,48 @@
+/*
+ * 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 { makeChecksWithStatus } from '../../../api_integration/apis/uptime/graphql/helpers/make_checks';
+import { FtrProviderContext } from '../../ftr_provider_context';
+
+export default ({ getPageObjects, getService }: FtrProviderContext) => {
+ const pageObjects = getPageObjects(['uptime']);
+
+ describe('location', () => {
+ const start = new Date().toISOString();
+ const end = new Date().toISOString();
+
+ const MONITOR_ID = 'location-testing-id';
+ before(async () => {
+ /**
+ * This mogrify function will strip the documents of their location
+ * data (but preserve their location name), which is necessary for
+ * this test to work as desired.
+ * @param d current document
+ */
+ const mogrifyNoLocation = (d: any) => {
+ if (d.observer?.geo?.location) {
+ d.observer.geo.location = undefined;
+ }
+ return d;
+ };
+ await makeChecksWithStatus(
+ getService('legacyEs'),
+ MONITOR_ID,
+ 5,
+ 2,
+ 10000,
+ {},
+ 'up',
+ mogrifyNoLocation
+ );
+ });
+
+ it('renders the location missing popover when monitor has location name, but no geo data', async () => {
+ await pageObjects.uptime.loadDataAndGoToMonitorPage(start, end, MONITOR_ID);
+ await pageObjects.uptime.locationMissingIsDisplayed();
+ });
+ });
+};
diff --git a/x-pack/test/functional/apps/watcher/watcher_test.js b/x-pack/test/functional/apps/watcher/watcher_test.js
index a3b955f8fccee..a2da0aad2d3c5 100644
--- a/x-pack/test/functional/apps/watcher/watcher_test.js
+++ b/x-pack/test/functional/apps/watcher/watcher_test.js
@@ -18,7 +18,10 @@ export default function({ getService, getPageObjects }) {
const esSupertest = getService('esSupertest');
const PageObjects = getPageObjects(['security', 'common', 'header', 'settings', 'watcher']);
- describe('watcher_test', function() {
+ // Still flaky test :c
+ // https://github.com/elastic/kibana/pull/56361
+ // https://github.com/elastic/kibana/pull/56304
+ describe.skip('watcher_test', function() {
before('initialize tests', async () => {
// There may be system watches if monitoring was previously enabled
// These cannot be deleted via the UI, so we need to delete via the API
diff --git a/x-pack/test/functional/page_objects/uptime_page.ts b/x-pack/test/functional/page_objects/uptime_page.ts
index 2ae0ea38c957b..a5bd4cc480287 100644
--- a/x-pack/test/functional/page_objects/uptime_page.ts
+++ b/x-pack/test/functional/page_objects/uptime_page.ts
@@ -35,12 +35,15 @@ export function UptimePageProvider({ getPageObjects, getService }: FtrProviderCo
datePickerStartValue: string,
datePickerEndValue: string,
monitorId: string,
- monitorName: string
+ monitorName?: string
) {
await pageObjects.common.navigateToApp('uptime');
await pageObjects.timePicker.setAbsoluteRange(datePickerStartValue, datePickerEndValue);
await uptimeService.navigateToMonitorWithId(monitorId);
- if ((await uptimeService.getMonitorNameDisplayedOnPageTitle()) !== monitorName) {
+ if (
+ monitorName &&
+ (await uptimeService.getMonitorNameDisplayedOnPageTitle()) !== monitorName
+ ) {
throw new Error('Expected monitor name not found');
}
}
@@ -89,5 +92,9 @@ export function UptimePageProvider({ getPageObjects, getService }: FtrProviderCo
public async getSnapshotCount() {
return await uptimeService.getSnapshotCount();
}
+
+ public locationMissingIsDisplayed() {
+ return uptimeService.locationMissingExists();
+ }
})();
}
diff --git a/x-pack/test/functional/services/uptime.ts b/x-pack/test/functional/services/uptime.ts
index ca38c2e9dd897..ed39f28aabbfa 100644
--- a/x-pack/test/functional/services/uptime.ts
+++ b/x-pack/test/functional/services/uptime.ts
@@ -27,7 +27,7 @@ export function UptimeProvider({ getService }: FtrProviderContext) {
return url.indexOf(expected) >= 0;
},
async navigateToMonitorWithId(monitorId: string) {
- await testSubjects.click(`monitor-page-link-${monitorId}`);
+ await testSubjects.click(`monitor-page-link-${monitorId}`, 5000);
},
async getMonitorNameDisplayedOnPageTitle() {
return await testSubjects.getVisibleText('monitor-page-title');
@@ -64,5 +64,10 @@ export function UptimeProvider({ getService }: FtrProviderContext) {
down: await testSubjects.getVisibleText('xpack.uptime.snapshot.donutChart.down'),
};
},
+ async locationMissingExists() {
+ return await testSubjects.existOrFail('xpack.uptime.locationMap.locationMissing', {
+ timeout: 3000,
+ });
+ },
};
}
diff --git a/x-pack/test/kerberos_api_integration/config.ts b/x-pack/test/kerberos_api_integration/config.ts
index a1e1466ae40ed..5de397a4cca1a 100644
--- a/x-pack/test/kerberos_api_integration/config.ts
+++ b/x-pack/test/kerberos_api_integration/config.ts
@@ -34,6 +34,7 @@ export default async function({ readConfigFile }: FtrConfigProviderContext) {
...xPackAPITestsConfig.get('esTestCluster.serverArgs'),
'xpack.security.authc.token.enabled=true',
'xpack.security.authc.token.timeout=15s',
+ 'xpack.security.authc.realms.kerberos.kerb1.order=0',
`xpack.security.authc.realms.kerberos.kerb1.keytab.path=${kerberosKeytabPath}`,
],
serverEnvVars: {