diff --git a/rfcs/text/0004_application_service_mounting.md b/rfcs/text/0004_application_service_mounting.md
new file mode 100644
index 0000000000000..f6d06129dd4c2
--- /dev/null
+++ b/rfcs/text/0004_application_service_mounting.md
@@ -0,0 +1,334 @@
+- Start Date: 2019-05-10
+- RFC PR: (leave this empty)
+- Kibana Issue: (leave this empty)
+
+# Summary
+
+A front-end service to manage registration and root-level routing for
+first-class applications.
+
+# Basic example
+
+
+```tsx
+// my_plugin/public/application.js
+
+import React from 'react';
+import ReactDOM from 'react-dom';
+
+import { MyApp } from './componnets';
+
+export function renderApp(context, { element }) {
+ ReactDOM.render(
+ ,
+ element
+ );
+
+ return () => {
+ ReactDOM.unmountComponentAtNode(element);
+ };
+}
+```
+
+```tsx
+// my_plugin/public/plugin.js
+
+class MyPlugin {
+ setup({ application }) {
+ application.register({
+ id: 'my-app',
+ title: 'My Application',
+ async mount(context, params) {
+ const { renderApp } = await import('./application');
+ return renderApp(context, params);
+ }
+ });
+ }
+}
+```
+
+# Motivation
+
+By having centralized management of applications we can have a true single page
+application. It also gives us a single place to enforce authorization and/or
+licensing constraints on application access.
+
+By making the mounting interface of the ApplicationService generic, we can
+support many different rendering technologies simultaneously to avoid framework
+lock-in.
+
+# Detailed design
+
+## Interface
+
+```ts
+/** A context type that implements the Handler Context pattern from RFC-0003 */
+export interface AppMountContext {
+ /** These services serve as an example, but are subject to change. */
+ core: {
+ http: {
+ fetch(...): Promise;
+ };
+ i18n: {
+ translate(
+ id: string,
+ defaultMessage: string,
+ values?: Record
+ ): string;
+ };
+ notifications: {
+ toasts: {
+ add(...): void;
+ };
+ };
+ overlays: {
+ showFlyout(render: (domElement) => () => void): Flyout;
+ showModal(render: (domElement) => () => void): Modal;
+ };
+ uiSettings: { ... };
+ };
+ /** Other plugins can inject context by registering additional context providers */
+ [contextName: string]: unknown;
+}
+
+export interface AppMountParams {
+ /** The base path the application is mounted on. Used to configure routers. */
+ appBasePath: string;
+ /** The element the application should render into */
+ element: HTMLElement;
+}
+
+export type Unmount = () => Promise | void;
+
+export interface AppSpec {
+ /**
+ * A unique identifier for this application. Used to build the route for this
+ * application in the browser.
+ */
+ id: string;
+
+ /**
+ * The title of the application.
+ */
+ title: string;
+
+ /**
+ * A mount function called when the user navigates to this app's route.
+ * @param context the `AppMountContext` generated for this app
+ * @param params the `AppMountParams`
+ * @returns An unmounting function that will be called to unmount the application.
+ */
+ mount(context: MountContext, params: AppMountParams): Unmount | Promise;
+
+ /**
+ * A EUI iconType that will be used for the app's icon. This icon
+ * takes precendence over the `icon` property.
+ */
+ euiIconType?: string;
+
+ /**
+ * A URL to an image file used as an icon. Used as a fallback
+ * if `euiIconType` is not provided.
+ */
+ icon?: string;
+
+ /**
+ * Custom capabilities defined by the app.
+ */
+ capabilities?: Partial;
+}
+
+export interface ApplicationSetup {
+ /**
+ * Registers an application with the system.
+ */
+ register(app: AppSpec): void;
+ registerMountContext(
+ contextName: T,
+ provider: (context: Partial) => MountContext[T] | Promise
+ ): void;
+}
+
+export interface ApplicationStart {
+ /**
+ * The UI capabilities for the current user.
+ */
+ capabilities: Capabilties;
+}
+```
+
+## Mounting
+
+When an app is registered via `register`, it must provide a `mount` function
+that will be invoked whenever the window's location has changed from another app
+to this app.
+
+This function is called with a `AppMountContext` and an
+`AppMountParams` which contains a `HTMLElement` for the application to
+render itself to. The mount function must also return a function that can be
+called by the ApplicationService to unmount the application at the given DOM
+Element. The mount function may return a Promise of an unmount function in order
+to import UI code dynamically.
+
+The ApplicationService's `register` method will only be available during the
+*setup* lifecycle event. This allows the system to know when all applications
+have been registered.
+
+The `mount` function will also get access to the `AppMountContext` that
+has many of the same core services available during the `start` lifecycle.
+Plugins can also register additional context attributes via the
+`registerMountContext` function.
+
+## Routing
+
+The ApplicationService will serve as the global frontend router for Kibana,
+enabling Kibana to be a 100% single page application. However, the router will
+only manage top-level routes. Applications themselves will need to implement
+their own routing as subroutes of the top-level route.
+
+An example:
+- "MyApp" is registered with `id: 'my-app'`
+- User navigates from mykibana.com/app/home to mykibana.com/app/my-app
+- ApplicationService sees the root app has changed and mounts the new
+ application:
+ - Calls the `Unmount` function returned my "Home"'s `mount`
+ - Calls the `mount` function registered by "MyApp"
+- MyApp's internal router takes over rest of routing. Redirects to initial
+ "overview" page: mykibana.com/app/my-app/overview
+
+When setting up a router, your application should only handle the part of the
+URL following the `params.appBasePath` provided when you application is mounted.
+
+### Legacy Applications
+
+In order to introduce this service now, the ApplicationService will need to be
+able to handle "routing" to legacy applications. We will not be able to run
+multiple legacy applications on the same page load due to shared stateful
+modules in `ui/public`.
+
+Instead, the ApplicationService should do a full-page refresh when rendering
+legacy applications. Internally, this will be managed by registering legacy apps
+with the ApplicationService separately and handling those top-level routes by
+starting a full-page refresh rather than a mounting cycle.
+
+## Complete Example
+
+Here is a complete example that demonstrates rendering a React application with
+a full-featured router and code-splitting. Note that using React or any other
+3rd party tools featured here is not required to build a Kibana Application.
+
+```tsx
+// my_plugin/public/application.tsx
+
+import React from 'react';
+import ReactDOM from 'react-dom';
+import { BrowserRouter, Route } from 'react-router-dom';
+import loadable from '@loadable/component';
+
+// Apps can choose to load components statically in the same bundle or
+// dynamically when routes are rendered.
+import { HomePage } from './pages';
+const LazyDashboard = loadable(() => import('./pages/dashboard'));
+
+const MyApp = ({ basename }) => (
+ // Setup router's basename from the basename provided from MountContext
+
+
+ {/* mykibana.com/app/my-app/ */}
+
+
+ {/* mykibana.com/app/my-app/dashboard/42 */}
+ }
+ />
+
+ ,
+);
+
+export function renderApp(context, params) {
+ ReactDOM.render(
+ // `params.appBasePath` would be `/app/my-app` in this example.
+ // This exact string is not guaranteed to be stable, always reference the
+ // provided value at `params.appBasePath`.
+ ,
+ params.element
+ );
+
+ return () => ReactDOM.unmountComponentAtNode(params.element);
+}
+```
+
+```tsx
+// my_plugin/public/plugin.tsx
+
+export class MyPlugin {
+ setup({ application }) {
+ application.register({
+ id: 'my-app',
+ async mount(context, params) {
+ const { renderApp } = await import('./application');
+ return renderApp(context, params);
+ }
+ });
+ }
+}
+```
+
+## Core Entry Point
+
+Once we can support application routing for new and legacy applications, we
+should create a new entry point bundle that only includes Core and any necessary
+uiExports (hacks for example). This should be served by the backend whenever a
+`/app/` request is received for an app that the legacy platform does not
+have a bundle for.
+
+# Drawbacks
+
+- Implementing this will be significant work and requires migrating legacy code
+ from `ui/chrome`
+- Making Kibana a single page application may lead to problems if applications
+ do not clean themselves up properly when unmounted
+- Application `mount` functions will have access to *setup* via the closure. We
+ may want to lock down these APIs from being used after *setup* to encourage
+ usage of the `MountContext` instead.
+- In order to support new applications being registered in the legacy platform,
+ we will need to create a new `uiExport` that is imported during the new
+ platform's *setup* lifecycle event. This is necessary because app registration
+ must happen prior to starting the legacy platform. This is only an issue for
+ plugins that are migrating using a shim in the legacy platform.
+
+# Alternatives
+
+- We could provide a full featured react-router instance that plugins could
+ plug directly into. The downside is this locks us more into React and makes
+ code splitting a bit more challenging.
+
+# Adoption strategy
+
+Adoption of the application service will have to happen as part of the migration
+of each plugin. We should be able to support legacy plugins registering new
+platform-style applications before they actually move all of their code
+over to the new platform.
+
+# How we teach this
+
+Introducing this service makes applications a first-class feature of the Kibana
+platform. Right now, plugins manage their own routes and can export "navlinks"
+that get rendered in the navigation UI, however there is a not a self-contained
+concept like an application to encapsulate these related responsibilities. It
+will need to be emphasized that plugins can register zero, one, or multiple
+applications.
+
+Most new and existing Kibana developers will need to understand how the
+ApplicationService works and how multiple apps run in a single page application.
+This should be accomplished through thorough documentation in the
+ApplicationService's API implementation as well as in general plugin development
+tutorials and documentation.
+
+# Unresolved questions
+
+- Are there any major caveats to having multiple routers on the page? If so, how
+can these be prevented or worked around?
+- How should global URL state be shared across applications, such as timepicker
+state?
diff --git a/src/legacy/core_plugins/console/index.js b/src/legacy/core_plugins/console/index.ts
similarity index 50%
rename from src/legacy/core_plugins/console/index.js
rename to src/legacy/core_plugins/console/index.ts
index 8c5da496afc21..2d0ba9bc14383 100644
--- a/src/legacy/core_plugins/console/index.js
+++ b/src/legacy/core_plugins/console/index.ts
@@ -23,18 +23,17 @@ import { resolve, join, sep } from 'path';
import url from 'url';
import { has, isEmpty, head, pick } from 'lodash';
-import { resolveApi } from './api_server/server';
-import { addExtensionSpecFilePath } from './api_server/spec';
+// @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';
-import {
- ProxyConfigCollection,
- getElasticsearchProxyConfig,
- createProxyRoute
-} from './server';
-
-function filterHeaders(originalHeaders, headersToKeep) {
- const normalizeHeader = function (header) {
+function filterHeaders(originalHeaders: any, headersToKeep: any) {
+ const normalizeHeader = function(header: any) {
if (!header) {
return '';
}
@@ -48,51 +47,64 @@ function filterHeaders(originalHeaders, headersToKeep) {
return pick(originalHeaders, headersToKeepNormalized);
}
-export default function (kibana) {
+// eslint-disable-next-line
+export default function(kibana: any) {
const modules = resolve(__dirname, 'public/webpackShims/');
- const src = resolve(__dirname, 'public/src/');
+ const quarantinedSrc = resolve(__dirname, 'public/quarantined/src/');
+ const npSrc = resolve(__dirname, 'np_ready/public');
- let defaultVars;
- const apps = [];
+ let defaultVars: any;
+ const apps: any[] = [];
return new kibana.Plugin({
id: 'console',
require: ['elasticsearch'],
- config: function (Joi) {
+ config(Joi: any) {
return Joi.object({
enabled: Joi.boolean().default(true),
- proxyFilter: Joi.array().items(Joi.string()).single().default(['.*']),
+ 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()
+ 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: function () {
+ deprecations() {
return [
- (settings, log) => {
+ (settings: any, log: any) => {
if (has(settings, 'proxyConfig')) {
- log('Config key "proxyConfig" is deprecated. Configuration can be inferred from the "elasticsearch" settings');
+ log(
+ 'Config key "proxyConfig" is deprecated. Configuration can be inferred from the "elasticsearch" settings'
+ );
}
- }
+ },
];
},
@@ -105,16 +117,18 @@ export default function (kibana) {
};
},
- async init(server, options) {
+ async init(server: any, options: any) {
server.expose('addExtensionSpecFilePath', addExtensionSpecFilePath);
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.setup.core.elasticsearch.legacy.config$.pipe(first()).toPromise();
+ const legacyEsConfig = await server.newPlatform.setup.core.elasticsearch.legacy.config$
+ .pipe(first())
+ .toPromise();
const proxyConfigCollection = new ProxyConfigCollection(options.proxyConfig);
- const proxyPathFilters = options.proxyFilter.map(str => new RegExp(str));
+ const proxyPathFilters = options.proxyFilter.map((str: string) => new RegExp(str));
defaultVars = {
elasticsearchUrl: url.format(
@@ -122,54 +136,59 @@ export default function (kibana) {
),
};
- server.route(createProxyRoute({
- baseUrl: head(legacyEsConfig.hosts),
- pathFilters: proxyPathFilters,
- getConfigForReq(req, uri) {
- const filteredHeaders = filterHeaders(req.headers, legacyEsConfig.requestHeadersWhitelist);
- const headers = setHeaders(filteredHeaders, legacyEsConfig.customHeaders);
+ server.route(
+ createProxyRoute({
+ baseUrl: head(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,
+ };
+ }
- if (!isEmpty(config.get('console.proxyConfig'))) {
return {
- ...proxyConfigCollection.configForUri(uri),
+ ...getElasticsearchProxyConfig(legacyEsConfig),
headers,
};
- }
-
- return {
- ...getElasticsearchProxyConfig(legacyEsConfig),
- headers,
- };
- }
- }));
+ },
+ })
+ );
server.route({
path: '/api/console/api_server',
method: ['GET', 'POST'],
- handler: function (req, h) {
+ 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: {
- apps: apps,
- hacks: ['plugins/console/hacks/register'],
- devTools: ['plugins/console/console'],
- styleSheetPaths: resolve(__dirname, 'public/index.scss'),
+ apps,
+ hacks: ['plugins/console/quarantined/hacks/register'],
+ devTools: [`${npSrc}/legacy`],
+ styleSheetPaths: resolve(__dirname, 'public/quarantined/index.scss'),
injectDefaultVars: () => defaultVars,
noParse: [
join(modules, 'ace' + sep),
join(modules, 'moment_src/moment' + sep),
- join(src, 'sense_editor/mode/worker.js')
- ]
- }
- });
+ join(quarantinedSrc, 'sense_editor/mode/worker.js'),
+ ],
+ },
+ } as any);
}
diff --git a/src/legacy/core_plugins/console/np_ready/kibana.json b/src/legacy/core_plugins/console/np_ready/kibana.json
new file mode 100644
index 0000000000000..ed8e4d8f15830
--- /dev/null
+++ b/src/legacy/core_plugins/console/np_ready/kibana.json
@@ -0,0 +1,6 @@
+{
+ "id": "console",
+ "version": "kibana",
+ "server": true,
+ "ui": true
+}
diff --git a/src/legacy/core_plugins/console/public/src/components/console_menu.js b/src/legacy/core_plugins/console/np_ready/public/application/components/console_menu.tsx
similarity index 54%
rename from src/legacy/core_plugins/console/public/src/components/console_menu.js
rename to src/legacy/core_plugins/console/np_ready/public/application/components/console_menu.tsx
index 3ab05556f643e..1fb23ffbc8897 100644
--- a/src/legacy/core_plugins/console/public/src/components/console_menu.js
+++ b/src/legacy/core_plugins/console/np_ready/public/application/components/console_menu.tsx
@@ -17,23 +17,25 @@
* under the License.
*/
-import PropTypes from 'prop-types';
+import React, { Component } from 'react';
-import React, {
- Component,
-} from 'react';
-
-import {
- EuiButtonIcon,
- EuiContextMenuPanel,
- EuiContextMenuItem,
- EuiPopover,
-} from '@elastic/eui';
+import { EuiButtonIcon, EuiContextMenuPanel, EuiContextMenuItem, EuiPopover } from '@elastic/eui';
import { FormattedMessage } from '@kbn/i18n/react';
-export class ConsoleMenu extends Component {
- constructor(props) {
+interface Props {
+ getCurl: (cb: (text: string) => void) => void;
+ getDocumentation: () => Promise;
+ autoIndent: (ev: React.MouseEvent) => void;
+}
+
+interface State {
+ isPopoverOpen: boolean;
+ curlCode: string;
+}
+
+export class ConsoleMenu extends Component {
+ constructor(props: Props) {
super(props);
this.state = {
@@ -47,13 +49,13 @@ export class ConsoleMenu extends Component {
this.props.getCurl(text => {
this.setState({ curlCode: text });
});
- }
+ };
copyAsCurl() {
this.copyText(this.state.curlCode);
}
- copyText(text) {
+ copyText(text: string) {
const textField = document.createElement('textarea');
textField.innerText = text;
document.body.appendChild(textField);
@@ -74,17 +76,27 @@ export class ConsoleMenu extends Component {
});
};
- openDocs = () => {
+ openDocs = async () => {
this.closePopover();
- this.props.getDocumentation();
- this.props.openDocumentation();
- }
+ const documentation = await this.props.getDocumentation();
+ if (!documentation) {
+ return;
+ }
+ window.open(documentation, '_blank');
+ };
+
+ // Using `any` here per this issue: https://github.com/elastic/eui/issues/2265
+ autoIndent: any = (event: React.MouseEvent) => {
+ this.closePopover();
+ this.props.autoIndent(event);
+ };
render() {
const button = (
{ this.closePopover(); this.copyAsCurl(); }}
- >
-
-
- ), (
- { this.openDocs(); }}
- >
-
-
- ), (
- { this.closePopover(); this.props.autoIndent(event); }}
- >
-
-
- )
+ {
+ this.closePopover();
+ this.copyAsCurl();
+ }}
+ >
+
+ ,
+ {
+ this.openDocs();
+ }}
+ >
+
+ ,
+
+
+ ,
];
return (
@@ -140,18 +150,9 @@ export class ConsoleMenu extends Component {
panelPaddingSize="none"
anchorPosition="downLeft"
>
-
+
);
}
}
-
-ConsoleMenu.propTypes = {
- getCurl: PropTypes.func.isRequired,
- openDocumentation: PropTypes.func.isRequired,
- getDocumentation: PropTypes.func.isRequired,
- autoIndent: PropTypes.func.isRequired,
-};
diff --git a/src/legacy/core_plugins/console/public/src/components/editor_example.tsx b/src/legacy/core_plugins/console/np_ready/public/application/components/editor_example.tsx
similarity index 90%
rename from src/legacy/core_plugins/console/public/src/components/editor_example.tsx
rename to src/legacy/core_plugins/console/np_ready/public/application/components/editor_example.tsx
index 99309d7b8549c..33cefd9b20968 100644
--- a/src/legacy/core_plugins/console/public/src/components/editor_example.tsx
+++ b/src/legacy/core_plugins/console/np_ready/public/application/components/editor_example.tsx
@@ -19,10 +19,10 @@
import React, { useEffect } from 'react';
// @ts-ignore
-import exampleText from 'raw-loader!./help_example.txt';
+import exampleText from 'raw-loader!../constants/help_example.txt';
import $ from 'jquery';
// @ts-ignore
-import SenseEditor from '../sense_editor/editor';
+import SenseEditor from '../../../../public/quarantined/src/sense_editor/editor';
interface EditorExampleProps {
panel: string;
diff --git a/src/legacy/core_plugins/console/public/src/components/help_panel.tsx b/src/legacy/core_plugins/console/np_ready/public/application/components/help_panel.tsx
similarity index 100%
rename from src/legacy/core_plugins/console/public/src/components/help_panel.tsx
rename to src/legacy/core_plugins/console/np_ready/public/application/components/help_panel.tsx
diff --git a/src/legacy/core_plugins/console/np_ready/public/application/components/index.ts b/src/legacy/core_plugins/console/np_ready/public/application/components/index.ts
new file mode 100644
index 0000000000000..0f109e99b0b39
--- /dev/null
+++ b/src/legacy/core_plugins/console/np_ready/public/application/components/index.ts
@@ -0,0 +1,25 @@
+/*
+ * 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 * from './split_panel';
+export { TopNavMenuItem, TopNavMenu } from './top_nav_menu';
+export { ConsoleMenu } from './console_menu';
+export { WelcomePanel } from './welcome_panel';
+export { AutocompleteOptions, DevToolsSettingsModal } from './settings_modal';
+export { HelpPanel } from './help_panel';
diff --git a/src/legacy/core_plugins/console/public/src/components/settings_modal.tsx b/src/legacy/core_plugins/console/np_ready/public/application/components/settings_modal.tsx
similarity index 97%
rename from src/legacy/core_plugins/console/public/src/components/settings_modal.tsx
rename to src/legacy/core_plugins/console/np_ready/public/application/components/settings_modal.tsx
index f3ec577e43b71..9ecfc1bc4d446 100644
--- a/src/legacy/core_plugins/console/public/src/components/settings_modal.tsx
+++ b/src/legacy/core_plugins/console/np_ready/public/application/components/settings_modal.tsx
@@ -35,7 +35,8 @@ import {
EuiOverlayMask,
EuiSwitch,
} from '@elastic/eui';
-import { DevToolsSettings } from './dev_tools_settings';
+
+import { DevToolsSettings } from '../../services';
export type AutocompleteOptions = 'fields' | 'indices' | 'templates';
@@ -145,11 +146,9 @@ export function DevToolsSettingsModal(props: Props) {
onClick={() => {
// Only refresh the currently selected settings.
props.refreshAutocompleteSettings({
- autocomplete: {
- fields,
- indices,
- templates,
- },
+ fields,
+ indices,
+ templates,
});
}}
>
diff --git a/src/legacy/core_plugins/console/np_ready/public/application/components/split_panel/__snapshots__/split_panel.test.tsx.snap b/src/legacy/core_plugins/console/np_ready/public/application/components/split_panel/__snapshots__/split_panel.test.tsx.snap
new file mode 100644
index 0000000000000..0a40e3e84211d
--- /dev/null
+++ b/src/legacy/core_plugins/console/np_ready/public/application/components/split_panel/__snapshots__/split_panel.test.tsx.snap
@@ -0,0 +1,93 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`Split panel should render correctly 1`] = `
+
+
+
+
+
+
+ A
+
+
+
+
+
+ ︙
+
+
+
+
+
+ B
+
+
+
+
+
+
+`;
diff --git a/src/legacy/core_plugins/console/np_ready/public/application/components/split_panel/components/resizer.tsx b/src/legacy/core_plugins/console/np_ready/public/application/components/split_panel/components/resizer.tsx
new file mode 100644
index 0000000000000..9d7738ac6a5a9
--- /dev/null
+++ b/src/legacy/core_plugins/console/np_ready/public/application/components/split_panel/components/resizer.tsx
@@ -0,0 +1,37 @@
+/*
+ * 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 React from 'react';
+
+type ResizerMouseEvent = React.MouseEvent;
+
+export interface Props {
+ onMouseDown: (eve: ResizerMouseEvent) => void;
+}
+
+/**
+ * TODO: This component uses styling constants from public UI - should be removed, next iteration should incl. horizontal and vertical resizers.
+ */
+export function Resizer(props: Props) {
+ return (
+
+ ︙
+
+ );
+}
diff --git a/src/legacy/core_plugins/console/np_ready/public/application/components/split_panel/containers/panel.tsx b/src/legacy/core_plugins/console/np_ready/public/application/components/split_panel/containers/panel.tsx
new file mode 100644
index 0000000000000..747c21433f8ed
--- /dev/null
+++ b/src/legacy/core_plugins/console/np_ready/public/application/components/split_panel/containers/panel.tsx
@@ -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 React, { CSSProperties, ReactNode, useEffect, useRef, useState } from 'react';
+import { usePanelContext } from '../context';
+
+export interface Props {
+ children: ReactNode[] | ReactNode;
+ initialWidth?: string;
+ style?: CSSProperties;
+}
+
+export function Panel({ children, initialWidth = '100%', style = {} }: Props) {
+ const [width, setWidth] = useState(initialWidth);
+ const { registry } = usePanelContext();
+ const divRef = useRef(null);
+
+ useEffect(() => {
+ registry.registerPanel({
+ initialWidth,
+ setWidth(value) {
+ setWidth(value + '%');
+ },
+ getWidth() {
+ return divRef.current!.getBoundingClientRect().width;
+ },
+ });
+ }, []);
+
+ return (
+
+ {children}
+
+ );
+}
diff --git a/src/legacy/core_plugins/console/np_ready/public/application/components/split_panel/containers/panel_container.tsx b/src/legacy/core_plugins/console/np_ready/public/application/components/split_panel/containers/panel_container.tsx
new file mode 100644
index 0000000000000..fef65a954bd60
--- /dev/null
+++ b/src/legacy/core_plugins/console/np_ready/public/application/components/split_panel/containers/panel_container.tsx
@@ -0,0 +1,99 @@
+/*
+ * Licensed to Elasticsearch B.V. under one or more contributor
+ * license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright
+ * ownership. Elasticsearch B.V. licenses this file to you under
+ * the Apache License, Version 2.0 (the "License"); you may
+ * not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import React, { Children, ReactNode, useRef, useState } from 'react';
+
+import { PanelContextProvider } from '../context';
+import { Resizer } from '../components/resizer';
+import { PanelRegistry } from '../registry';
+
+export interface Props {
+ children: ReactNode;
+ onPanelWidthChange?: (arrayOfPanelWidths: number[]) => any;
+}
+
+interface State {
+ isDragging: boolean;
+ currentResizerPos: number;
+}
+
+const initialState: State = { isDragging: false, currentResizerPos: -1 };
+
+const pxToPercent = (proportion: number, whole: number) => (proportion / whole) * 100;
+
+export function PanelsContainer({ children, onPanelWidthChange }: Props) {
+ const [firstChild, secondChild] = Children.toArray(children);
+
+ const registryRef = useRef(new PanelRegistry());
+ const containerRef = useRef(null);
+ const [state, setState] = useState(initialState);
+
+ const getContainerWidth = () => {
+ return containerRef.current!.getBoundingClientRect().width;
+ };
+
+ const childrenWithResizer = [
+ firstChild,
+ {
+ event.preventDefault();
+ setState({
+ ...state,
+ isDragging: true,
+ currentResizerPos: event.clientX,
+ });
+ }}
+ />,
+ secondChild,
+ ];
+
+ return (
+
+
+
+ );
+}
diff --git a/src/legacy/core_plugins/console/public/src/helpers/help_show_panel.tsx b/src/legacy/core_plugins/console/np_ready/public/application/components/split_panel/context.tsx
similarity index 56%
rename from src/legacy/core_plugins/console/public/src/helpers/help_show_panel.tsx
rename to src/legacy/core_plugins/console/np_ready/public/application/components/split_panel/context.tsx
index a57fc92e17141..22cfee8720b9d 100644
--- a/src/legacy/core_plugins/console/public/src/helpers/help_show_panel.tsx
+++ b/src/legacy/core_plugins/console/np_ready/public/application/components/split_panel/context.tsx
@@ -17,31 +17,24 @@
* under the License.
*/
-import React from 'react';
-import ReactDOM from 'react-dom';
-import { I18nContext } from 'ui/i18n';
-import { HelpPanel } from '../components/help_panel';
+import React, { createContext, useContext } from 'react';
+import { PanelRegistry } from './registry';
-let isOpen = false;
+const PanelContext = createContext({ registry: new PanelRegistry() });
-export function showHelpPanel(): () => void {
- const onClose = () => {
- if (!container) return;
- ReactDOM.unmountComponentAtNode(container);
- isOpen = false;
- };
+interface ContextProps {
+ children: any;
+ registry: PanelRegistry;
+}
- const container = document.getElementById('consoleHelpPanel');
+export function PanelContextProvider({ children, registry }: ContextProps) {
+ return {children};
+}
- if (container && !isOpen) {
- isOpen = true;
- const element = (
-
-
-
- );
- ReactDOM.render(element, container);
+export const usePanelContext = () => {
+ const context = useContext(PanelContext);
+ if (context === undefined) {
+ throw new Error('usePanelContext must be used within a ');
}
-
- return onClose;
-}
+ return context;
+};
diff --git a/src/legacy/core_plugins/console/public/src/components/dev_tools_settings.ts b/src/legacy/core_plugins/console/np_ready/public/application/components/split_panel/index.ts
similarity index 78%
rename from src/legacy/core_plugins/console/public/src/components/dev_tools_settings.ts
rename to src/legacy/core_plugins/console/np_ready/public/application/components/split_panel/index.ts
index f3fd1442ca90f..ed66cb958ea77 100644
--- a/src/legacy/core_plugins/console/public/src/components/dev_tools_settings.ts
+++ b/src/legacy/core_plugins/console/np_ready/public/application/components/split_panel/index.ts
@@ -17,14 +17,5 @@
* under the License.
*/
-export interface DevToolsSettings {
- fontSize: number;
- wrapMode: boolean;
- autocomplete: {
- fields: boolean;
- indices: boolean;
- templates: boolean;
- };
- polling: boolean;
- tripleQuotes: boolean;
-}
+export { Panel } from './containers/panel';
+export { PanelsContainer } from './containers/panel_container';
diff --git a/src/legacy/core_plugins/console/np_ready/public/application/components/split_panel/registry.ts b/src/legacy/core_plugins/console/np_ready/public/application/components/split_panel/registry.ts
new file mode 100644
index 0000000000000..5f06ab8915270
--- /dev/null
+++ b/src/legacy/core_plugins/console/np_ready/public/application/components/split_panel/registry.ts
@@ -0,0 +1,40 @@
+/*
+ * 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 PanelController {
+ setWidth: (percent: number) => void;
+ getWidth: () => number;
+ initialWidth: string;
+}
+
+export class PanelRegistry {
+ private panels: PanelController[] = [];
+
+ registerPanel(panel: PanelController) {
+ this.panels.push(panel);
+ }
+
+ getResizerNeighbours(idx: number) {
+ return [this.panels[idx], this.panels[idx + 1]];
+ }
+
+ getPanels() {
+ return this.panels.map(panel => ({ ...panel }));
+ }
+}
diff --git a/src/legacy/core_plugins/console/np_ready/public/application/components/split_panel/split_panel.test.tsx b/src/legacy/core_plugins/console/np_ready/public/application/components/split_panel/split_panel.test.tsx
new file mode 100644
index 0000000000000..e60912a29355b
--- /dev/null
+++ b/src/legacy/core_plugins/console/np_ready/public/application/components/split_panel/split_panel.test.tsx
@@ -0,0 +1,86 @@
+/*
+ * 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 React from 'react';
+import { mount } from 'enzyme';
+import toJson from 'enzyme-to-json';
+import { spy } from 'sinon';
+
+import { PanelsContainer, Panel } from '.';
+
+const testComponentA =
A
;
+const testComponentB =
B
;
+
+describe('Split panel', () => {
+ it('should render correctly', () => {
+ const panelContainer = mount(
+
+ {testComponentA}
+ {testComponentB}
+
+ );
+ expect(toJson(panelContainer)).toMatchSnapshot();
+ });
+
+ it('should calculate sizes correctly on mouse drags', () => {
+ // Since this test is not running in the browser we can't expect all of the
+ // APIs for sizing to be available. The below is a very hacky way of setting
+ // the DOMElement width so that we have a lightweight test for width calculation
+ // logic.
+ const div = mount();
+ const proto = (div
+ .find('div')
+ .first()
+ .getDOMNode() as any).__proto__;
+ const originalGetBoundingClientRect = proto.getBoundingClientRect;
+
+ proto.getBoundingClientRect = spy(() => {
+ return {
+ width: 1000,
+ };
+ });
+
+ try {
+ // Everything here runs sync.
+ let widthsCache: number[] = [];
+ const onWidthChange = (widths: number[]) => {
+ widthsCache = widths;
+ };
+
+ const panelContainer = mount(
+
+ {testComponentA}
+ {testComponentB}
+
+ );
+
+ const resizer = panelContainer.find(`[data-test-subj~="splitPanelResizer"]`).first();
+
+ resizer.simulate('mousedown', { clientX: 0 });
+ resizer.simulate('mousemove', { clientX: 250 });
+ resizer.simulate('mouseup');
+
+ panelContainer.update();
+
+ expect(widthsCache).toEqual([125, 75]);
+ } finally {
+ proto.getBoundingClientRect = originalGetBoundingClientRect;
+ }
+ });
+});
diff --git a/src/legacy/core_plugins/console/np_ready/public/application/components/top_nav_menu.tsx b/src/legacy/core_plugins/console/np_ready/public/application/components/top_nav_menu.tsx
new file mode 100644
index 0000000000000..c83237c52febd
--- /dev/null
+++ b/src/legacy/core_plugins/console/np_ready/public/application/components/top_nav_menu.tsx
@@ -0,0 +1,47 @@
+/*
+ * 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 React from 'react';
+import { EuiTabs, EuiTab } from '@elastic/eui';
+
+export interface TopNavMenuItem {
+ id: string;
+ label: string;
+ description: string;
+ onClick: () => void;
+ testId: string;
+}
+
+interface Props {
+ items: TopNavMenuItem[];
+}
+
+export function TopNavMenu({ items }: Props) {
+ return (
+
+ {items.map((item, idx) => {
+ return (
+
+ {item.label}
+
+ );
+ })}
+
+ );
+}
diff --git a/src/legacy/core_plugins/console/public/src/components/welcome_panel.tsx b/src/legacy/core_plugins/console/np_ready/public/application/components/welcome_panel.tsx
similarity index 100%
rename from src/legacy/core_plugins/console/public/src/components/welcome_panel.tsx
rename to src/legacy/core_plugins/console/np_ready/public/application/components/welcome_panel.tsx
diff --git a/src/legacy/core_plugins/console/public/src/components/help_example.txt b/src/legacy/core_plugins/console/np_ready/public/application/constants/help_example.txt
similarity index 100%
rename from src/legacy/core_plugins/console/public/src/components/help_example.txt
rename to src/legacy/core_plugins/console/np_ready/public/application/constants/help_example.txt
diff --git a/src/legacy/core_plugins/console/np_ready/public/application/containers/editor/index.ts b/src/legacy/core_plugins/console/np_ready/public/application/containers/editor/index.ts
new file mode 100644
index 0000000000000..346b748e1be91
--- /dev/null
+++ b/src/legacy/core_plugins/console/np_ready/public/application/containers/editor/index.ts
@@ -0,0 +1,20 @@
+/*
+ * Licensed to Elasticsearch B.V. under one or more contributor
+ * license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright
+ * ownership. Elasticsearch B.V. licenses this file to you under
+ * the Apache License, Version 2.0 (the "License"); you may
+ * not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+export { Editor, EditorOutput, ConsoleHistory, autoIndent, getDocumentation } from './legacy';
diff --git a/src/legacy/core_plugins/console/np_ready/public/application/containers/editor/legacy/console_editor/editor.tsx b/src/legacy/core_plugins/console/np_ready/public/application/containers/editor/legacy/console_editor/editor.tsx
new file mode 100644
index 0000000000000..0ce3d44caccd9
--- /dev/null
+++ b/src/legacy/core_plugins/console/np_ready/public/application/containers/editor/legacy/console_editor/editor.tsx
@@ -0,0 +1,130 @@
+/*
+ * 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 React, { CSSProperties, useEffect, useRef, useState } from 'react';
+import { EuiToolTip } from '@elastic/eui';
+import { i18n } from '@kbn/i18n';
+
+import $ from 'jquery';
+
+import { EuiIcon } from '@elastic/eui';
+import { useAppContext } from '../../../../context';
+import { useUIAceKeyboardMode } from '../use_ui_ace_keyboard_mode';
+import { ConsoleMenu } from '../../../../components';
+import { autoIndent, getDocumentation } from '../console_menu_actions';
+import { registerCommands } from './keyboard_shortcuts';
+
+// @ts-ignore
+import { initializeInput } from '../../../../../../../public/quarantined/src/input';
+
+export interface EditorProps {
+ onEditorReady?: (editor: any) => void;
+ sendCurrentRequest?: () => void;
+ docLinkVersion: string;
+}
+
+const abs: CSSProperties = {
+ position: 'absolute',
+ top: '0',
+ left: '0',
+ bottom: '0',
+ right: '0',
+};
+
+function Component({ onEditorReady, docLinkVersion, sendCurrentRequest = () => {} }: EditorProps) {
+ const {
+ services: { history, settings },
+ } = useAppContext();
+
+ const editorRef = useRef(null);
+ const actionsRef = useRef(null);
+ const editorInstanceRef = useRef(null);
+
+ const [textArea, setTextArea] = useState(null);
+ useUIAceKeyboardMode(textArea);
+
+ const openDocumentation = async () => {
+ const documentation = await getDocumentation(editorInstanceRef.current!, docLinkVersion);
+ if (!documentation) {
+ return;
+ }
+ window.open(documentation, '_blank');
+ };
+
+ useEffect(() => {
+ const $editor = $(editorRef.current!);
+ const $actions = $(actionsRef.current!);
+ editorInstanceRef.current = initializeInput($editor, $actions, history, settings);
+ if (onEditorReady) {
+ onEditorReady({ editor: editorInstanceRef.current, element: editorRef.current! });
+ }
+
+ setTextArea(editorRef.current!.querySelector('textarea'));
+ }, []);
+
+ useEffect(() => {
+ registerCommands({
+ input: editorInstanceRef.current,
+ sendCurrentRequestToES: sendCurrentRequest,
+ openDocumentation,
+ });
+ }, [sendCurrentRequest]);
+
+ return (
+
+ );
+}
+
+export const Editor = React.memo(Component);
diff --git a/src/legacy/core_plugins/console/np_ready/public/application/containers/editor/legacy/console_editor/editor_output.tsx b/src/legacy/core_plugins/console/np_ready/public/application/containers/editor/legacy/console_editor/editor_output.tsx
new file mode 100644
index 0000000000000..94e9162d46b03
--- /dev/null
+++ b/src/legacy/core_plugins/console/np_ready/public/application/containers/editor/legacy/console_editor/editor_output.tsx
@@ -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 React, { useEffect, useRef } from 'react';
+import $ from 'jquery';
+
+// @ts-ignore
+import { initializeOutput } from '../../../../../../../public/quarantined/src/output';
+import { useAppContext } from '../../../../context';
+
+export interface EditorOutputProps {
+ onReady?: (ref: any) => void;
+}
+
+function Component({ onReady }: EditorOutputProps) {
+ const editorRef = useRef(null);
+ const {
+ services: { settings },
+ } = useAppContext();
+
+ useEffect(() => {
+ const editor$ = $(editorRef.current!);
+ const outputEditor = initializeOutput(editor$, settings);
+ if (onReady) {
+ onReady({ editor: outputEditor, element: editorRef.current! });
+ }
+ });
+
+ return (
+
+
+
+ );
+}
+
+export const EditorOutput = React.memo(Component);
diff --git a/src/legacy/core_plugins/console/np_ready/public/application/containers/editor/legacy/console_editor/index.ts b/src/legacy/core_plugins/console/np_ready/public/application/containers/editor/legacy/console_editor/index.ts
new file mode 100644
index 0000000000000..a8c603e87e7cc
--- /dev/null
+++ b/src/legacy/core_plugins/console/np_ready/public/application/containers/editor/legacy/console_editor/index.ts
@@ -0,0 +1,21 @@
+/*
+ * 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 { Editor } from './editor';
+export { EditorOutput } from './editor_output';
diff --git a/src/legacy/core_plugins/console/np_ready/public/application/containers/editor/legacy/console_editor/keyboard_shortcuts.ts b/src/legacy/core_plugins/console/np_ready/public/application/containers/editor/legacy/console_editor/keyboard_shortcuts.ts
new file mode 100644
index 0000000000000..be1826afd7827
--- /dev/null
+++ b/src/legacy/core_plugins/console/np_ready/public/application/containers/editor/legacy/console_editor/keyboard_shortcuts.ts
@@ -0,0 +1,60 @@
+/*
+ * 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.
+ */
+
+interface Actions {
+ input: any;
+ sendCurrentRequestToES: () => void;
+ openDocumentation: () => void;
+}
+
+export function registerCommands({ input, sendCurrentRequestToES, openDocumentation }: Actions) {
+ input.commands.addCommand({
+ name: 'send to elasticsearch',
+ bindKey: { win: 'Ctrl-Enter', mac: 'Command-Enter' },
+ exec: () => sendCurrentRequestToES(),
+ });
+ input.commands.addCommand({
+ name: 'open documentation',
+ bindKey: { win: 'Ctrl-/', mac: 'Command-/' },
+ exec: () => {
+ openDocumentation();
+ },
+ });
+ input.commands.addCommand({
+ name: 'auto indent request',
+ bindKey: { win: 'Ctrl-I', mac: 'Command-I' },
+ exec: () => {
+ input.autoIndent();
+ },
+ });
+ input.commands.addCommand({
+ name: 'move to previous request start or end',
+ bindKey: { win: 'Ctrl-Up', mac: 'Command-Up' },
+ exec: () => {
+ input.moveToPreviousRequestEdge();
+ },
+ });
+ input.commands.addCommand({
+ name: 'move to next request start or end',
+ bindKey: { win: 'Ctrl-Down', mac: 'Command-Down' },
+ exec: () => {
+ input.moveToNextRequestEdge();
+ },
+ });
+}
diff --git a/src/legacy/core_plugins/console/np_ready/public/application/containers/editor/legacy/console_history/console_history.tsx b/src/legacy/core_plugins/console/np_ready/public/application/containers/editor/legacy/console_history/console_history.tsx
new file mode 100644
index 0000000000000..b23ec67422c98
--- /dev/null
+++ b/src/legacy/core_plugins/console/np_ready/public/application/containers/editor/legacy/console_history/console_history.tsx
@@ -0,0 +1,225 @@
+/*
+ * 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 React, { useEffect, useRef, useState } from 'react';
+import { i18n } from '@kbn/i18n';
+import { memoize } from 'lodash';
+import moment from 'moment';
+import {
+ keyCodes,
+ EuiSpacer,
+ EuiIcon,
+ EuiTitle,
+ EuiFlexItem,
+ EuiFlexGroup,
+ EuiButtonEmpty,
+ EuiButton,
+} from '@elastic/eui';
+
+import { useAppContext } from '../../../../context';
+import { HistoryViewer } from './history_viewer';
+
+interface Props {
+ close: () => void;
+ clearHistory: () => void;
+ restoreFromHistory: (req: any) => void;
+ requests: any[];
+}
+
+const CHILD_ELEMENT_PREFIX = 'historyReq';
+
+export function ConsoleHistory({ close, requests, clearHistory, restoreFromHistory }: Props) {
+ const {
+ services: { settings },
+ ResizeChecker,
+ } = useAppContext();
+
+ const listRef = useRef(null);
+
+ const [viewingReq, setViewingReq] = useState(null);
+ const [selectedIndex, setSelectedIndex] = useState(0);
+ const selectedReq = useRef(null);
+
+ const scrollIntoView = (idx: number) => {
+ const activeDescendant = listRef.current!.querySelector(`#${CHILD_ELEMENT_PREFIX}${idx}`);
+ if (activeDescendant) {
+ activeDescendant.scrollIntoView();
+ }
+ };
+
+ const [describeReq] = useState(() => {
+ const _describeReq = (req: any) => {
+ const endpoint = req.endpoint;
+ const date = moment(req.time);
+
+ let formattedDate = date.format('MMM D');
+ if (date.diff(moment(), 'days') > -7) {
+ formattedDate = date.fromNow();
+ }
+
+ return `${endpoint} (${formattedDate})`;
+ };
+
+ (_describeReq as any).cache = new WeakMap();
+
+ return memoize(_describeReq);
+ });
+
+ const initialize = () => {
+ const nextSelectedIndex = 0;
+ (describeReq as any).cache = new WeakMap();
+ setViewingReq(requests[nextSelectedIndex]);
+ selectedReq.current = requests[nextSelectedIndex];
+ setSelectedIndex(nextSelectedIndex);
+ scrollIntoView(nextSelectedIndex);
+ };
+
+ const clear = () => {
+ clearHistory();
+ initialize();
+ };
+
+ const restore = (req: any = selectedReq.current) => {
+ restoreFromHistory(req);
+ };
+
+ useEffect(() => {
+ initialize();
+ }, [requests]);
+
+ /* eslint-disable */
+ return (
+ <>
+
+
+ >
+ );
+}
diff --git a/src/legacy/core_plugins/console/np_ready/public/application/containers/editor/legacy/console_history/history_viewer.tsx b/src/legacy/core_plugins/console/np_ready/public/application/containers/editor/legacy/console_history/history_viewer.tsx
new file mode 100644
index 0000000000000..b8f857299a219
--- /dev/null
+++ b/src/legacy/core_plugins/console/np_ready/public/application/containers/editor/legacy/console_history/history_viewer.tsx
@@ -0,0 +1,66 @@
+/*
+ * 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 React, { useEffect, useRef } from 'react';
+import { i18n } from '@kbn/i18n';
+import $ from 'jquery';
+
+import { Settings } from '../../../../../services';
+import { subscribeResizeChecker } from '../subscribe_console_resize_checker';
+
+// @ts-ignore
+import SenseEditor from '../../../../../../../public/quarantined/src/sense_editor/editor';
+
+interface Props {
+ settings: Settings;
+ req: any | null;
+ ResizeChecker: any;
+}
+
+export function HistoryViewer({ settings, ResizeChecker, req }: Props) {
+ const divRef = useRef(null);
+ const viewerRef = useRef(null);
+
+ useEffect(() => {
+ const viewer = new SenseEditor($(divRef.current!));
+ viewerRef.current = viewer;
+ viewer.renderer.setShowPrintMargin(false);
+ viewer.$blockScrolling = Infinity;
+ const unsubscribe = subscribeResizeChecker(ResizeChecker, divRef.current!, viewer);
+ settings.applyCurrentSettings(viewer);
+ return () => unsubscribe();
+ }, []);
+
+ if (viewerRef.current) {
+ const { current: viewer } = viewerRef;
+ if (req) {
+ const s = req.method + ' ' + req.endpoint + '\n' + (req.data || '');
+ viewer.setValue(s);
+ viewer.clearSelection();
+ } else {
+ viewer.getSession().setValue(
+ i18n.translate('console.historyPage.noHistoryTextMessage', {
+ defaultMessage: 'No history available',
+ })
+ );
+ }
+ }
+
+ return ;
+}
diff --git a/src/legacy/core_plugins/console/np_ready/public/application/containers/editor/legacy/console_history/index.ts b/src/legacy/core_plugins/console/np_ready/public/application/containers/editor/legacy/console_history/index.ts
new file mode 100644
index 0000000000000..ba5b52f8ea4ad
--- /dev/null
+++ b/src/legacy/core_plugins/console/np_ready/public/application/containers/editor/legacy/console_history/index.ts
@@ -0,0 +1,20 @@
+/*
+ * Licensed to Elasticsearch B.V. under one or more contributor
+ * license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright
+ * ownership. Elasticsearch B.V. licenses this file to you under
+ * the Apache License, Version 2.0 (the "License"); you may
+ * not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+export { ConsoleHistory } from './console_history';
diff --git a/src/legacy/core_plugins/console/np_ready/public/application/containers/editor/legacy/console_menu_actions.ts b/src/legacy/core_plugins/console/np_ready/public/application/containers/editor/legacy/console_menu_actions.ts
new file mode 100644
index 0000000000000..e4fdb43e68e50
--- /dev/null
+++ b/src/legacy/core_plugins/console/np_ready/public/application/containers/editor/legacy/console_menu_actions.ts
@@ -0,0 +1,49 @@
+/*
+ * 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 { getEndpointFromPosition } from '../../../../../../public/quarantined/src/autocomplete';
+
+export function autoIndent(editor: any, event: any) {
+ editor.autoIndent();
+ event.preventDefault();
+ editor.focus();
+}
+
+export function getDocumentation(editor: any, docLinkVersion: string): Promise {
+ return new Promise(resolve => {
+ editor.getRequestsInRange((requests: any) => {
+ if (!requests || requests.length === 0) {
+ resolve(null);
+ return;
+ }
+ const position = requests[0].range.end;
+ position.column = position.column - 1;
+ const endpoint = getEndpointFromPosition(editor, position);
+ if (endpoint && endpoint.documentation && endpoint.documentation.indexOf('http') !== -1) {
+ const nextDocumentation = endpoint.documentation
+ .replace('/master/', `/${docLinkVersion}/`)
+ .replace('/current/', `/${docLinkVersion}/`);
+ resolve(nextDocumentation);
+ } else {
+ resolve(null);
+ }
+ });
+ });
+}
diff --git a/src/legacy/core_plugins/console/np_ready/public/application/containers/editor/legacy/index.ts b/src/legacy/core_plugins/console/np_ready/public/application/containers/editor/legacy/index.ts
new file mode 100644
index 0000000000000..134f3de42833b
--- /dev/null
+++ b/src/legacy/core_plugins/console/np_ready/public/application/containers/editor/legacy/index.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 { EditorOutput, Editor } from './console_editor';
+export { ConsoleHistory } from './console_history';
+export { getDocumentation, autoIndent } from './console_menu_actions';
diff --git a/src/legacy/core_plugins/console/public/src/sense_editor_resize.js b/src/legacy/core_plugins/console/np_ready/public/application/containers/editor/legacy/subscribe_console_resize_checker.ts
similarity index 83%
rename from src/legacy/core_plugins/console/public/src/sense_editor_resize.js
rename to src/legacy/core_plugins/console/np_ready/public/application/containers/editor/legacy/subscribe_console_resize_checker.ts
index 6b950a394db1b..ae15a652d40c4 100644
--- a/src/legacy/core_plugins/console/public/src/sense_editor_resize.js
+++ b/src/legacy/core_plugins/console/np_ready/public/application/containers/editor/legacy/subscribe_console_resize_checker.ts
@@ -17,10 +17,8 @@
* under the License.
*/
-import { ResizeChecker } from 'ui/resize_checker';
-
-export function applyResizeCheckerToEditors($scope, $el, ...editors) {
+export function subscribeResizeChecker(ResizeChecker: any, $el: any, ...editors: any[]) {
const checker = new ResizeChecker($el);
checker.on('resize', () => editors.forEach(e => e.resize()));
- $scope.$on('$destroy', () => checker.destroy());
+ return () => checker.destroy();
}
diff --git a/src/legacy/core_plugins/console/np_ready/public/application/containers/editor/legacy/use_ui_ace_keyboard_mode.tsx b/src/legacy/core_plugins/console/np_ready/public/application/containers/editor/legacy/use_ui_ace_keyboard_mode.tsx
new file mode 100644
index 0000000000000..2b2387e04622c
--- /dev/null
+++ b/src/legacy/core_plugins/console/np_ready/public/application/containers/editor/legacy/use_ui_ace_keyboard_mode.tsx
@@ -0,0 +1,106 @@
+/*
+ * 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 React, { useEffect, useRef } from 'react';
+import * as ReactDOM from 'react-dom';
+import { keyCodes, EuiText } from '@elastic/eui';
+
+const OverlayText = () => (
+ // The point of this element is for accessibility purposes, so ignore eslint error
+ // in this case
+ //
+ // eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions
+ <>
+ Press Enter to start editing.
+ When you’re done, press Escape to stop editing.
+ >
+);
+
+export function useUIAceKeyboardMode(aceTextAreaElement: HTMLTextAreaElement | null) {
+ const overlayMountNode = useRef(null);
+ const autoCompleteVisibleRef = useRef(false);
+
+ function onDismissOverlay(event: KeyboardEvent) {
+ if (event.keyCode === keyCodes.ENTER) {
+ event.preventDefault();
+ aceTextAreaElement!.focus();
+ }
+ }
+
+ function enableOverlay() {
+ if (overlayMountNode.current) {
+ overlayMountNode.current.focus();
+ }
+ }
+
+ const isAutoCompleteVisible = () => {
+ const autoCompleter = document.querySelector('.ace_autocomplete');
+ if (!autoCompleter) {
+ return false;
+ }
+ // The autoComplete is just hidden when it's closed, not removed from the DOM.
+ return autoCompleter.style.display !== 'none';
+ };
+
+ const documentKeyDownListener = () => {
+ autoCompleteVisibleRef.current = isAutoCompleteVisible();
+ };
+
+ const aceKeydownListener = (event: KeyboardEvent) => {
+ if (event.keyCode === keyCodes.ESCAPE && !autoCompleteVisibleRef.current) {
+ event.preventDefault();
+ event.stopPropagation();
+ enableOverlay();
+ }
+ };
+
+ useEffect(() => {
+ if (aceTextAreaElement) {
+ // We don't control HTML elements inside of ace so we imperatively create an element
+ // that acts as a container and insert it just before ace's textarea element
+ // so that the overlay lives at the correct spot in the DOM hierarchy.
+ overlayMountNode.current = document.createElement('div');
+ overlayMountNode.current.className = 'kbnUiAceKeyboardHint';
+ overlayMountNode.current.setAttribute('role', 'application');
+ overlayMountNode.current.tabIndex = 0;
+ overlayMountNode.current.addEventListener('focus', enableOverlay);
+ overlayMountNode.current.addEventListener('keydown', onDismissOverlay);
+
+ ReactDOM.render(, overlayMountNode.current);
+
+ aceTextAreaElement.parentElement!.insertBefore(overlayMountNode.current, aceTextAreaElement);
+ aceTextAreaElement.setAttribute('tabindex', '-1');
+
+ // Order of events:
+ // 1. Document capture event fires first and we check whether an autocomplete menu is open on keydown
+ // (not ideal because this is scoped to the entire document).
+ // 2. Ace changes it's state (like hiding or showing autocomplete menu)
+ // 3. We check what button was pressed and whether autocomplete was visible then determine
+ // whether it should act like a dismiss or if we should display an overlay.
+ document.addEventListener('keydown', documentKeyDownListener, { capture: true });
+ aceTextAreaElement.addEventListener('keydown', aceKeydownListener);
+ }
+ return () => {
+ if (aceTextAreaElement) {
+ document.removeEventListener('keydown', documentKeyDownListener);
+ aceTextAreaElement.removeEventListener('keydown', aceKeydownListener);
+ document.removeChild(overlayMountNode.current!);
+ }
+ };
+ }, [aceTextAreaElement]);
+}
diff --git a/src/legacy/core_plugins/console/np_ready/public/application/containers/index.ts b/src/legacy/core_plugins/console/np_ready/public/application/containers/index.ts
new file mode 100644
index 0000000000000..44e8355611f48
--- /dev/null
+++ b/src/legacy/core_plugins/console/np_ready/public/application/containers/index.ts
@@ -0,0 +1,20 @@
+/*
+ * Licensed to Elasticsearch B.V. under one or more contributor
+ * license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright
+ * ownership. Elasticsearch B.V. licenses this file to you under
+ * the Apache License, Version 2.0 (the "License"); you may
+ * not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+export { Main } from './main';
diff --git a/src/legacy/core_plugins/console/public/src/helpers/get_top_nav.ts b/src/legacy/core_plugins/console/np_ready/public/application/containers/main/get_top_nav.ts
similarity index 78%
rename from src/legacy/core_plugins/console/public/src/helpers/get_top_nav.ts
rename to src/legacy/core_plugins/console/np_ready/public/application/containers/main/get_top_nav.ts
index 3b5fae6ff669d..330f0d1a6c1cf 100644
--- a/src/legacy/core_plugins/console/public/src/helpers/get_top_nav.ts
+++ b/src/legacy/core_plugins/console/np_ready/public/application/containers/main/get_top_nav.ts
@@ -19,13 +19,13 @@
import { i18n } from '@kbn/i18n';
-import { IScope } from 'angular';
-import { showSettingsModal } from './settings_show_modal';
-
-// help
-import { showHelpPanel } from './help_show_panel';
+interface Props {
+ onClickHistory: () => void;
+ onClickSettings: () => void;
+ onClickHelp: () => void;
+}
-export function getTopNavConfig($scope: IScope, toggleHistory: () => {}) {
+export function getTopNavConfig({ onClickHistory, onClickSettings, onClickHelp }: Props) {
return [
{
id: 'history',
@@ -35,8 +35,8 @@ export function getTopNavConfig($scope: IScope, toggleHistory: () => {}) {
description: i18n.translate('console.topNav.historyTabDescription', {
defaultMessage: 'History',
}),
- run: () => {
- $scope.$evalAsync(toggleHistory);
+ onClick: () => {
+ onClickHistory();
},
testId: 'consoleHistoryButton',
},
@@ -48,8 +48,8 @@ export function getTopNavConfig($scope: IScope, toggleHistory: () => {}) {
description: i18n.translate('console.topNav.settingsTabDescription', {
defaultMessage: 'Settings',
}),
- run: () => {
- showSettingsModal();
+ onClick: () => {
+ onClickSettings();
},
testId: 'consoleSettingsButton',
},
@@ -61,11 +61,8 @@ export function getTopNavConfig($scope: IScope, toggleHistory: () => {}) {
description: i18n.translate('console.topNav.helpTabDescription', {
defaultMessage: 'Help',
}),
- run: () => {
- const hideHelpPanel = showHelpPanel();
- $scope.$on('$destroy', () => {
- hideHelpPanel();
- });
+ onClick: () => {
+ onClickHelp();
},
testId: 'consoleHelpButton',
},
diff --git a/src/legacy/core_plugins/console/np_ready/public/application/containers/main/index.ts b/src/legacy/core_plugins/console/np_ready/public/application/containers/main/index.ts
new file mode 100644
index 0000000000000..44e8355611f48
--- /dev/null
+++ b/src/legacy/core_plugins/console/np_ready/public/application/containers/main/index.ts
@@ -0,0 +1,20 @@
+/*
+ * Licensed to Elasticsearch B.V. under one or more contributor
+ * license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright
+ * ownership. Elasticsearch B.V. licenses this file to you under
+ * the Apache License, Version 2.0 (the "License"); you may
+ * not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+export { Main } from './main';
diff --git a/src/legacy/core_plugins/console/np_ready/public/application/containers/main/main.tsx b/src/legacy/core_plugins/console/np_ready/public/application/containers/main/main.tsx
new file mode 100644
index 0000000000000..8386eaf46e445
--- /dev/null
+++ b/src/legacy/core_plugins/console/np_ready/public/application/containers/main/main.tsx
@@ -0,0 +1,264 @@
+/*
+ * 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 React, { useCallback, useEffect, useRef, useState } from 'react';
+import { debounce } from 'lodash';
+import { EuiFlexGroup, EuiFlexItem } from '@elastic/eui';
+import { BehaviorSubject, combineLatest } from 'rxjs';
+
+// @ts-ignore
+import mappings from '../../../../../public/quarantined/src/mappings';
+// @ts-ignore
+import init from '../../../../../public/quarantined/src/app';
+
+import { EditorOutput, Editor, ConsoleHistory } from '../editor';
+import { subscribeResizeChecker } from '../editor/legacy/subscribe_console_resize_checker';
+
+import {
+ AutocompleteOptions,
+ TopNavMenu,
+ WelcomePanel,
+ DevToolsSettingsModal,
+ HelpPanel,
+ PanelsContainer,
+ Panel,
+} from '../../components';
+
+import { useAppContext } from '../../context';
+import { StorageKeys, DevToolsSettings } from '../../../services';
+
+import { getTopNavConfig } from './get_top_nav';
+
+const INITIAL_PANEL_WIDTH = 50;
+const PANEL_MIN_WIDTH = '100px';
+
+// We only run certain initialization after we know all our editors have
+// been instantiated -- which is what we use the below streams for.
+const inputReadySubject$ = new BehaviorSubject(null);
+const outputReadySubject$ = new BehaviorSubject(null);
+const editorsReady$ = combineLatest(inputReadySubject$, outputReadySubject$);
+
+export function Main() {
+ const {
+ services: { storage, settings, history },
+ docLinkVersion,
+ ResizeChecker,
+ } = useAppContext();
+
+ const [editorReady, setEditorReady] = useState(false);
+ const [inputEditor, setInputEditor] = useState(null);
+ const [outputEditor, setOutputEditor] = useState(null);
+ const [showWelcome, setShowWelcomePanel] = useState(
+ () => storage.get('version_welcome_shown') !== '@@SENSE_REVISION'
+ );
+
+ const [showingHistory, setShowHistory] = useState(false);
+ const [showSettings, setShowSettings] = useState(false);
+ const [showHelp, setShowHelp] = useState(false);
+
+ const containerRef = useRef(null);
+
+ const onInputEditorReady = useCallback((value: any) => {
+ inputReadySubject$.next(value);
+ }, []);
+
+ const onOutputEditorReady = useCallback((value: any) => {
+ outputReadySubject$.next(value);
+ }, []);
+
+ const [firstPanelWidth, secondPanelWidth] = storage.get(StorageKeys.WIDTH, [
+ INITIAL_PANEL_WIDTH,
+ INITIAL_PANEL_WIDTH,
+ ]);
+
+ const onPanelWidthChange = useCallback(
+ debounce((widths: number[]) => {
+ storage.set(StorageKeys.WIDTH, widths);
+ }, 300),
+ []
+ );
+
+ const [pastRequests, setPastRequests] = useState(() => history.getHistory());
+
+ const sendCurrentRequest = useCallback(() => {
+ inputEditor.focus();
+ inputEditor.sendCurrentRequestToES(() => {
+ setPastRequests(history.getHistory());
+ }, outputEditor);
+ }, [inputEditor, outputEditor]);
+
+ const clearHistory = useCallback(() => {
+ history.clearHistory();
+ setPastRequests(history.getHistory());
+ }, []);
+
+ const restoreFromHistory = useCallback((req: any) => {
+ history.restoreFromHistory(req);
+ }, []);
+
+ const renderConsoleHistory = () => {
+ return editorReady ? (
+ setShowHistory(false)}
+ />
+ ) : null;
+ };
+
+ const refreshAutocompleteSettings = (selectedSettings: any) => {
+ mappings.retrieveAutoCompleteInfo(selectedSettings);
+ };
+
+ const getAutocompleteDiff = (newSettings: DevToolsSettings, prevSettings: DevToolsSettings) => {
+ return Object.keys(newSettings.autocomplete).filter(key => {
+ // @ts-ignore
+ return prevSettings.autocomplete[key] !== newSettings.autocomplete[key];
+ });
+ };
+
+ const fetchAutocompleteSettingsIfNeeded = (
+ newSettings: DevToolsSettings,
+ prevSettings: DevToolsSettings
+ ) => {
+ // We'll only retrieve settings if polling is on. The expectation here is that if the user
+ // disables polling it's because they want manual control over the fetch request (possibly
+ // because it's a very expensive request given their cluster and bandwidth). In that case,
+ // they would be unhappy with any request that's sent automatically.
+ if (newSettings.polling) {
+ const autocompleteDiff = getAutocompleteDiff(newSettings, prevSettings);
+
+ const isSettingsChanged = autocompleteDiff.length > 0;
+ const isPollingChanged = prevSettings.polling !== newSettings.polling;
+
+ if (isSettingsChanged) {
+ // If the user has changed one of the autocomplete settings, then we'll fetch just the
+ // ones which have changed.
+ const changedSettings: any = autocompleteDiff.reduce(
+ (changedSettingsAccum: any, setting: string): any => {
+ changedSettingsAccum[setting] =
+ newSettings.autocomplete[setting as AutocompleteOptions];
+ return changedSettingsAccum;
+ },
+ {}
+ );
+ mappings.retrieveAutoCompleteInfo(changedSettings.autocomplete);
+ } else if (isPollingChanged) {
+ // If the user has turned polling on, then we'll fetch all selected autocomplete settings.
+ mappings.retrieveAutoCompleteInfo();
+ }
+ }
+ };
+
+ const onSaveSettings = async (newSettings: DevToolsSettings) => {
+ const prevSettings = settings.getCurrentSettings();
+ settings.updateSettings(newSettings);
+ fetchAutocompleteSettingsIfNeeded(newSettings, prevSettings);
+ setShowSettings(false);
+ };
+
+ useEffect(() => {
+ let resizerSubscriptions: Array<() => void> = [];
+ const subscription = editorsReady$.subscribe(([input, output]) => {
+ settings.registerOutput(output.editor);
+ settings.registerInput(input.editor);
+ history.setEditor(input.editor);
+
+ init(input.editor, output.editor, history);
+
+ resizerSubscriptions = resizerSubscriptions.concat([
+ subscribeResizeChecker(ResizeChecker, containerRef.current!, input.editor, output.editor),
+ subscribeResizeChecker(ResizeChecker, input.element, input.editor),
+ subscribeResizeChecker(ResizeChecker, output.element, output.editor),
+ ]);
+
+ setInputEditor(input.editor);
+ setOutputEditor(output.editor);
+ setEditorReady(true);
+ });
+
+ return () => {
+ resizerSubscriptions.map(done => done());
+ subscription.unsubscribe();
+ };
+ }, []);
+
+ return (
+
+ );
+}
diff --git a/src/legacy/core_plugins/console/np_ready/public/application/context/app_context.tsx b/src/legacy/core_plugins/console/np_ready/public/application/context/app_context.tsx
new file mode 100644
index 0000000000000..7811f27b94075
--- /dev/null
+++ b/src/legacy/core_plugins/console/np_ready/public/application/context/app_context.tsx
@@ -0,0 +1,50 @@
+/*
+ * 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 React, { createContext, useContext } from 'react';
+import { History, Storage, Settings } from '../../services';
+
+interface ContextValue {
+ services: {
+ history: History;
+ storage: Storage;
+ settings: Settings;
+ };
+ docLinkVersion: string;
+ ResizeChecker: any;
+}
+
+interface ContextProps {
+ value: ContextValue;
+ children: any;
+}
+
+const AppContext = createContext(null as any);
+
+export function AppContextProvider({ children, value }: ContextProps) {
+ return {children};
+}
+
+export const useAppContext = () => {
+ const context = useContext(AppContext);
+ if (context === undefined) {
+ throw new Error('useAppContext must be used inside the AppContextProvider.');
+ }
+ return context;
+};
diff --git a/src/legacy/core_plugins/console/np_ready/public/application/context/index.ts b/src/legacy/core_plugins/console/np_ready/public/application/context/index.ts
new file mode 100644
index 0000000000000..27d69f5736ffe
--- /dev/null
+++ b/src/legacy/core_plugins/console/np_ready/public/application/context/index.ts
@@ -0,0 +1,20 @@
+/*
+ * Licensed to Elasticsearch B.V. under one or more contributor
+ * license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright
+ * ownership. Elasticsearch B.V. licenses this file to you under
+ * the Apache License, Version 2.0 (the "License"); you may
+ * not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+export { useAppContext, AppContextProvider } from './app_context';
diff --git a/src/legacy/core_plugins/console/np_ready/public/application/index.tsx b/src/legacy/core_plugins/console/np_ready/public/application/index.tsx
new file mode 100644
index 0000000000000..5fb6e05aa9234
--- /dev/null
+++ b/src/legacy/core_plugins/console/np_ready/public/application/index.tsx
@@ -0,0 +1,50 @@
+/*
+ * 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 React from 'react';
+import { AppContextProvider } from './context';
+import { Main } from './containers';
+import { createStorage, createHistory, createSettings, Settings } from '../services';
+
+let settingsRef: Settings;
+export function legacyBackDoorToSettings() {
+ return settingsRef;
+}
+
+export function boot(deps: { docLinkVersion: string; I18nContext: any; ResizeChecker: any }) {
+ const { I18nContext, ResizeChecker } = deps;
+
+ const storage = createStorage({
+ engine: window.localStorage,
+ prefix: 'sense:',
+ });
+ const history = createHistory({ storage });
+ const settings = createSettings({ storage });
+ settingsRef = settings;
+
+ return (
+
+
+
+
+
+ );
+}
diff --git a/src/legacy/core_plugins/console/public/logo.svg b/src/legacy/core_plugins/console/np_ready/public/application/logo.svg
similarity index 100%
rename from src/legacy/core_plugins/console/public/logo.svg
rename to src/legacy/core_plugins/console/np_ready/public/application/logo.svg
diff --git a/src/legacy/core_plugins/console/public/src/directives/console_menu_directive.js b/src/legacy/core_plugins/console/np_ready/public/index.ts
similarity index 70%
rename from src/legacy/core_plugins/console/public/src/directives/console_menu_directive.js
rename to src/legacy/core_plugins/console/np_ready/public/index.ts
index be04e6bcc17fe..3f8d162f62d44 100644
--- a/src/legacy/core_plugins/console/public/src/directives/console_menu_directive.js
+++ b/src/legacy/core_plugins/console/np_ready/public/index.ts
@@ -17,14 +17,12 @@
* under the License.
*/
-import 'ngreact';
+import { PluginInitializerContext } from '../../../../../core/public';
-import { wrapInI18nContext } from 'ui/i18n';
-import { uiModules } from 'ui/modules';
-const module = uiModules.get('apps/sense', ['react']);
+import { ConsoleUIPlugin } from './plugin';
-import { ConsoleMenu } from '../components/console_menu';
+export { ConsoleUIPlugin as Plugin };
-module.directive('consoleMenu', function (reactDirective) {
- return reactDirective(wrapInI18nContext(ConsoleMenu));
-});
+export function plugin(ctx: PluginInitializerContext) {
+ return new ConsoleUIPlugin(ctx);
+}
diff --git a/src/legacy/core_plugins/console/np_ready/public/legacy.ts b/src/legacy/core_plugins/console/np_ready/public/legacy.ts
new file mode 100644
index 0000000000000..7b8d27510d385
--- /dev/null
+++ b/src/legacy/core_plugins/console/np_ready/public/legacy.ts
@@ -0,0 +1,93 @@
+/*
+ * 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 'brace';
+import 'brace/ext/language_tools';
+import 'brace/ext/searchbox';
+import 'brace/mode/json';
+import 'brace/mode/text';
+
+/* eslint-disable @kbn/eslint/no-restricted-paths */
+import { npSetup, npStart } from 'ui/new_platform';
+import uiRoutes from 'ui/routes';
+import { DOC_LINK_VERSION } from 'ui/documentation_links';
+import { I18nContext } from 'ui/i18n';
+import { ResizeChecker } from 'ui/resize_checker';
+import 'ui/autoload/styles';
+import 'ui/capabilities/route_setup';
+/* eslint-enable @kbn/eslint/no-restricted-paths */
+
+import template from '../../public/quarantined/index.html';
+import { App } from '../../../../../core/public';
+
+export interface XPluginSet {
+ __LEGACY: {
+ I18nContext: any;
+ ResizeChecker: any;
+ docLinkVersion: string;
+ };
+}
+
+import { plugin } from '.';
+
+const pluginInstance = plugin({} as any);
+
+const anyObject = {} as any;
+
+uiRoutes.when('/dev_tools/console', {
+ requireUICapability: 'dev_tools.show',
+ controller: function RootController($scope) {
+ // Stub out this config for now...
+ $scope.topNavMenu = [];
+
+ $scope.initReactApp = () => {
+ const targetElement = document.querySelector('#consoleRoot');
+ if (!targetElement) {
+ const message = `Could not mount Console App!`;
+ npSetup.core.fatalErrors.add(message);
+ throw new Error(message);
+ }
+
+ const mockedSetupCore = {
+ ...npSetup.core,
+ application: {
+ register(app: App): void {
+ try {
+ app.mount(anyObject, { element: targetElement, appBasePath: '' });
+ } catch (e) {
+ npSetup.core.fatalErrors.add(e);
+ }
+ },
+ registerMountContext() {},
+ },
+ };
+
+ pluginInstance.setup(mockedSetupCore, {
+ ...npSetup.plugins,
+ __LEGACY: {
+ I18nContext,
+ ResizeChecker,
+ docLinkVersion: DOC_LINK_VERSION,
+ },
+ });
+ pluginInstance.start(npStart.core);
+ };
+ },
+ template,
+});
diff --git a/src/legacy/core_plugins/console/np_ready/public/plugin.ts b/src/legacy/core_plugins/console/np_ready/public/plugin.ts
new file mode 100644
index 0000000000000..f24224ff97b3a
--- /dev/null
+++ b/src/legacy/core_plugins/console/np_ready/public/plugin.ts
@@ -0,0 +1,49 @@
+/*
+ * 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 { render, unmountComponentAtNode } from 'react-dom';
+
+import { PluginInitializerContext, Plugin, CoreStart, CoreSetup } from '../../../../../core/public';
+import { XPluginSet } from './legacy';
+import { boot } from './application';
+
+export class ConsoleUIPlugin implements Plugin {
+ // @ts-ignore
+ constructor(private readonly ctx: PluginInitializerContext) {}
+
+ async setup({ application }: CoreSetup, pluginSet: XPluginSet) {
+ const {
+ __LEGACY: { docLinkVersion, I18nContext, ResizeChecker },
+ } = pluginSet;
+
+ application.register({
+ id: 'console',
+ order: 1,
+ title: 'Console',
+ mount(ctx, { element }) {
+ render(boot({ docLinkVersion, I18nContext, ResizeChecker }), element);
+ return () => {
+ unmountComponentAtNode(element);
+ };
+ },
+ });
+ }
+
+ async start(core: CoreStart) {}
+}
diff --git a/src/legacy/core_plugins/console/np_ready/public/services/history.ts b/src/legacy/core_plugins/console/np_ready/public/services/history.ts
new file mode 100644
index 0000000000000..fba33feb101b1
--- /dev/null
+++ b/src/legacy/core_plugins/console/np_ready/public/services/history.ts
@@ -0,0 +1,117 @@
+/*
+ * 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 { Storage } from './index';
+
+export class History {
+ private editor: any;
+
+ constructor(private readonly storage: Storage) {}
+
+ setEditor(editor: any) {
+ this.editor = editor;
+ }
+
+ // stupid simple restore function, called when the user
+ // chooses to restore a request from the history
+ // PREVENTS history from needing to know about the input
+ restoreFromHistory(req: any) {
+ const session = this.editor.getSession();
+ let pos = this.editor.getCursorPosition();
+ let prefix = '';
+ let suffix = '\n';
+ if (this.editor.parser.isStartRequestRow(pos.row)) {
+ pos.column = 0;
+ suffix += '\n';
+ } else if (this.editor.parser.isEndRequestRow(pos.row)) {
+ const line = session.getLine(pos.row);
+ pos.column = line.length;
+ prefix = '\n\n';
+ } else if (this.editor.parser.isInBetweenRequestsRow(pos.row)) {
+ pos.column = 0;
+ } else {
+ pos = this.editor.nextRequestEnd(pos);
+ prefix = '\n\n';
+ }
+
+ let s = prefix + req.method + ' ' + req.endpoint;
+ if (req.data) {
+ s += '\n' + req.data;
+ }
+
+ s += suffix;
+
+ session.insert(pos, s);
+ this.editor.clearSelection();
+ this.editor.moveCursorTo(pos.row + prefix.length, 0);
+ this.editor.focus();
+ }
+
+ getHistoryKeys() {
+ return this.storage
+ .keys()
+ .filter((key: string) => key.indexOf('hist_elem') === 0)
+ .sort()
+ .reverse();
+ }
+
+ getHistory() {
+ return this.getHistoryKeys().map(key => this.storage.get(key));
+ }
+
+ addToHistory(endpoint: string, method: string, data: any) {
+ const keys = this.getHistoryKeys();
+ keys.splice(0, 500); // only maintain most recent X;
+ $.each(keys, (i, k) => {
+ this.storage.delete(k);
+ });
+
+ const timestamp = new Date().getTime();
+ const k = 'hist_elem_' + timestamp;
+ this.storage.set(k, {
+ time: timestamp,
+ endpoint,
+ method,
+ data,
+ });
+ }
+
+ updateCurrentState(content: any) {
+ const timestamp = new Date().getTime();
+ this.storage.set('editor_state', {
+ time: timestamp,
+ content,
+ });
+ }
+
+ getSavedEditorState() {
+ const saved = this.storage.get('editor_state');
+ if (!saved) return;
+ const { time, content } = saved;
+ return { time, content };
+ }
+
+ clearHistory() {
+ this.getHistoryKeys().forEach(key => this.storage.delete(key));
+ }
+}
+
+export function createHistory(deps: { storage: Storage }) {
+ return new History(deps.storage);
+}
diff --git a/src/legacy/core_plugins/console/public/console.js b/src/legacy/core_plugins/console/np_ready/public/services/index.ts
similarity index 64%
rename from src/legacy/core_plugins/console/public/console.js
rename to src/legacy/core_plugins/console/np_ready/public/services/index.ts
index 2cb8d299d993f..c54cafab7f6bc 100644
--- a/src/legacy/core_plugins/console/public/console.js
+++ b/src/legacy/core_plugins/console/np_ready/public/services/index.ts
@@ -17,21 +17,6 @@
* under the License.
*/
-import uiRoutes from 'ui/routes';
-import template from './index.html';
-
-require('brace');
-
-require('ui/autoload/styles');
-require('ui/capabilities/route_setup');
-
-require('./src/controllers/sense_controller');
-require('./src/directives/sense_history');
-require('./src/directives/console_menu_directive');
-
-
-uiRoutes.when('/dev_tools/console', {
- requireUICapability: 'dev_tools.show',
- controller: 'SenseController',
- template,
-});
+export { createHistory, History } from './history';
+export { createStorage, Storage, StorageKeys } from './storage';
+export { createSettings, Settings, DevToolsSettings } from './settings';
diff --git a/src/legacy/core_plugins/console/np_ready/public/services/settings.ts b/src/legacy/core_plugins/console/np_ready/public/services/settings.ts
new file mode 100644
index 0000000000000..5986a8e0eddde
--- /dev/null
+++ b/src/legacy/core_plugins/console/np_ready/public/services/settings.ts
@@ -0,0 +1,142 @@
+/*
+ * 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 { Storage } from './index';
+
+export interface DevToolsSettings {
+ fontSize: number;
+ wrapMode: boolean;
+ autocomplete: {
+ fields: boolean;
+ indices: boolean;
+ templates: boolean;
+ };
+ polling: boolean;
+ tripleQuotes: boolean;
+}
+
+export class Settings {
+ private input: any | null = null;
+ private output: any | null = null;
+
+ constructor(private readonly storage: Storage) {}
+
+ /**
+ * TODO: Slight hackiness going on here - late registration of dependencies should be refactored
+ */
+ registerInput(input: any) {
+ this.input = input;
+ }
+ /**
+ * TODO: Slight hackiness going on here - late registration of dependencies should be refactored
+ */
+ registerOutput(output: any) {
+ this.output = output;
+ }
+
+ getFontSize() {
+ return this.storage.get('font_size', 14);
+ }
+
+ setFontSize(size: any) {
+ this.storage.set('font_size', size);
+ this.applyCurrentSettings();
+ return true;
+ }
+
+ getWrapMode() {
+ return this.storage.get('wrap_mode', true);
+ }
+
+ setWrapMode(mode: any) {
+ this.storage.set('wrap_mode', mode);
+ this.applyCurrentSettings();
+ return true;
+ }
+
+ setTripleQuotes(tripleQuotes: any) {
+ this.storage.set('triple_quotes', tripleQuotes);
+ return true;
+ }
+
+ getTripleQuotes() {
+ return this.storage.get('triple_quotes', true);
+ }
+
+ getAutocomplete() {
+ return this.storage.get('autocomplete_settings', {
+ fields: true,
+ indices: true,
+ templates: true,
+ });
+ }
+
+ setAutocomplete(settings: any) {
+ this.storage.set('autocomplete_settings', settings);
+ return true;
+ }
+
+ getPolling() {
+ return this.storage.get('console_polling', true);
+ }
+
+ setPolling(polling: any) {
+ this.storage.set('console_polling', polling);
+ this.applyCurrentSettings();
+ return true;
+ }
+
+ applyCurrentSettings(editor?: any) {
+ if (typeof editor === 'undefined') {
+ if (this.input) this.applyCurrentSettings(this.input);
+ if (this.output) this.applyCurrentSettings(this.output);
+ } else if (editor) {
+ editor.getSession().setUseWrapMode(this.getWrapMode());
+ editor.$el.css('font-size', this.getFontSize() + 'px');
+ }
+ }
+
+ getCurrentSettings(): DevToolsSettings {
+ return {
+ autocomplete: this.getAutocomplete(),
+ wrapMode: this.getWrapMode(),
+ tripleQuotes: this.getTripleQuotes(),
+ fontSize: parseFloat(this.getFontSize()),
+ polling: Boolean(this.getPolling()),
+ };
+ }
+
+ updateSettings({ fontSize, wrapMode, tripleQuotes, autocomplete, polling }: any) {
+ this.setFontSize(fontSize);
+ this.setWrapMode(wrapMode);
+ this.setTripleQuotes(tripleQuotes);
+ this.setAutocomplete(autocomplete);
+ this.setPolling(polling);
+ this.input.focus();
+ return this.getCurrentSettings();
+ }
+}
+
+interface Deps {
+ storage: Storage;
+}
+
+export function createSettings({ storage }: Deps) {
+ return new Settings(storage);
+}
diff --git a/src/legacy/core_plugins/console/public/src/storage.js b/src/legacy/core_plugins/console/np_ready/public/services/storage.ts
similarity index 71%
rename from src/legacy/core_plugins/console/public/src/storage.js
rename to src/legacy/core_plugins/console/np_ready/public/services/storage.ts
index fc8113287e971..2ac6fc5861ad2 100644
--- a/src/legacy/core_plugins/console/public/src/storage.js
+++ b/src/legacy/core_plugins/console/np_ready/public/services/storage.ts
@@ -17,44 +17,47 @@
* under the License.
*/
-const { transform, keys, startsWith } = require('lodash');
+import { transform, keys, startsWith } from 'lodash';
-class Storage {
- constructor(engine, prefix) {
- this.engine = engine;
- this.prefix = prefix;
- }
+type IStorageEngine = typeof window.localStorage;
+
+export enum StorageKeys {
+ WIDTH = 'widths',
+}
- encode(val) {
+export class Storage {
+ constructor(private readonly engine: IStorageEngine, private readonly prefix: string) {}
+
+ encode(val: any) {
return JSON.stringify(val);
}
- decode(val) {
+ decode(val: any) {
if (typeof val === 'string') {
return JSON.parse(val);
}
}
- encodeKey(key) {
+ encodeKey(key: string) {
return `${this.prefix}${key}`;
}
- decodeKey(key) {
+ decodeKey(key: string) {
if (startsWith(key, this.prefix)) {
return `${key.slice(this.prefix.length)}`;
}
}
- set(key, val) {
+ set(key: string, val: any) {
this.engine.setItem(this.encodeKey(key), this.encode(val));
return val;
}
- has(key) {
+ has(key: string) {
return this.engine.getItem(this.encodeKey(key)) != null;
}
- get(key, _default) {
+ get(key: string, _default?: T) {
if (this.has(key)) {
return this.decode(this.engine.getItem(this.encodeKey(key)));
} else {
@@ -62,11 +65,11 @@ class Storage {
}
}
- delete(key) {
+ delete(key: string) {
return this.engine.removeItem(this.encodeKey(key));
}
- keys() {
+ keys(): string[] {
return transform(keys(this.engine), (ours, key) => {
const ourKey = this.decodeKey(key);
if (ourKey != null) ours.push(ourKey);
@@ -74,6 +77,6 @@ class Storage {
}
}
-const instance = new Storage(window.localStorage, 'sense:');
-
-export default instance;
+export function createStorage(deps: { engine: IStorageEngine; prefix: string }) {
+ return new Storage(deps.engine, deps.prefix);
+}
diff --git a/src/legacy/core_plugins/console/np_ready/server/.gitkeep b/src/legacy/core_plugins/console/np_ready/server/.gitkeep
new file mode 100644
index 0000000000000..e69de29bb2d1d
diff --git a/src/legacy/core_plugins/console/public/README.md b/src/legacy/core_plugins/console/public/README.md
new file mode 100644
index 0000000000000..3a53c46143793
--- /dev/null
+++ b/src/legacy/core_plugins/console/public/README.md
@@ -0,0 +1,21 @@
+## New Platform (NP) Ready vs Quarantined
+
+We want to move toward more modularised code in the Console app.
+Part of the effort means separating out different console components
+like:
+
+- The language parser
+- The editor rendering component
+- Autocomplete
+- The UI container components
+
+In addition to this effort we want to bring Console in line with NP
+requirements and ensure that we are not using angular and public ui
+in this app anymore.
+
+The quarantined folder contains all of the code that has not been cleared
+for living in the new platform as it has not been properly refactored
+or has dependencies on, for example, UI public.
+
+Over time, the quarantined part of the code should shrink to nothing
+and we should only have NP ready code.
diff --git a/src/legacy/core_plugins/console/public/index.html b/src/legacy/core_plugins/console/public/index.html
deleted file mode 100644
index f2454baf43815..0000000000000
--- a/src/legacy/core_plugins/console/public/index.html
+++ /dev/null
@@ -1,42 +0,0 @@
-
-
-
-
-
-
-
-
diff --git a/src/legacy/core_plugins/console/public/_app.scss b/src/legacy/core_plugins/console/public/quarantined/_app.scss
similarity index 80%
rename from src/legacy/core_plugins/console/public/_app.scss
rename to src/legacy/core_plugins/console/public/quarantined/_app.scss
index f3de2a9ee9e5b..5fd2cd080d06d 100644
--- a/src/legacy/core_plugins/console/public/_app.scss
+++ b/src/legacy/core_plugins/console/public/quarantined/_app.scss
@@ -1,19 +1,26 @@
+// TODO: Move all of the styles here (should be modularised by, e.g., CSS-in-JS or CSS modules).
+#consoleRoot {
+ height: 100%;
+ // Make sure the editor actions don't create scrollbars on this container
+ // SASSTODO: Uncomment when tooltips are EUI-ified (inside portals)
+ overflow: hidden;
+}
+
+.consoleContainer {
+ padding: $euiSizeS;
+}
+
.conApp {
display: flex;
flex: 1 1 auto;
- position: relative;
- padding: $euiSizeS;
- // Make sure the editor actions don't create scrollbars on this container
- // SASSTODO: Uncomment when tooltips are EUI-ified (inside portals)
- // overflow: hidden;
}
.conApp__editor {
- // Default size of left side is half the large breakpoint
- // but this is inline overridden by the resizer
- width: map-get($euiBreakpoints, "l") / 2;
+ width: 100%;
display: flex;
flex: 0 0 auto;
+
+ // Required on IE11 to render ace editor correctly after first input.
position: relative;
}
@@ -24,6 +31,7 @@
.conApp__editorContent,
.conApp__outputContent {
+ height: 100%;
flex: 1 1 1px;
}
diff --git a/src/legacy/core_plugins/console/public/hacks/register.js b/src/legacy/core_plugins/console/public/quarantined/hacks/register.js
similarity index 94%
rename from src/legacy/core_plugins/console/public/hacks/register.js
rename to src/legacy/core_plugins/console/public/quarantined/hacks/register.js
index 4869ae4b0ed00..b5df1c1af99c5 100644
--- a/src/legacy/core_plugins/console/public/hacks/register.js
+++ b/src/legacy/core_plugins/console/public/quarantined/hacks/register.js
@@ -24,7 +24,7 @@ DevToolsRegistryProvider.register(() => ({
order: 1,
name: 'console',
display: i18n.translate('console.consoleDisplayName', {
- defaultMessage: 'Console'
+ defaultMessage: 'Console',
}),
- url: '#/dev_tools/console'
+ url: '#/dev_tools/console',
}));
diff --git a/src/legacy/core_plugins/console/public/quarantined/index.html b/src/legacy/core_plugins/console/public/quarantined/index.html
new file mode 100644
index 0000000000000..66a693d4b2af7
--- /dev/null
+++ b/src/legacy/core_plugins/console/public/quarantined/index.html
@@ -0,0 +1,3 @@
+
+
+
diff --git a/src/legacy/core_plugins/console/public/index.scss b/src/legacy/core_plugins/console/public/quarantined/index.scss
similarity index 100%
rename from src/legacy/core_plugins/console/public/index.scss
rename to src/legacy/core_plugins/console/public/quarantined/index.scss
diff --git a/src/legacy/core_plugins/console/public/src/__tests__/app.js b/src/legacy/core_plugins/console/public/quarantined/src/__tests__/app.js
similarity index 89%
rename from src/legacy/core_plugins/console/public/src/__tests__/app.js
rename to src/legacy/core_plugins/console/public/quarantined/src/__tests__/app.js
index 60c6f7a8ebb54..a1984bca3ab02 100644
--- a/src/legacy/core_plugins/console/public/src/__tests__/app.js
+++ b/src/legacy/core_plugins/console/public/quarantined/src/__tests__/app.js
@@ -20,10 +20,11 @@
import sinon from 'sinon';
import $ from 'jquery';
-import history from '../history';
import mappings from '../mappings';
import init from '../app';
+const history = { getSavedEditorState() {}, };
+
describe('console app initialization', () => {
const sandbox = sinon.createSandbox();
@@ -33,7 +34,6 @@ describe('console app initialization', () => {
beforeEach(() => {
ajaxDoneStub = sinon.stub();
sandbox.stub($, 'ajax').returns({ done: ajaxDoneStub });
- sandbox.stub(history, 'getSavedEditorState');
sandbox.stub(mappings, 'retrieveAutoCompleteInfo');
inputMock = {
@@ -41,11 +41,11 @@ describe('console app initialization', () => {
moveToNextRequestEdge: sinon.stub(),
highlightCurrentRequestsAndUpdateActionBar: sinon.stub(),
updateActionsBar: sinon.stub(),
- getSession: sinon.stub().returns({ on() {} })
+ getSession: sinon.stub().returns({ on() {} }),
};
outputMock = {
- update: sinon.stub()
+ update: sinon.stub(),
};
});
@@ -57,13 +57,13 @@ describe('console app initialization', () => {
const mockContent = {};
ajaxDoneStub.yields(mockContent);
- init(inputMock, outputMock, 'https://state.link.com/content');
+ init(inputMock, outputMock, history, 'https://state.link.com/content');
sinon.assert.calledOnce($.ajax);
sinon.assert.calledWithExactly($.ajax, {
url: 'https://state.link.com/content',
dataType: 'text',
- kbnXsrfToken: false
+ kbnXsrfToken: false,
});
sinon.assert.calledTwice(inputMock.moveToNextRequestEdge);
@@ -81,14 +81,14 @@ describe('console app initialization', () => {
const mockContent = {};
ajaxDoneStub.yields(mockContent);
- init(inputMock, outputMock, 'https://api.github.com/content');
+ init(inputMock, outputMock, history, 'https://api.github.com/content');
sinon.assert.calledOnce($.ajax);
sinon.assert.calledWithExactly($.ajax, {
url: 'https://api.github.com/content',
dataType: 'text',
kbnXsrfToken: false,
- headers: { Accept: 'application/vnd.github.v3.raw' }
+ headers: { Accept: 'application/vnd.github.v3.raw' },
});
sinon.assert.calledTwice(inputMock.moveToNextRequestEdge);
diff --git a/src/legacy/core_plugins/console/public/src/__tests__/utils.js b/src/legacy/core_plugins/console/public/quarantined/src/__tests__/utils.js
similarity index 100%
rename from src/legacy/core_plugins/console/public/src/__tests__/utils.js
rename to src/legacy/core_plugins/console/public/quarantined/src/__tests__/utils.js
diff --git a/src/legacy/core_plugins/console/public/src/app.js b/src/legacy/core_plugins/console/public/quarantined/src/app.js
similarity index 63%
rename from src/legacy/core_plugins/console/public/src/app.js
rename to src/legacy/core_plugins/console/public/quarantined/src/app.js
index c591de73d0056..610e006f76e0f 100644
--- a/src/legacy/core_plugins/console/public/src/app.js
+++ b/src/legacy/core_plugins/console/public/quarantined/src/app.js
@@ -18,18 +18,21 @@
*/
const $ = require('jquery');
-
-const history = require('./history');
const mappings = require('./mappings');
-export default function init(input, output, sourceLocation = 'stored') {
+const DEFAULT_INPUT_VALUE = `GET _search
+{
+ "query": {
+ "match_all": {}
+ }
+}`;
+
+export default function init(input, output, history, sourceLocation = 'stored') {
$(document.body).removeClass('fouc');
// set the value of the input and clear the output
function resetToValues(content) {
- if (content != null) {
- input.update(content);
- }
+ input.update(content != null ? content : DEFAULT_INPUT_VALUE);
output.update('');
}
@@ -49,8 +52,7 @@ export default function init(input, output, sourceLocation = 'stored') {
try {
const content = input.getValue();
history.updateCurrentState(content);
- }
- catch (e) {
+ } catch (e) {
console.log('Ignoring saving error: ' + e);
}
}
@@ -60,76 +62,34 @@ export default function init(input, output, sourceLocation = 'stored') {
if (sourceLocation === 'stored') {
if (previousSaveState) {
resetToValues(previousSaveState.content);
- }
- else {
+ } else {
resetToValues();
- input.autoIndent();
}
- }
- else if (/^https?:\/\//.test(sourceLocation)) {
+ } else if (/^https?:\/\//.test(sourceLocation)) {
const loadFrom = {
url: sourceLocation,
// Having dataType here is required as it doesn't allow jQuery to `eval` content
// coming from the external source thereby preventing XSS attack.
dataType: 'text',
- kbnXsrfToken: false
+ kbnXsrfToken: false,
};
if (/https?:\/\/api.github.com/.test(sourceLocation)) {
loadFrom.headers = { Accept: 'application/vnd.github.v3.raw' };
}
- $.ajax(loadFrom).done((data) => {
+ $.ajax(loadFrom).done(data => {
resetToValues(data);
input.moveToNextRequestEdge(true);
input.highlightCurrentRequestsAndUpdateActionBar();
input.updateActionsBar();
});
- }
- else {
+ } else {
resetToValues();
}
input.moveToNextRequestEdge(true);
}
- // stupid simple restore function, called when the user
- // chooses to restore a request from the history
- // PREVENTS history from needing to know about the input
- history.restoreFromHistory = function applyHistoryElem(req) {
- const session = input.getSession();
- let pos = input.getCursorPosition();
- let prefix = '';
- let suffix = '\n';
- if (input.parser.isStartRequestRow(pos.row)) {
- pos.column = 0;
- suffix += '\n';
- }
- else if (input.parser.isEndRequestRow(pos.row)) {
- const line = session.getLine(pos.row);
- pos.column = line.length;
- prefix = '\n\n';
- }
- else if (input.parser.isInBetweenRequestsRow(pos.row)) {
- pos.column = 0;
- }
- else {
- pos = input.nextRequestEnd(pos);
- prefix = '\n\n';
- }
-
- let s = prefix + req.method + ' ' + req.endpoint;
- if (req.data) {
- s += '\n' + req.data;
- }
-
- s += suffix;
-
- session.insert(pos, s);
- input.clearSelection();
- input.moveCursorTo(pos.row + prefix.length, 0);
- input.focus();
- };
-
setupAutosave();
loadSavedState();
mappings.retrieveAutoCompleteInfo();
diff --git a/src/legacy/core_plugins/console/public/src/autocomplete.js b/src/legacy/core_plugins/console/public/quarantined/src/autocomplete.js
similarity index 97%
rename from src/legacy/core_plugins/console/public/src/autocomplete.js
rename to src/legacy/core_plugins/console/public/quarantined/src/autocomplete.js
index a29854ee2a02a..cec82e9690ead 100644
--- a/src/legacy/core_plugins/console/public/src/autocomplete.js
+++ b/src/legacy/core_plugins/console/public/quarantined/src/autocomplete.js
@@ -28,7 +28,6 @@ import { populateContext } from './autocomplete/engine';
import { URL_PATH_END_MARKER } from './autocomplete/components';
import _ from 'lodash';
import ace from 'brace';
-import 'brace/ext/language_tools';
import { i18n } from '@kbn/i18n';
const AceRange = ace.acequire('ace/range').Range;
@@ -914,30 +913,34 @@ export default function (editor) {
callback(null, []);
}
else {
- const terms = _.map(context.autoCompleteSet, function (term) {
- if (typeof term !== 'object') {
- term = {
- name: term
+ const terms = _.map(
+ context
+ .autoCompleteSet
+ .filter(term => Boolean(term) && term.name != null),
+ function (term) {
+ if (typeof term !== 'object') {
+ term = {
+ name: term
+ };
+ } else {
+ term = _.clone(term);
+ }
+ const defaults = {
+ value: term.name,
+ meta: 'API',
+ score: 0,
+ context: context,
};
- } else {
- term = _.clone(term);
- }
- const defaults = {
- value: term.name,
- meta: 'API',
- score: 0,
- context: context,
- };
- // we only need out custom insertMatch behavior for the body
- if (context.autoCompleteType === 'body') {
- defaults.completer = {
- insertMatch: function () {
- return applyTerm(term);
- }
- };
- }
- return _.defaults(term, defaults);
- });
+ // we only need out custom insertMatch behavior for the body
+ if (context.autoCompleteType === 'body') {
+ defaults.completer = {
+ insertMatch: function () {
+ return applyTerm(term);
+ }
+ };
+ }
+ return _.defaults(term, defaults);
+ });
terms.sort(function (t1, t2) {
/* score sorts from high to low */
diff --git a/src/legacy/core_plugins/console/public/src/autocomplete/body_completer.js b/src/legacy/core_plugins/console/public/quarantined/src/autocomplete/body_completer.js
similarity index 100%
rename from src/legacy/core_plugins/console/public/src/autocomplete/body_completer.js
rename to src/legacy/core_plugins/console/public/quarantined/src/autocomplete/body_completer.js
diff --git a/src/legacy/core_plugins/console/public/src/autocomplete/components/accept_endpoint_component.js b/src/legacy/core_plugins/console/public/quarantined/src/autocomplete/components/accept_endpoint_component.js
similarity index 100%
rename from src/legacy/core_plugins/console/public/src/autocomplete/components/accept_endpoint_component.js
rename to src/legacy/core_plugins/console/public/quarantined/src/autocomplete/components/accept_endpoint_component.js
diff --git a/src/legacy/core_plugins/console/public/src/autocomplete/components/autocomplete_component.js b/src/legacy/core_plugins/console/public/quarantined/src/autocomplete/components/autocomplete_component.js
similarity index 100%
rename from src/legacy/core_plugins/console/public/src/autocomplete/components/autocomplete_component.js
rename to src/legacy/core_plugins/console/public/quarantined/src/autocomplete/components/autocomplete_component.js
diff --git a/src/legacy/core_plugins/console/public/src/autocomplete/components/conditional_proxy.js b/src/legacy/core_plugins/console/public/quarantined/src/autocomplete/components/conditional_proxy.js
similarity index 100%
rename from src/legacy/core_plugins/console/public/src/autocomplete/components/conditional_proxy.js
rename to src/legacy/core_plugins/console/public/quarantined/src/autocomplete/components/conditional_proxy.js
diff --git a/src/legacy/core_plugins/console/public/src/autocomplete/components/constant_component.js b/src/legacy/core_plugins/console/public/quarantined/src/autocomplete/components/constant_component.js
similarity index 100%
rename from src/legacy/core_plugins/console/public/src/autocomplete/components/constant_component.js
rename to src/legacy/core_plugins/console/public/quarantined/src/autocomplete/components/constant_component.js
diff --git a/src/legacy/core_plugins/console/public/src/autocomplete/components/field_autocomplete_component.js b/src/legacy/core_plugins/console/public/quarantined/src/autocomplete/components/field_autocomplete_component.js
similarity index 100%
rename from src/legacy/core_plugins/console/public/src/autocomplete/components/field_autocomplete_component.js
rename to src/legacy/core_plugins/console/public/quarantined/src/autocomplete/components/field_autocomplete_component.js
diff --git a/src/legacy/core_plugins/console/public/src/autocomplete/components/global_only_component.js b/src/legacy/core_plugins/console/public/quarantined/src/autocomplete/components/global_only_component.js
similarity index 100%
rename from src/legacy/core_plugins/console/public/src/autocomplete/components/global_only_component.js
rename to src/legacy/core_plugins/console/public/quarantined/src/autocomplete/components/global_only_component.js
diff --git a/src/legacy/core_plugins/console/public/src/autocomplete/components/id_autocomplete_component.js b/src/legacy/core_plugins/console/public/quarantined/src/autocomplete/components/id_autocomplete_component.js
similarity index 100%
rename from src/legacy/core_plugins/console/public/src/autocomplete/components/id_autocomplete_component.js
rename to src/legacy/core_plugins/console/public/quarantined/src/autocomplete/components/id_autocomplete_component.js
diff --git a/src/legacy/core_plugins/console/public/src/autocomplete/components/index.js b/src/legacy/core_plugins/console/public/quarantined/src/autocomplete/components/index.js
similarity index 100%
rename from src/legacy/core_plugins/console/public/src/autocomplete/components/index.js
rename to src/legacy/core_plugins/console/public/quarantined/src/autocomplete/components/index.js
diff --git a/src/legacy/core_plugins/console/public/src/autocomplete/components/index_autocomplete_component.js b/src/legacy/core_plugins/console/public/quarantined/src/autocomplete/components/index_autocomplete_component.js
similarity index 100%
rename from src/legacy/core_plugins/console/public/src/autocomplete/components/index_autocomplete_component.js
rename to src/legacy/core_plugins/console/public/quarantined/src/autocomplete/components/index_autocomplete_component.js
diff --git a/src/legacy/core_plugins/console/public/src/autocomplete/components/list_component.js b/src/legacy/core_plugins/console/public/quarantined/src/autocomplete/components/list_component.js
similarity index 100%
rename from src/legacy/core_plugins/console/public/src/autocomplete/components/list_component.js
rename to src/legacy/core_plugins/console/public/quarantined/src/autocomplete/components/list_component.js
diff --git a/src/legacy/core_plugins/console/public/src/autocomplete/components/object_component.js b/src/legacy/core_plugins/console/public/quarantined/src/autocomplete/components/object_component.js
similarity index 100%
rename from src/legacy/core_plugins/console/public/src/autocomplete/components/object_component.js
rename to src/legacy/core_plugins/console/public/quarantined/src/autocomplete/components/object_component.js
diff --git a/src/legacy/core_plugins/console/public/src/autocomplete/components/shared_component.js b/src/legacy/core_plugins/console/public/quarantined/src/autocomplete/components/shared_component.js
similarity index 100%
rename from src/legacy/core_plugins/console/public/src/autocomplete/components/shared_component.js
rename to src/legacy/core_plugins/console/public/quarantined/src/autocomplete/components/shared_component.js
diff --git a/src/legacy/core_plugins/console/public/src/autocomplete/components/simple_param_component.js b/src/legacy/core_plugins/console/public/quarantined/src/autocomplete/components/simple_param_component.js
similarity index 100%
rename from src/legacy/core_plugins/console/public/src/autocomplete/components/simple_param_component.js
rename to src/legacy/core_plugins/console/public/quarantined/src/autocomplete/components/simple_param_component.js
diff --git a/src/legacy/core_plugins/console/public/src/autocomplete/components/template_autocomplete_component.js b/src/legacy/core_plugins/console/public/quarantined/src/autocomplete/components/template_autocomplete_component.js
similarity index 100%
rename from src/legacy/core_plugins/console/public/src/autocomplete/components/template_autocomplete_component.js
rename to src/legacy/core_plugins/console/public/quarantined/src/autocomplete/components/template_autocomplete_component.js
diff --git a/src/legacy/core_plugins/console/public/src/autocomplete/components/type_autocomplete_component.js b/src/legacy/core_plugins/console/public/quarantined/src/autocomplete/components/type_autocomplete_component.js
similarity index 100%
rename from src/legacy/core_plugins/console/public/src/autocomplete/components/type_autocomplete_component.js
rename to src/legacy/core_plugins/console/public/quarantined/src/autocomplete/components/type_autocomplete_component.js
diff --git a/src/legacy/core_plugins/console/public/src/autocomplete/components/url_pattern_matcher.js b/src/legacy/core_plugins/console/public/quarantined/src/autocomplete/components/url_pattern_matcher.js
similarity index 100%
rename from src/legacy/core_plugins/console/public/src/autocomplete/components/url_pattern_matcher.js
rename to src/legacy/core_plugins/console/public/quarantined/src/autocomplete/components/url_pattern_matcher.js
diff --git a/src/legacy/core_plugins/console/public/src/autocomplete/components/username_autocomplete_component.js b/src/legacy/core_plugins/console/public/quarantined/src/autocomplete/components/username_autocomplete_component.js
similarity index 100%
rename from src/legacy/core_plugins/console/public/src/autocomplete/components/username_autocomplete_component.js
rename to src/legacy/core_plugins/console/public/quarantined/src/autocomplete/components/username_autocomplete_component.js
diff --git a/src/legacy/core_plugins/console/public/src/autocomplete/engine.js b/src/legacy/core_plugins/console/public/quarantined/src/autocomplete/engine.js
similarity index 100%
rename from src/legacy/core_plugins/console/public/src/autocomplete/engine.js
rename to src/legacy/core_plugins/console/public/quarantined/src/autocomplete/engine.js
diff --git a/src/legacy/core_plugins/console/public/src/autocomplete/url_params.js b/src/legacy/core_plugins/console/public/quarantined/src/autocomplete/url_params.js
similarity index 100%
rename from src/legacy/core_plugins/console/public/src/autocomplete/url_params.js
rename to src/legacy/core_plugins/console/public/quarantined/src/autocomplete/url_params.js
diff --git a/src/legacy/core_plugins/console/public/src/curl.js b/src/legacy/core_plugins/console/public/quarantined/src/curl.js
similarity index 100%
rename from src/legacy/core_plugins/console/public/src/curl.js
rename to src/legacy/core_plugins/console/public/quarantined/src/curl.js
diff --git a/src/legacy/core_plugins/console/public/src/directives/_help.scss b/src/legacy/core_plugins/console/public/quarantined/src/directives/_help.scss
similarity index 100%
rename from src/legacy/core_plugins/console/public/src/directives/_help.scss
rename to src/legacy/core_plugins/console/public/quarantined/src/directives/_help.scss
diff --git a/src/legacy/core_plugins/console/public/src/directives/_history.scss b/src/legacy/core_plugins/console/public/quarantined/src/directives/_history.scss
similarity index 70%
rename from src/legacy/core_plugins/console/public/src/directives/_history.scss
rename to src/legacy/core_plugins/console/public/quarantined/src/directives/_history.scss
index 1d13d366eec08..efd72245b3c48 100644
--- a/src/legacy/core_plugins/console/public/src/directives/_history.scss
+++ b/src/legacy/core_plugins/console/public/quarantined/src/directives/_history.scss
@@ -8,27 +8,22 @@
.conHistory__body {
display: flex;
height: $euiSizeXL * 10;
+ > ul {
+ margin-bottom: 0;
+ }
}
-
-.conHistory__footer {
- display: flex;
- justify-content: space-between;
- padding-top: $euiSize;
-}
-
-.conHistory__footerButtonsRight {
- text-align: right;
+.conHistory__body__spacer {
+ flex: 0 0 1%;
}
.conHistory__reqs,
.conHistory__viewer {
- flex: 0 0 50%;
+ flex: 0 0 49.5%;
}
.conHistory__reqs {
overflow: auto;
- margin-right: $euiSizeL;
}
.conHistory__req {
diff --git a/src/legacy/core_plugins/console/public/src/directives/_index.scss b/src/legacy/core_plugins/console/public/quarantined/src/directives/_index.scss
similarity index 100%
rename from src/legacy/core_plugins/console/public/src/directives/_index.scss
rename to src/legacy/core_plugins/console/public/quarantined/src/directives/_index.scss
diff --git a/src/legacy/core_plugins/console/public/src/es.js b/src/legacy/core_plugins/console/public/quarantined/src/es.js
similarity index 100%
rename from src/legacy/core_plugins/console/public/src/es.js
rename to src/legacy/core_plugins/console/public/quarantined/src/es.js
diff --git a/src/legacy/core_plugins/console/public/src/input.js b/src/legacy/core_plugins/console/public/quarantined/src/input.js
similarity index 68%
rename from src/legacy/core_plugins/console/public/src/input.js
rename to src/legacy/core_plugins/console/public/quarantined/src/input.js
index 86c2efe3a70bd..89672a5823ad5 100644
--- a/src/legacy/core_plugins/console/public/src/input.js
+++ b/src/legacy/core_plugins/console/public/quarantined/src/input.js
@@ -17,81 +17,49 @@
* under the License.
*/
-require('brace');
-require('brace/ext/searchbox');
-import Autocomplete from './autocomplete';
+import Autocomplete from './autocomplete';
import mappings from './mappings';
const SenseEditor = require('./sense_editor/editor');
-const settings = require('./settings');
const utils = require('./utils');
const es = require('./es');
-const history = require('./history');
-import { uiModules } from 'ui/modules';
let input;
-export function initializeInput($el, $actionsEl, $copyAsCurlEl, output, openDocumentation = () => {}) {
+export function initializeInput($el, $actionsEl, history, settings) {
input = new SenseEditor($el);
- // this may not exist if running from tests
- if (uiModules) {
- const appSense = uiModules.get('app/sense');
- if (appSense && appSense.setupResizeCheckerForRootEditors) {
- appSense.setupResizeCheckerForRootEditors($el, input, output);
- }
- }
-
input.autocomplete = new Autocomplete(input);
input.$actions = $actionsEl;
- input.commands.addCommand({
- name: 'auto indent request',
- bindKey: { win: 'Ctrl-I', mac: 'Command-I' },
- exec: function () {
- input.autoIndent();
- }
- });
- input.commands.addCommand({
- name: 'move to previous request start or end',
- bindKey: { win: 'Ctrl-Up', mac: 'Command-Up' },
- exec: function () {
- input.moveToPreviousRequestEdge();
- }
- });
- input.commands.addCommand({
- name: 'move to next request start or end',
- bindKey: { win: 'Ctrl-Down', mac: 'Command-Down' },
- exec: function () {
- input.moveToNextRequestEdge();
- }
- });
-
/**
* Setup the "send" shortcut
*/
let CURRENT_REQ_ID = 0;
- function sendCurrentRequestToES(addedToHistoryCb) {
-
+ function sendCurrentRequestToES(addedToHistoryCb, output) {
const reqId = ++CURRENT_REQ_ID;
- input.getRequestsInRange(function (requests) {
+ input.getRequestsInRange(requests => {
if (reqId !== CURRENT_REQ_ID) {
return;
}
- output.update('');
+ if (output) {
+ output.update('');
+ }
if (requests.length === 0) {
return;
}
const isMultiRequest = requests.length > 1;
- const finishChain = function () { /* noop */ };
+ const finishChain = () => {
+ /* noop */
+ };
let isFirstRequest = true;
- const sendNextRequest = function () {
+ const sendNextRequest = () => {
if (reqId !== CURRENT_REQ_ID) {
return;
}
@@ -107,7 +75,7 @@ export function initializeInput($el, $actionsEl, $copyAsCurlEl, output, openDocu
esData += '\n';
} //append a new line for bulk requests.
- es.send(esMethod, esPath, esData).always(function (dataOrjqXHR, textStatus, jqXhrORerrorThrown) {
+ es.send(esMethod, esPath, esData).always((dataOrjqXHR, textStatus, jqXhrORerrorThrown) => {
if (reqId !== CURRENT_REQ_ID) {
return;
}
@@ -117,14 +85,14 @@ export function initializeInput($el, $actionsEl, $copyAsCurlEl, output, openDocu
function modeForContentType(contentType) {
if (contentType.indexOf('text/plain') >= 0) {
return 'ace/mode/text';
- }
- else if (contentType.indexOf('application/yaml') >= 0) {
+ } else if (contentType.indexOf('application/yaml') >= 0) {
return 'ace/mode/yaml';
}
return null;
}
- const isSuccess = typeof xhr.status === 'number' &&
+ const isSuccess =
+ typeof xhr.status === 'number' &&
// Things like DELETE index where the index is not there are OK.
((xhr.status >= 200 && xhr.status < 300) || xhr.status === 404);
@@ -151,8 +119,7 @@ export function initializeInput($el, $actionsEl, $copyAsCurlEl, output, openDocu
// assume json - auto pretty
try {
value = utils.expandLiteralStrings(value);
- }
- catch (e) {
+ } catch (e) {
// nothing to do here
}
}
@@ -166,12 +133,15 @@ export function initializeInput($el, $actionsEl, $copyAsCurlEl, output, openDocu
if (isMultiRequest) {
value = '# ' + req.method + ' ' + req.url + '\n' + value;
}
- if (isFirstRequest) {
- output.update(value, mode);
- }
- else {
- output.append('\n' + value);
+
+ if (output) {
+ if (isFirstRequest) {
+ output.update(value, mode);
+ } else {
+ output.append('\n' + value);
+ }
}
+
isFirstRequest = false;
// single request terminate via sendNextRequest as well
sendNextRequest();
@@ -184,8 +154,7 @@ export function initializeInput($el, $actionsEl, $copyAsCurlEl, output, openDocu
if (value[0] === '{') {
try {
value = JSON.stringify(JSON.parse(value), null, 2);
- }
- catch (e) {
+ } catch (e) {
// nothing to do here
}
}
@@ -196,11 +165,12 @@ export function initializeInput($el, $actionsEl, $copyAsCurlEl, output, openDocu
if (isMultiRequest) {
value = '# ' + req.method + ' ' + req.url + '\n' + value;
}
- if (isFirstRequest) {
- output.update(value, mode);
- }
- else {
- output.append('\n' + value);
+ if (output) {
+ if (isFirstRequest) {
+ output.update(value, mode);
+ } else {
+ output.append('\n' + value);
+ }
}
finishChain();
}
@@ -211,20 +181,6 @@ export function initializeInput($el, $actionsEl, $copyAsCurlEl, output, openDocu
});
}
-
- input.commands.addCommand({
- name: 'send to elasticsearch',
- bindKey: { win: 'Ctrl-Enter', mac: 'Command-Enter' },
- exec: () => sendCurrentRequestToES()
- });
- input.commands.addCommand({
- name: 'open documentation',
- bindKey: { win: 'Ctrl-/', mac: 'Command-/' },
- exec: () => {
- openDocumentation();
- }
- });
-
/**
* Init the editor
*/
@@ -235,7 +191,6 @@ export function initializeInput($el, $actionsEl, $copyAsCurlEl, output, openDocu
input.highlightCurrentRequestsAndUpdateActionBar();
input.sendCurrentRequestToES = sendCurrentRequestToES;
- require('./input_resize')(input, output);
return input;
}
diff --git a/src/legacy/core_plugins/console/public/src/kb.js b/src/legacy/core_plugins/console/public/quarantined/src/kb.js
similarity index 100%
rename from src/legacy/core_plugins/console/public/src/kb.js
rename to src/legacy/core_plugins/console/public/quarantined/src/kb.js
diff --git a/src/legacy/core_plugins/console/public/src/kb/api.js b/src/legacy/core_plugins/console/public/quarantined/src/kb/api.js
similarity index 100%
rename from src/legacy/core_plugins/console/public/src/kb/api.js
rename to src/legacy/core_plugins/console/public/quarantined/src/kb/api.js
diff --git a/src/legacy/core_plugins/console/public/src/mappings.js b/src/legacy/core_plugins/console/public/quarantined/src/mappings.js
similarity index 96%
rename from src/legacy/core_plugins/console/public/src/mappings.js
rename to src/legacy/core_plugins/console/public/quarantined/src/mappings.js
index 51864333ef1fe..4538b058c2d8b 100644
--- a/src/legacy/core_plugins/console/public/src/mappings.js
+++ b/src/legacy/core_plugins/console/public/quarantined/src/mappings.js
@@ -17,10 +17,11 @@
* under the License.
*/
+import { legacyBackDoorToSettings } from '../../../np_ready/public/application';
+
const $ = require('jquery');
const _ = require('lodash');
const es = require('./es');
-const settings = require('./settings');
// NOTE: If this value ever changes to be a few seconds or less, it might introduce flakiness
// due to timing issues in our app.js tests.
@@ -257,7 +258,7 @@ function clear() {
}
function retrieveSettings(settingsKey, settingsToRetrieve) {
- const currentSettings = settings.getAutocomplete();
+ const currentSettings = legacyBackDoorToSettings().getAutocomplete();
const settingKeyToPathMap = {
fields: '_mapping',
indices: '_aliases',
@@ -289,7 +290,7 @@ function retrieveSettings(settingsKey, settingsToRetrieve) {
// unchanged alone (both selected and unselected).
// 3. Poll: Use saved. Fetch selected. Ignore unselected.
-function retrieveAutoCompleteInfo(settingsToRetrieve = settings.getAutocomplete()) {
+function retrieveAutoCompleteInfo(settingsToRetrieve = legacyBackDoorToSettings().getAutocomplete()) {
if (pollTimeoutId) {
clearTimeout(pollTimeoutId);
}
@@ -329,7 +330,7 @@ function retrieveAutoCompleteInfo(settingsToRetrieve = settings.getAutocomplete(
pollTimeoutId = setTimeout(() => {
// This looks strange/inefficient, but it ensures correct behavior because we don't want to send
// a scheduled request if the user turns off polling.
- if (settings.getPolling()) {
+ if (legacyBackDoorToSettings().getPolling()) {
retrieveAutoCompleteInfo();
}
}, POLL_INTERVAL);
diff --git a/src/legacy/core_plugins/console/public/src/output.js b/src/legacy/core_plugins/console/public/quarantined/src/output.js
similarity index 88%
rename from src/legacy/core_plugins/console/public/src/output.js
rename to src/legacy/core_plugins/console/public/quarantined/src/output.js
index 1c2781e13333e..d5ffe736e2dbe 100644
--- a/src/legacy/core_plugins/console/public/src/output.js
+++ b/src/legacy/core_plugins/console/public/quarantined/src/output.js
@@ -19,19 +19,18 @@
import _ from 'lodash';
const ace = require('brace');
-const settings = require('./settings');
const OutputMode = require('./sense_editor/mode/output');
const smartResize = require('./smart_resize');
let output;
-export function initializeOutput($el) {
+export function initializeOutput($el, settings) {
output = ace.acequire('ace/ace').edit($el[0]);
const outputMode = new OutputMode.Mode();
output.$blockScrolling = Infinity;
output.resize = smartResize(output);
- output.update = function (val, mode, cb) {
+ output.update = (val, mode, cb) => {
if (typeof mode === 'function') {
cb = mode;
mode = void 0;
@@ -39,14 +38,14 @@ export function initializeOutput($el) {
const session = output.getSession();
- session.setMode(val ? (mode || outputMode) : 'ace/mode/text');
+ session.setMode(val ? mode || outputMode : 'ace/mode/text');
session.setValue(val);
if (typeof cb === 'function') {
setTimeout(cb);
}
};
- output.append = function (val, foldPrevious, cb) {
+ output.append = (val, foldPrevious, cb) => {
if (typeof foldPrevious === 'function') {
cb = foldPrevious;
foldPrevious = true;
@@ -68,12 +67,13 @@ export function initializeOutput($el) {
output.$el = $el;
- (function (session) {
+ // eslint-disable-next-line
+ (function setupSession(session) {
session.setMode('ace/mode/text');
session.setFoldStyle('markbeginend');
session.setTabSize(2);
session.setUseWrapMode(true);
- }(output.getSession()));
+ })(output.getSession());
output.setShowPrintMargin(false);
output.setReadOnly(true);
diff --git a/src/legacy/core_plugins/console/public/src/sense_editor/editor.js b/src/legacy/core_plugins/console/public/quarantined/src/sense_editor/editor.js
similarity index 100%
rename from src/legacy/core_plugins/console/public/src/sense_editor/editor.js
rename to src/legacy/core_plugins/console/public/quarantined/src/sense_editor/editor.js
diff --git a/src/legacy/core_plugins/console/public/src/sense_editor/mode/input.js b/src/legacy/core_plugins/console/public/quarantined/src/sense_editor/mode/input.js
similarity index 100%
rename from src/legacy/core_plugins/console/public/src/sense_editor/mode/input.js
rename to src/legacy/core_plugins/console/public/quarantined/src/sense_editor/mode/input.js
diff --git a/src/legacy/core_plugins/console/public/src/sense_editor/mode/input_highlight_rules.js b/src/legacy/core_plugins/console/public/quarantined/src/sense_editor/mode/input_highlight_rules.js
similarity index 100%
rename from src/legacy/core_plugins/console/public/src/sense_editor/mode/input_highlight_rules.js
rename to src/legacy/core_plugins/console/public/quarantined/src/sense_editor/mode/input_highlight_rules.js
diff --git a/src/legacy/core_plugins/console/public/src/sense_editor/mode/output.js b/src/legacy/core_plugins/console/public/quarantined/src/sense_editor/mode/output.js
similarity index 98%
rename from src/legacy/core_plugins/console/public/src/sense_editor/mode/output.js
rename to src/legacy/core_plugins/console/public/quarantined/src/sense_editor/mode/output.js
index e9964fa759726..e2598f2a73d77 100644
--- a/src/legacy/core_plugins/console/public/src/sense_editor/mode/output.js
+++ b/src/legacy/core_plugins/console/public/quarantined/src/sense_editor/mode/output.js
@@ -17,7 +17,7 @@
* under the License.
*/
-const ace = require('brace');
+import ace from 'brace';
require('./output_highlight_rules');
diff --git a/src/legacy/core_plugins/console/public/src/sense_editor/mode/output_highlight_rules.js b/src/legacy/core_plugins/console/public/quarantined/src/sense_editor/mode/output_highlight_rules.js
similarity index 100%
rename from src/legacy/core_plugins/console/public/src/sense_editor/mode/output_highlight_rules.js
rename to src/legacy/core_plugins/console/public/quarantined/src/sense_editor/mode/output_highlight_rules.js
diff --git a/src/legacy/core_plugins/console/public/src/sense_editor/mode/script.js b/src/legacy/core_plugins/console/public/quarantined/src/sense_editor/mode/script.js
similarity index 100%
rename from src/legacy/core_plugins/console/public/src/sense_editor/mode/script.js
rename to src/legacy/core_plugins/console/public/quarantined/src/sense_editor/mode/script.js
diff --git a/src/legacy/core_plugins/console/public/src/sense_editor/mode/script_highlight_rules.js b/src/legacy/core_plugins/console/public/quarantined/src/sense_editor/mode/script_highlight_rules.js
similarity index 100%
rename from src/legacy/core_plugins/console/public/src/sense_editor/mode/script_highlight_rules.js
rename to src/legacy/core_plugins/console/public/quarantined/src/sense_editor/mode/script_highlight_rules.js
diff --git a/src/legacy/core_plugins/console/public/src/sense_editor/mode/worker/index.js b/src/legacy/core_plugins/console/public/quarantined/src/sense_editor/mode/worker/index.js
similarity index 100%
rename from src/legacy/core_plugins/console/public/src/sense_editor/mode/worker/index.js
rename to src/legacy/core_plugins/console/public/quarantined/src/sense_editor/mode/worker/index.js
diff --git a/src/legacy/core_plugins/console/public/src/sense_editor/mode/worker/worker.js b/src/legacy/core_plugins/console/public/quarantined/src/sense_editor/mode/worker/worker.js
similarity index 100%
rename from src/legacy/core_plugins/console/public/src/sense_editor/mode/worker/worker.js
rename to src/legacy/core_plugins/console/public/quarantined/src/sense_editor/mode/worker/worker.js
diff --git a/src/legacy/core_plugins/console/public/src/sense_editor/mode/x_json_highlight_rules.js b/src/legacy/core_plugins/console/public/quarantined/src/sense_editor/mode/x_json_highlight_rules.js
similarity index 100%
rename from src/legacy/core_plugins/console/public/src/sense_editor/mode/x_json_highlight_rules.js
rename to src/legacy/core_plugins/console/public/quarantined/src/sense_editor/mode/x_json_highlight_rules.js
diff --git a/src/legacy/core_plugins/console/public/src/sense_editor/row_parser.js b/src/legacy/core_plugins/console/public/quarantined/src/sense_editor/row_parser.js
similarity index 100%
rename from src/legacy/core_plugins/console/public/src/sense_editor/row_parser.js
rename to src/legacy/core_plugins/console/public/quarantined/src/sense_editor/row_parser.js
diff --git a/src/legacy/core_plugins/console/public/src/sense_editor/theme-sense-dark.js b/src/legacy/core_plugins/console/public/quarantined/src/sense_editor/theme_sense_dark.js
similarity index 100%
rename from src/legacy/core_plugins/console/public/src/sense_editor/theme-sense-dark.js
rename to src/legacy/core_plugins/console/public/quarantined/src/sense_editor/theme_sense_dark.js
diff --git a/src/legacy/core_plugins/console/public/src/smart_resize.js b/src/legacy/core_plugins/console/public/quarantined/src/smart_resize.js
similarity index 100%
rename from src/legacy/core_plugins/console/public/src/smart_resize.js
rename to src/legacy/core_plugins/console/public/quarantined/src/smart_resize.js
index 2cae2d7f17615..8ac5eda345c23 100644
--- a/src/legacy/core_plugins/console/public/src/smart_resize.js
+++ b/src/legacy/core_plugins/console/public/quarantined/src/smart_resize.js
@@ -21,8 +21,8 @@ import { get, throttle } from 'lodash';
export default function (editor) {
const resize = editor.resize;
- const throttledResize = throttle(() => {
+ const throttledResize = throttle(() => {
resize.call(editor);
// Keep current top line in view when resizing to avoid losing user context
diff --git a/src/legacy/core_plugins/console/public/src/utils.js b/src/legacy/core_plugins/console/public/quarantined/src/utils.js
similarity index 100%
rename from src/legacy/core_plugins/console/public/src/utils.js
rename to src/legacy/core_plugins/console/public/quarantined/src/utils.js
diff --git a/src/legacy/core_plugins/console/public/tests/src/content_type.test.js b/src/legacy/core_plugins/console/public/quarantined/tests/src/content_type.test.js
similarity index 100%
rename from src/legacy/core_plugins/console/public/tests/src/content_type.test.js
rename to src/legacy/core_plugins/console/public/quarantined/tests/src/content_type.test.js
diff --git a/src/legacy/core_plugins/console/public/tests/src/curl_parsing.test.js b/src/legacy/core_plugins/console/public/quarantined/tests/src/curl_parsing.test.js
similarity index 100%
rename from src/legacy/core_plugins/console/public/tests/src/curl_parsing.test.js
rename to src/legacy/core_plugins/console/public/quarantined/tests/src/curl_parsing.test.js
diff --git a/src/legacy/core_plugins/console/public/tests/src/curl_parsing.txt b/src/legacy/core_plugins/console/public/quarantined/tests/src/curl_parsing.txt
similarity index 100%
rename from src/legacy/core_plugins/console/public/tests/src/curl_parsing.txt
rename to src/legacy/core_plugins/console/public/quarantined/tests/src/curl_parsing.txt
diff --git a/src/legacy/core_plugins/console/public/tests/src/editor.test.js b/src/legacy/core_plugins/console/public/quarantined/tests/src/editor.test.js
similarity index 99%
rename from src/legacy/core_plugins/console/public/tests/src/editor.test.js
rename to src/legacy/core_plugins/console/public/quarantined/tests/src/editor.test.js
index ef1b1fb2dd65c..a356f8ff29cdc 100644
--- a/src/legacy/core_plugins/console/public/tests/src/editor.test.js
+++ b/src/legacy/core_plugins/console/public/quarantined/tests/src/editor.test.js
@@ -45,7 +45,8 @@ describe('Editor', () => {
input = initializeInput(
$('#ConAppEditor'),
$('#ConAppEditorActions'),
- $('#ConCopyAsCurl'),
+ {},
+ { applyCurrentSettings: () => {} },
null
);
input.$el.show();
diff --git a/src/legacy/core_plugins/console/public/tests/src/editor_input1.txt b/src/legacy/core_plugins/console/public/quarantined/tests/src/editor_input1.txt
similarity index 100%
rename from src/legacy/core_plugins/console/public/tests/src/editor_input1.txt
rename to src/legacy/core_plugins/console/public/quarantined/tests/src/editor_input1.txt
diff --git a/src/legacy/core_plugins/console/public/tests/src/input_tokenization.test.js b/src/legacy/core_plugins/console/public/quarantined/tests/src/input_tokenization.test.js
similarity index 97%
rename from src/legacy/core_plugins/console/public/tests/src/input_tokenization.test.js
rename to src/legacy/core_plugins/console/public/quarantined/tests/src/input_tokenization.test.js
index 3c249a0c86bc5..7267956f57280 100644
--- a/src/legacy/core_plugins/console/public/tests/src/input_tokenization.test.js
+++ b/src/legacy/core_plugins/console/public/quarantined/tests/src/input_tokenization.test.js
@@ -39,10 +39,18 @@ describe('Input Tokenization', () => {
input = initializeInput(
$('#ConAppEditor'),
$('#ConAppEditorActions'),
- $('#ConCopyAsCurl'),
+ {},
+ { applyCurrentSettings: () => {} },
+ null
+ );
+
+ input = initializeInput(
+ $('#ConAppEditor'),
+ $('#ConAppEditorActions'),
+ {},
+ { applyCurrentSettings: () => {} },
null
);
- input = initializeInput($('#ConAppEditor'), $('#ConAppEditorActions'), $('#ConCopyAsCurl'), null);
input.$el.show();
input.autocomplete._test.removeChangeListener();
});
diff --git a/src/legacy/core_plugins/console/public/tests/src/integration.test.js b/src/legacy/core_plugins/console/public/quarantined/tests/src/integration.test.js
similarity index 99%
rename from src/legacy/core_plugins/console/public/tests/src/integration.test.js
rename to src/legacy/core_plugins/console/public/quarantined/tests/src/integration.test.js
index 0164f291594f3..5bd8fd4a5b4f5 100644
--- a/src/legacy/core_plugins/console/public/tests/src/integration.test.js
+++ b/src/legacy/core_plugins/console/public/quarantined/tests/src/integration.test.js
@@ -38,8 +38,9 @@ describe('Integration', () => {
input = initializeInput(
$('#ConAppEditor'),
$('#ConAppEditorActions'),
- $('#ConCopyAsCurl'),
- null
+ {},
+ { applyCurrentSettings: () => {} },
+ null,
);
input.$el.show();
input.autocomplete._test.removeChangeListener();
diff --git a/src/legacy/core_plugins/console/public/tests/src/kb.test.js b/src/legacy/core_plugins/console/public/quarantined/tests/src/kb.test.js
similarity index 100%
rename from src/legacy/core_plugins/console/public/tests/src/kb.test.js
rename to src/legacy/core_plugins/console/public/quarantined/tests/src/kb.test.js
diff --git a/src/legacy/core_plugins/console/public/tests/src/mapping.test.js b/src/legacy/core_plugins/console/public/quarantined/tests/src/mapping.test.js
similarity index 100%
rename from src/legacy/core_plugins/console/public/tests/src/mapping.test.js
rename to src/legacy/core_plugins/console/public/quarantined/tests/src/mapping.test.js
diff --git a/src/legacy/core_plugins/console/public/tests/src/output_tokenization.test.js b/src/legacy/core_plugins/console/public/quarantined/tests/src/output_tokenization.test.js
similarity index 100%
rename from src/legacy/core_plugins/console/public/tests/src/output_tokenization.test.js
rename to src/legacy/core_plugins/console/public/quarantined/tests/src/output_tokenization.test.js
diff --git a/src/legacy/core_plugins/console/public/tests/src/setup_mocks.js b/src/legacy/core_plugins/console/public/quarantined/tests/src/setup_mocks.js
similarity index 59%
rename from src/legacy/core_plugins/console/public/tests/src/setup_mocks.js
rename to src/legacy/core_plugins/console/public/quarantined/tests/src/setup_mocks.js
index 0bcf75e29f5f3..e0a4a04638178 100644
--- a/src/legacy/core_plugins/console/public/tests/src/setup_mocks.js
+++ b/src/legacy/core_plugins/console/public/quarantined/tests/src/setup_mocks.js
@@ -17,16 +17,33 @@
* under the License.
*/
/* eslint no-undef: 0 */
-jest.mock('../../src/sense_editor/mode/worker', () => { return { workerModule: { id: 'sense_editor/mode/worker', src: '' } }; });
-window.Worker = function () { this.postMessage = () => {}; this.terminate = () => {}; };
+jest.mock('../../src/sense_editor/mode/worker', () => {
+ return { workerModule: { id: 'sense_editor/mode/worker', src: '' } };
+});
+window.Worker = function () {
+ this.postMessage = () => {};
+ this.terminate = () => {};
+};
window.URL = {
- createObjectURL: () => { return ''; }
+ createObjectURL: () => {
+ return '';
+ },
};
-jest.mock('../../src/storage');
+
+import 'brace';
+import 'brace/ext/language_tools';
+import 'brace/ext/searchbox';
+import 'brace/mode/json';
+import 'brace/mode/text';
+
+jest.mock('../../../../np_ready/public/application', () => ({ legacyBackDoorToSettings: () => {}, }));
document.queryCommandSupported = () => true;
import jQuery from 'jquery';
-jest.spyOn(jQuery, 'ajax').mockImplementation(() => new Promise(() => {
- // never resolve
-}));
+jest.spyOn(jQuery, 'ajax').mockImplementation(
+ () =>
+ new Promise(() => {
+ // never resolve
+ })
+);
diff --git a/src/legacy/core_plugins/console/public/tests/src/url_autocomplete.test.js b/src/legacy/core_plugins/console/public/quarantined/tests/src/url_autocomplete.test.js
similarity index 100%
rename from src/legacy/core_plugins/console/public/tests/src/url_autocomplete.test.js
rename to src/legacy/core_plugins/console/public/quarantined/tests/src/url_autocomplete.test.js
diff --git a/src/legacy/core_plugins/console/public/tests/src/url_params.test.js b/src/legacy/core_plugins/console/public/quarantined/tests/src/url_params.test.js
similarity index 100%
rename from src/legacy/core_plugins/console/public/tests/src/url_params.test.js
rename to src/legacy/core_plugins/console/public/quarantined/tests/src/url_params.test.js
diff --git a/src/legacy/core_plugins/console/public/tests/src/utils.test.js b/src/legacy/core_plugins/console/public/quarantined/tests/src/utils.test.js
similarity index 100%
rename from src/legacy/core_plugins/console/public/tests/src/utils.test.js
rename to src/legacy/core_plugins/console/public/quarantined/tests/src/utils.test.js
diff --git a/src/legacy/core_plugins/console/public/tests/src/utils_string_collapsing.txt b/src/legacy/core_plugins/console/public/quarantined/tests/src/utils_string_collapsing.txt
similarity index 100%
rename from src/legacy/core_plugins/console/public/tests/src/utils_string_collapsing.txt
rename to src/legacy/core_plugins/console/public/quarantined/tests/src/utils_string_collapsing.txt
diff --git a/src/legacy/core_plugins/console/public/tests/src/utils_string_expanding.txt b/src/legacy/core_plugins/console/public/quarantined/tests/src/utils_string_expanding.txt
similarity index 100%
rename from src/legacy/core_plugins/console/public/tests/src/utils_string_expanding.txt
rename to src/legacy/core_plugins/console/public/quarantined/tests/src/utils_string_expanding.txt
diff --git a/src/legacy/core_plugins/console/public/src/controllers/sense_controller.js b/src/legacy/core_plugins/console/public/src/controllers/sense_controller.js
deleted file mode 100644
index 2011f23d11cc6..0000000000000
--- a/src/legacy/core_plugins/console/public/src/controllers/sense_controller.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 { docTitle } from 'ui/doc_title';
-
-import { applyResizeCheckerToEditors } from '../sense_editor_resize';
-import $ from 'jquery';
-import { initializeInput } from '../input';
-import { initializeOutput } from '../output';
-import init from '../app';
-import { getEndpointFromPosition } from '../autocomplete';
-import { DOC_LINK_VERSION } from 'ui/documentation_links';
-
-// welcome message
-import { showWelcomePanel } from '../helpers/welcome_show_panel';
-import storage from '../storage';
-
-import { getTopNavConfig } from '../helpers/get_top_nav';
-
-const module = require('ui/modules').get('app/sense');
-
-module.run(function ($rootScope) {
- module.setupResizeCheckerForRootEditors = ($el, ...editors) => {
- return applyResizeCheckerToEditors($rootScope, $el, ...editors);
- };
-});
-
-function showWelcomeMessageIfNeeded($scope) {
- if (storage.get('version_welcome_shown') !== '@@SENSE_REVISION') {
- const hideWelcomePanel = showWelcomePanel();
- $scope.$on('$destroy', () => {
- hideWelcomePanel();
- });
- }
-}
-
-module.controller('SenseController', function SenseController($scope, $timeout, $location, kbnUiAceKeyboardModeService) {
- docTitle.change('Console');
-
- showWelcomeMessageIfNeeded($scope);
-
- // Since we pass this callback via reactDirective into a react component, which has the function defined as required
- // in it's prop types, we should set this initially (before it's set in the $timeout below). Without this line
- // the component we pass this in will throw an propType validation error.
- $scope.getRequestsAsCURL = () => '';
-
- // We need to wait for these elements to be rendered before we can select them with jQuery
- // and then initialize this app
- let input;
- let output;
- $timeout(async () => {
- output = initializeOutput($('#ConAppOutput'));
- input = initializeInput($('#ConAppEditor'), $('#ConAppEditorActions'), $('#ConCopyAsCurl'), output, $scope.openDocumentation);
- init(input, output, $location.search().load_from);
- kbnUiAceKeyboardModeService.initialize($scope, $('#ConAppEditor'));
- const session = input.getSession();
- session.getSelection().on('changeCursor', () => {
- $scope.getDocumentation();
- });
- $scope.getDocumentation();
-
- // expose method for React Consumption
- $scope.getRequestsAsCURL = input.getRequestsAsCURL;
- });
- $scope.getDocumentation = () => {
- input.getRequestsInRange(function (requests) {
- if (!requests || requests.length === 0) {
- $scope.documentation = null;
- $scope.$apply();
- return;
- }
- const position = requests[0].range.end;
- position.column = position.column - 1;
- const endpoint = getEndpointFromPosition(input, position);
- if (endpoint
- && endpoint.documentation
- && endpoint.documentation.indexOf('http') !== -1) {
- $scope.documentation = endpoint.documentation.replace('/master/', `/${DOC_LINK_VERSION}/`);
- $scope.documentation = $scope.documentation.replace('/current/', `/${DOC_LINK_VERSION}/`);
- $scope.$apply();
- } else {
- $scope.documentation = null;
- $scope.$apply();
- }
- });
- };
-
- $scope.showHistory = false;
- $scope.historyDirty = undefined;
- $scope.toggleHistory = () => {
- $scope.showHistory = !$scope.showHistory;
- };
-
- $scope.closeHistory = () => {
- $scope.showHistory = false;
- };
-
- $scope.topNavMenu = getTopNavConfig($scope, $scope.toggleHistory);
-
- $scope.openDocumentation = () => {
- if (!$scope.documentation) {
- return;
- }
- window.open($scope.documentation, '_blank');
- };
-
- $scope.sendSelected = () => {
- input.focus();
- input.sendCurrentRequestToES(() => {
- // History watches this value and will re-render itself when it changes, so that
- // the list of requests stays up-to-date as new requests are sent.
- $scope.lastRequestTimestamp = new Date().getTime();
- });
- return false;
- };
-
- $scope.autoIndent = (event) => {
- input.autoIndent();
- event.preventDefault();
- input.focus();
- };
-});
diff --git a/src/legacy/core_plugins/console/public/src/directives/history.html b/src/legacy/core_plugins/console/public/src/directives/history.html
deleted file mode 100644
index 4c3adebb54ea9..0000000000000
--- a/src/legacy/core_plugins/console/public/src/directives/history.html
+++ /dev/null
@@ -1,64 +0,0 @@
-
-
-
-
-
-
- {{ history.describeReq(req) }}
-
-
-
-
-
-
-
-
-
diff --git a/src/legacy/core_plugins/console/public/src/directives/sense_history.js b/src/legacy/core_plugins/console/public/src/directives/sense_history.js
deleted file mode 100644
index 29ad60a84e740..0000000000000
--- a/src/legacy/core_plugins/console/public/src/directives/sense_history.js
+++ /dev/null
@@ -1,105 +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 { keyCodes } from '@elastic/eui';
-import template from './history.html';
-
-const { memoize } = require('lodash');
-const moment = require('moment');
-
-const history = require('../history');
-require('./sense_history_viewer');
-
-require('ui/modules')
- .get('app/sense')
- .directive('senseHistory', function () {
- return {
- restrict: 'E',
- template,
- controllerAs: 'history',
- scope: {
- isShown: '=',
- historyDirty: '=',
- close: '&',
- },
- controller: function ($scope, $element) {
- $scope.$watch('historyDirty', () => {
- this.init();
- });
-
- $scope.$watch('isShown', () => {
- if ($scope.isShown) this.init();
- });
-
- this.init = () => {
- this.reqs = history.getHistory();
- this.selectedIndex = 0;
- this.selectedReq = this.reqs[this.selectedIndex];
- this.viewingReq = this.selectedReq;
-
- // calculate the text description of a request
- this.describeReq = memoize((req) => {
- const endpoint = req.endpoint;
- const date = moment(req.time);
-
- let formattedDate = date.format('MMM D');
- if (date.diff(moment(), 'days') > -7) {
- formattedDate = date.fromNow();
- }
-
- return `${endpoint} (${formattedDate})`;
- });
- this.describeReq.cache = new WeakMap();
- };
-
- // main actions
- this.clear = () => {
- history.clearHistory($element);
- this.init();
- };
-
- this.close = () => {
- $scope.close();
- };
-
- this.restore = (req = this.selectedReq) => {
- history.restoreFromHistory(req);
- };
-
- this.onKeyDown = (ev) => {
- if (ev.keyCode === keyCodes.ENTER) {
- this.restore();
- return;
- }
-
- if (ev.keyCode === keyCodes.UP) {
- ev.preventDefault();
- this.selectedIndex--;
- } else if (ev.keyCode === keyCodes.DOWN) {
- ev.preventDefault();
- this.selectedIndex++;
- }
-
- this.selectedIndex = Math.min(Math.max(0, this.selectedIndex), this.reqs.length - 1);
- this.selectedReq = this.reqs[this.selectedIndex];
- this.viewingReq = this.reqs[this.selectedIndex];
- };
- }
- };
- });
diff --git a/src/legacy/core_plugins/console/public/src/directives/sense_history_viewer.js b/src/legacy/core_plugins/console/public/src/directives/sense_history_viewer.js
deleted file mode 100644
index e066605a2ca83..0000000000000
--- a/src/legacy/core_plugins/console/public/src/directives/sense_history_viewer.js
+++ /dev/null
@@ -1,58 +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.
- */
-
-const SenseEditor = require('../sense_editor/editor');
-
-import { i18n } from '@kbn/i18n';
-
-import { applyResizeCheckerToEditors } from '../sense_editor_resize';
-
-require('ui/modules')
- .get('app/sense')
- .directive('senseHistoryViewer', function () {
- return {
- restrict: 'E',
- scope: {
- req: '=',
- },
- link: function ($scope, $el) {
- const viewer = new SenseEditor($el);
- viewer.setReadOnly(true);
- viewer.renderer.setShowPrintMargin(false);
- applyResizeCheckerToEditors($scope, $el, viewer);
- require('../settings').applyCurrentSettings(viewer);
-
- $scope.$watch('req', function (req) {
- if (req) {
- const s = req.method + ' ' + req.endpoint + '\n' + (req.data || '');
- viewer.setValue(s);
- viewer.clearSelection();
- } else {
- viewer.getSession().setValue(
- i18n.translate('console.historyPage.noHistoryTextMessage', { defaultMessage: 'No history available' })
- );
- }
- });
-
- $scope.$on('$destroy', function () {
- viewer.destroy();
- });
- }
- };
- });
diff --git a/src/legacy/core_plugins/console/public/src/helpers/settings_show_modal.tsx b/src/legacy/core_plugins/console/public/src/helpers/settings_show_modal.tsx
deleted file mode 100644
index c4f36d836dfda..0000000000000
--- a/src/legacy/core_plugins/console/public/src/helpers/settings_show_modal.tsx
+++ /dev/null
@@ -1,103 +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 { I18nContext } from 'ui/i18n';
-import React from 'react';
-import ReactDOM from 'react-dom';
-import { DevToolsSettingsModal, AutocompleteOptions } from '../components/settings_modal';
-import { DevToolsSettings } from '../components/dev_tools_settings';
-
-// @ts-ignore
-import mappings from '../mappings';
-// @ts-ignore
-import { getCurrentSettings, updateSettings } from '../settings';
-
-export function showSettingsModal() {
- const container = document.getElementById('consoleSettingsModal');
- const curSettings = getCurrentSettings();
-
- const refreshAutocompleteSettings = (selectedSettings: any) => {
- mappings.retrieveAutoCompleteInfo(selectedSettings);
- };
-
- const closeModal = () => {
- if (!container) return;
- ReactDOM.unmountComponentAtNode(container);
- container.innerHTML = '';
- };
-
- const getAutocompleteDiff = (newSettings: DevToolsSettings, prevSettings: DevToolsSettings) => {
- return Object.keys(newSettings.autocomplete).filter(key => {
- // @ts-ignore
- return prevSettings.autocomplete[key] !== newSettings.autocomplete[key];
- });
- };
-
- const fetchAutocompleteSettingsIfNeeded = (
- newSettings: DevToolsSettings,
- prevSettings: DevToolsSettings
- ) => {
- // We'll only retrieve settings if polling is on. The expectation here is that if the user
- // disables polling it's because they want manual control over the fetch request (possibly
- // because it's a very expensive request given their cluster and bandwidth). In that case,
- // they would be unhappy with any request that's sent automatically.
- if (newSettings.polling) {
- const autocompleteDiff = getAutocompleteDiff(newSettings, prevSettings);
-
- const isSettingsChanged = autocompleteDiff.length > 0;
- const isPollingChanged = prevSettings.polling !== newSettings.polling;
-
- if (isSettingsChanged) {
- // If the user has changed one of the autocomplete settings, then we'll fetch just the
- // ones which have changed.
- const changedSettings: any = autocompleteDiff.reduce(
- (changedSettingsAccum: any, setting: string): any => {
- changedSettingsAccum[setting] =
- newSettings.autocomplete[setting as AutocompleteOptions];
- return changedSettingsAccum;
- },
- {}
- );
- mappings.retrieveAutoCompleteInfo(changedSettings);
- } else if (isPollingChanged) {
- // If the user has turned polling on, then we'll fetch all selected autocomplete settings.
- mappings.retrieveAutoCompleteInfo();
- }
- }
- };
-
- const onSave = async (newSettings: DevToolsSettings) => {
- const prevSettings = getCurrentSettings();
- updateSettings(newSettings);
- fetchAutocompleteSettingsIfNeeded(newSettings, prevSettings);
- closeModal();
- };
-
- const element = (
-
-
-
- );
- ReactDOM.render(element, container);
-}
diff --git a/src/legacy/core_plugins/console/public/src/helpers/welcome_show_panel.tsx b/src/legacy/core_plugins/console/public/src/helpers/welcome_show_panel.tsx
deleted file mode 100644
index 60a66babef6e6..0000000000000
--- a/src/legacy/core_plugins/console/public/src/helpers/welcome_show_panel.tsx
+++ /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 React from 'react';
-import ReactDOM from 'react-dom';
-import { I18nContext } from 'ui/i18n';
-import { WelcomePanel } from '../components/welcome_panel';
-// @ts-ignore
-import storage from '../storage';
-
-let isOpen = false;
-
-export function showWelcomePanel(): () => void {
- const onClose = () => {
- if (!container) return;
- ReactDOM.unmountComponentAtNode(container);
- isOpen = false;
- };
-
- const onDismiss = () => {
- storage.set('version_welcome_shown', '@@SENSE_REVISION');
- onClose();
- };
-
- const container = document.getElementById('consoleWelcomePanel');
- if (container && !isOpen) {
- isOpen = true;
- const element = (
-
-
-
- );
- ReactDOM.render(element, container);
- }
-
- return onClose;
-}
diff --git a/src/legacy/core_plugins/console/public/src/history.js b/src/legacy/core_plugins/console/public/src/history.js
deleted file mode 100644
index 14d6ef5fcff04..0000000000000
--- a/src/legacy/core_plugins/console/public/src/history.js
+++ /dev/null
@@ -1,83 +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.
- */
-
-const $ = require('jquery');
-const storage = require('./storage');
-
-const history = {
- restoreFromHistory() {
- // default method for history.restoreFromHistory
- // replace externally to do something when the user chooses
- // to relive a bit of history
- throw new Error('not implemented');
- },
-
- getHistoryKeys() {
- return storage.keys()
- .filter(key => key.indexOf('hist_elem') === 0)
- .sort()
- .reverse();
- },
-
- getHistory() {
- return history
- .getHistoryKeys()
- .map(key => storage.get(key));
- },
-
- addToHistory(endpoint, method, data) {
- const keys = history.getHistoryKeys();
- keys.splice(0, 500); // only maintain most recent X;
- $.each(keys, function (i, k) {
- storage.delete(k);
- });
-
- const timestamp = new Date().getTime();
- const k = 'hist_elem_' + timestamp;
- storage.set(k, {
- time: timestamp,
- endpoint: endpoint,
- method: method,
- data: data
- });
- },
-
- updateCurrentState(content) {
- const timestamp = new Date().getTime();
- storage.set('editor_state', {
- time: timestamp,
- content: content
- });
- },
-
- getSavedEditorState() {
- const saved = storage.get('editor_state');
- if (!saved) return;
- const { time, content } = saved;
- return { time, content };
- },
-
- clearHistory() {
- history
- .getHistoryKeys()
- .forEach(key => storage.delete(key));
- }
-};
-
-export default history;
diff --git a/src/legacy/core_plugins/console/public/src/input_resize.js b/src/legacy/core_plugins/console/public/src/input_resize.js
deleted file mode 100644
index 1afc952f699f4..0000000000000
--- a/src/legacy/core_plugins/console/public/src/input_resize.js
+++ /dev/null
@@ -1,68 +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.
- */
-
-const $ = require('jquery');
-const storage = require('./storage');
-
-export default function (input, output) {
-
- const $left = input.$el.parent();
-
- function readStoredEditorWidth() {
- return storage.get('editorWidth');
- }
-
- function storeEditorWidth(editorWidth) {
- storage.set('editorWidth', editorWidth);
- }
-
- function setEditorWidth(editorWidth) {
- storeEditorWidth(editorWidth);
- $left.width(editorWidth);
- }
-
- const $resizer = $('#ConAppResizer');
- $resizer
- .on('mousedown', function (event) {
- $resizer.addClass('active');
- const startWidth = $left.width();
- const startX = event.pageX;
- input.resize.topRow = input.renderer.layerConfig.firstRow;
- output.resize.topRow = output.renderer.layerConfig.firstRow;
-
- function onMove(event) {
- setEditorWidth(startWidth + event.pageX - startX);
- }
-
- $(document.body)
- .on('mousemove', onMove)
- .one('mouseup', function () {
- $resizer.removeClass('active');
- $(this).off('mousemove', onMove);
- input.resize();
- output.resize();
- });
- });
-
- const initialEditorWidth = readStoredEditorWidth();
- if (initialEditorWidth != null) {
- setEditorWidth(initialEditorWidth);
- }
-
-}
diff --git a/src/legacy/core_plugins/console/public/src/settings.js b/src/legacy/core_plugins/console/public/src/settings.js
deleted file mode 100644
index 23e89d00563a3..0000000000000
--- a/src/legacy/core_plugins/console/public/src/settings.js
+++ /dev/null
@@ -1,102 +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.
- */
-
-const storage = require('./storage');
-
-import getInput from './input';
-import getOutput from './output';
-
-function getFontSize() {
- return storage.get('font_size', 14);
-}
-
-function setFontSize(size) {
- storage.set('font_size', size);
- applyCurrentSettings();
- return true;
-}
-
-function getWrapMode() {
- return storage.get('wrap_mode', true);
-}
-
-function setWrapMode(mode) {
- storage.set('wrap_mode', mode);
- applyCurrentSettings();
- return true;
-}
-
-function setTripleQuotes(tripleQuotes) {
- storage.set('triple_quotes', tripleQuotes);
- return true;
-}
-
-export function getTripleQuotes() {
- return storage.get('triple_quotes', true);
-}
-
-export function getAutocomplete() {
- return storage.get('autocomplete_settings', { fields: true, indices: true, templates: true });
-}
-
-function setAutocomplete(settings) {
- storage.set('autocomplete_settings', settings);
- return true;
-}
-
-export function getPolling() {
- return storage.get('console_polling', true);
-}
-
-function setPolling(polling) {
- storage.set('console_polling', polling);
- applyCurrentSettings();
- return true;
-}
-
-export function applyCurrentSettings(editor) {
- if (typeof editor === 'undefined') {
- applyCurrentSettings(getInput());
- applyCurrentSettings(getOutput());
- }
- if (editor) {
- editor.getSession().setUseWrapMode(getWrapMode());
- editor.$el.css('font-size', getFontSize() + 'px');
- }
-}
-
-export function getCurrentSettings() {
- return {
- autocomplete: getAutocomplete(),
- wrapMode: getWrapMode(),
- tripleQuotes: getTripleQuotes(),
- fontSize: parseFloat(getFontSize()),
- polling: Boolean(getPolling()),
- };
-}
-
-export function updateSettings({ fontSize, wrapMode, tripleQuotes, autocomplete, polling }) {
- setFontSize(fontSize);
- setWrapMode(wrapMode);
- setTripleQuotes(tripleQuotes);
- setAutocomplete(autocomplete);
- setPolling(polling);
- getInput().focus();
- return getCurrentSettings();
-}
diff --git a/src/legacy/core_plugins/console/api_server/api.js b/src/legacy/core_plugins/console/server/api_server/api.js
similarity index 100%
rename from src/legacy/core_plugins/console/api_server/api.js
rename to src/legacy/core_plugins/console/server/api_server/api.js
diff --git a/src/legacy/core_plugins/console/api_server/es_6_0.js b/src/legacy/core_plugins/console/server/api_server/es_6_0.js
similarity index 100%
rename from src/legacy/core_plugins/console/api_server/es_6_0.js
rename to src/legacy/core_plugins/console/server/api_server/es_6_0.js
diff --git a/src/legacy/core_plugins/console/api_server/es_6_0/aggregations.js b/src/legacy/core_plugins/console/server/api_server/es_6_0/aggregations.js
similarity index 100%
rename from src/legacy/core_plugins/console/api_server/es_6_0/aggregations.js
rename to src/legacy/core_plugins/console/server/api_server/es_6_0/aggregations.js
diff --git a/src/legacy/core_plugins/console/api_server/es_6_0/aliases.js b/src/legacy/core_plugins/console/server/api_server/es_6_0/aliases.js
similarity index 100%
rename from src/legacy/core_plugins/console/api_server/es_6_0/aliases.js
rename to src/legacy/core_plugins/console/server/api_server/es_6_0/aliases.js
diff --git a/src/legacy/core_plugins/console/api_server/es_6_0/document.js b/src/legacy/core_plugins/console/server/api_server/es_6_0/document.js
similarity index 100%
rename from src/legacy/core_plugins/console/api_server/es_6_0/document.js
rename to src/legacy/core_plugins/console/server/api_server/es_6_0/document.js
diff --git a/src/legacy/core_plugins/console/api_server/es_6_0/filter.js b/src/legacy/core_plugins/console/server/api_server/es_6_0/filter.js
similarity index 100%
rename from src/legacy/core_plugins/console/api_server/es_6_0/filter.js
rename to src/legacy/core_plugins/console/server/api_server/es_6_0/filter.js
diff --git a/src/legacy/core_plugins/console/api_server/es_6_0/globals.js b/src/legacy/core_plugins/console/server/api_server/es_6_0/globals.js
similarity index 100%
rename from src/legacy/core_plugins/console/api_server/es_6_0/globals.js
rename to src/legacy/core_plugins/console/server/api_server/es_6_0/globals.js
diff --git a/src/legacy/core_plugins/console/api_server/es_6_0/ingest.js b/src/legacy/core_plugins/console/server/api_server/es_6_0/ingest.js
similarity index 100%
rename from src/legacy/core_plugins/console/api_server/es_6_0/ingest.js
rename to src/legacy/core_plugins/console/server/api_server/es_6_0/ingest.js
diff --git a/src/legacy/core_plugins/console/api_server/es_6_0/mappings.js b/src/legacy/core_plugins/console/server/api_server/es_6_0/mappings.js
similarity index 100%
rename from src/legacy/core_plugins/console/api_server/es_6_0/mappings.js
rename to src/legacy/core_plugins/console/server/api_server/es_6_0/mappings.js
diff --git a/src/legacy/core_plugins/console/api_server/es_6_0/query/dsl.js b/src/legacy/core_plugins/console/server/api_server/es_6_0/query/dsl.js
similarity index 100%
rename from src/legacy/core_plugins/console/api_server/es_6_0/query/dsl.js
rename to src/legacy/core_plugins/console/server/api_server/es_6_0/query/dsl.js
diff --git a/src/legacy/core_plugins/console/api_server/es_6_0/query/index.js b/src/legacy/core_plugins/console/server/api_server/es_6_0/query/index.js
similarity index 100%
rename from src/legacy/core_plugins/console/api_server/es_6_0/query/index.js
rename to src/legacy/core_plugins/console/server/api_server/es_6_0/query/index.js
diff --git a/src/legacy/core_plugins/console/api_server/es_6_0/query/templates.js b/src/legacy/core_plugins/console/server/api_server/es_6_0/query/templates.js
similarity index 100%
rename from src/legacy/core_plugins/console/api_server/es_6_0/query/templates.js
rename to src/legacy/core_plugins/console/server/api_server/es_6_0/query/templates.js
diff --git a/src/legacy/core_plugins/console/api_server/es_6_0/reindex.js b/src/legacy/core_plugins/console/server/api_server/es_6_0/reindex.js
similarity index 100%
rename from src/legacy/core_plugins/console/api_server/es_6_0/reindex.js
rename to src/legacy/core_plugins/console/server/api_server/es_6_0/reindex.js
diff --git a/src/legacy/core_plugins/console/api_server/es_6_0/search.js b/src/legacy/core_plugins/console/server/api_server/es_6_0/search.js
similarity index 100%
rename from src/legacy/core_plugins/console/api_server/es_6_0/search.js
rename to src/legacy/core_plugins/console/server/api_server/es_6_0/search.js
diff --git a/src/legacy/core_plugins/console/api_server/server.js b/src/legacy/core_plugins/console/server/api_server/server.js
similarity index 100%
rename from src/legacy/core_plugins/console/api_server/server.js
rename to src/legacy/core_plugins/console/server/api_server/server.js
diff --git a/src/legacy/core_plugins/console/api_server/server.test.js b/src/legacy/core_plugins/console/server/api_server/server.test.js
similarity index 100%
rename from src/legacy/core_plugins/console/api_server/server.test.js
rename to src/legacy/core_plugins/console/server/api_server/server.test.js
diff --git a/src/legacy/core_plugins/console/api_server/spec/.eslintrc b/src/legacy/core_plugins/console/server/api_server/spec/.eslintrc
similarity index 92%
rename from src/legacy/core_plugins/console/api_server/spec/.eslintrc
rename to src/legacy/core_plugins/console/server/api_server/spec/.eslintrc
index b302d39e1dfd1..46052f0e19a0d 100644
--- a/src/legacy/core_plugins/console/api_server/spec/.eslintrc
+++ b/src/legacy/core_plugins/console/server/api_server/spec/.eslintrc
@@ -1,7 +1,7 @@
---
root: true
-extends: '../../../../../../.eslintrc.js'
+extends: '../../../../../../../.eslintrc.js'
rules:
block-scoped-var: off
diff --git a/src/legacy/core_plugins/console/api_server/spec/generated/_common.json b/src/legacy/core_plugins/console/server/api_server/spec/generated/_common.json
similarity index 100%
rename from src/legacy/core_plugins/console/api_server/spec/generated/_common.json
rename to src/legacy/core_plugins/console/server/api_server/spec/generated/_common.json
diff --git a/src/legacy/core_plugins/console/api_server/spec/generated/bulk.json b/src/legacy/core_plugins/console/server/api_server/spec/generated/bulk.json
similarity index 100%
rename from src/legacy/core_plugins/console/api_server/spec/generated/bulk.json
rename to src/legacy/core_plugins/console/server/api_server/spec/generated/bulk.json
diff --git a/src/legacy/core_plugins/console/api_server/spec/generated/cat.aliases.json b/src/legacy/core_plugins/console/server/api_server/spec/generated/cat.aliases.json
similarity index 100%
rename from src/legacy/core_plugins/console/api_server/spec/generated/cat.aliases.json
rename to src/legacy/core_plugins/console/server/api_server/spec/generated/cat.aliases.json
diff --git a/src/legacy/core_plugins/console/api_server/spec/generated/cat.allocation.json b/src/legacy/core_plugins/console/server/api_server/spec/generated/cat.allocation.json
similarity index 100%
rename from src/legacy/core_plugins/console/api_server/spec/generated/cat.allocation.json
rename to src/legacy/core_plugins/console/server/api_server/spec/generated/cat.allocation.json
diff --git a/src/legacy/core_plugins/console/api_server/spec/generated/cat.count.json b/src/legacy/core_plugins/console/server/api_server/spec/generated/cat.count.json
similarity index 100%
rename from src/legacy/core_plugins/console/api_server/spec/generated/cat.count.json
rename to src/legacy/core_plugins/console/server/api_server/spec/generated/cat.count.json
diff --git a/src/legacy/core_plugins/console/api_server/spec/generated/cat.fielddata.json b/src/legacy/core_plugins/console/server/api_server/spec/generated/cat.fielddata.json
similarity index 100%
rename from src/legacy/core_plugins/console/api_server/spec/generated/cat.fielddata.json
rename to src/legacy/core_plugins/console/server/api_server/spec/generated/cat.fielddata.json
diff --git a/src/legacy/core_plugins/console/api_server/spec/generated/cat.health.json b/src/legacy/core_plugins/console/server/api_server/spec/generated/cat.health.json
similarity index 100%
rename from src/legacy/core_plugins/console/api_server/spec/generated/cat.health.json
rename to src/legacy/core_plugins/console/server/api_server/spec/generated/cat.health.json
diff --git a/src/legacy/core_plugins/console/api_server/spec/generated/cat.help.json b/src/legacy/core_plugins/console/server/api_server/spec/generated/cat.help.json
similarity index 100%
rename from src/legacy/core_plugins/console/api_server/spec/generated/cat.help.json
rename to src/legacy/core_plugins/console/server/api_server/spec/generated/cat.help.json
diff --git a/src/legacy/core_plugins/console/api_server/spec/generated/cat.indices.json b/src/legacy/core_plugins/console/server/api_server/spec/generated/cat.indices.json
similarity index 100%
rename from src/legacy/core_plugins/console/api_server/spec/generated/cat.indices.json
rename to src/legacy/core_plugins/console/server/api_server/spec/generated/cat.indices.json
diff --git a/src/legacy/core_plugins/console/api_server/spec/generated/cat.master.json b/src/legacy/core_plugins/console/server/api_server/spec/generated/cat.master.json
similarity index 100%
rename from src/legacy/core_plugins/console/api_server/spec/generated/cat.master.json
rename to src/legacy/core_plugins/console/server/api_server/spec/generated/cat.master.json
diff --git a/src/legacy/core_plugins/console/api_server/spec/generated/cat.nodeattrs.json b/src/legacy/core_plugins/console/server/api_server/spec/generated/cat.nodeattrs.json
similarity index 100%
rename from src/legacy/core_plugins/console/api_server/spec/generated/cat.nodeattrs.json
rename to src/legacy/core_plugins/console/server/api_server/spec/generated/cat.nodeattrs.json
diff --git a/src/legacy/core_plugins/console/api_server/spec/generated/cat.nodes.json b/src/legacy/core_plugins/console/server/api_server/spec/generated/cat.nodes.json
similarity index 100%
rename from src/legacy/core_plugins/console/api_server/spec/generated/cat.nodes.json
rename to src/legacy/core_plugins/console/server/api_server/spec/generated/cat.nodes.json
diff --git a/src/legacy/core_plugins/console/api_server/spec/generated/cat.pending_tasks.json b/src/legacy/core_plugins/console/server/api_server/spec/generated/cat.pending_tasks.json
similarity index 100%
rename from src/legacy/core_plugins/console/api_server/spec/generated/cat.pending_tasks.json
rename to src/legacy/core_plugins/console/server/api_server/spec/generated/cat.pending_tasks.json
diff --git a/src/legacy/core_plugins/console/api_server/spec/generated/cat.plugins.json b/src/legacy/core_plugins/console/server/api_server/spec/generated/cat.plugins.json
similarity index 100%
rename from src/legacy/core_plugins/console/api_server/spec/generated/cat.plugins.json
rename to src/legacy/core_plugins/console/server/api_server/spec/generated/cat.plugins.json
diff --git a/src/legacy/core_plugins/console/api_server/spec/generated/cat.recovery.json b/src/legacy/core_plugins/console/server/api_server/spec/generated/cat.recovery.json
similarity index 100%
rename from src/legacy/core_plugins/console/api_server/spec/generated/cat.recovery.json
rename to src/legacy/core_plugins/console/server/api_server/spec/generated/cat.recovery.json
diff --git a/src/legacy/core_plugins/console/api_server/spec/generated/cat.repositories.json b/src/legacy/core_plugins/console/server/api_server/spec/generated/cat.repositories.json
similarity index 100%
rename from src/legacy/core_plugins/console/api_server/spec/generated/cat.repositories.json
rename to src/legacy/core_plugins/console/server/api_server/spec/generated/cat.repositories.json
diff --git a/src/legacy/core_plugins/console/api_server/spec/generated/cat.segments.json b/src/legacy/core_plugins/console/server/api_server/spec/generated/cat.segments.json
similarity index 100%
rename from src/legacy/core_plugins/console/api_server/spec/generated/cat.segments.json
rename to src/legacy/core_plugins/console/server/api_server/spec/generated/cat.segments.json
diff --git a/src/legacy/core_plugins/console/api_server/spec/generated/cat.shards.json b/src/legacy/core_plugins/console/server/api_server/spec/generated/cat.shards.json
similarity index 100%
rename from src/legacy/core_plugins/console/api_server/spec/generated/cat.shards.json
rename to src/legacy/core_plugins/console/server/api_server/spec/generated/cat.shards.json
diff --git a/src/legacy/core_plugins/console/api_server/spec/generated/cat.snapshots.json b/src/legacy/core_plugins/console/server/api_server/spec/generated/cat.snapshots.json
similarity index 100%
rename from src/legacy/core_plugins/console/api_server/spec/generated/cat.snapshots.json
rename to src/legacy/core_plugins/console/server/api_server/spec/generated/cat.snapshots.json
diff --git a/src/legacy/core_plugins/console/api_server/spec/generated/cat.tasks.json b/src/legacy/core_plugins/console/server/api_server/spec/generated/cat.tasks.json
similarity index 100%
rename from src/legacy/core_plugins/console/api_server/spec/generated/cat.tasks.json
rename to src/legacy/core_plugins/console/server/api_server/spec/generated/cat.tasks.json
diff --git a/src/legacy/core_plugins/console/api_server/spec/generated/cat.templates.json b/src/legacy/core_plugins/console/server/api_server/spec/generated/cat.templates.json
similarity index 100%
rename from src/legacy/core_plugins/console/api_server/spec/generated/cat.templates.json
rename to src/legacy/core_plugins/console/server/api_server/spec/generated/cat.templates.json
diff --git a/src/legacy/core_plugins/console/api_server/spec/generated/cat.thread_pool.json b/src/legacy/core_plugins/console/server/api_server/spec/generated/cat.thread_pool.json
similarity index 100%
rename from src/legacy/core_plugins/console/api_server/spec/generated/cat.thread_pool.json
rename to src/legacy/core_plugins/console/server/api_server/spec/generated/cat.thread_pool.json
diff --git a/src/legacy/core_plugins/console/api_server/spec/generated/clear_scroll.json b/src/legacy/core_plugins/console/server/api_server/spec/generated/clear_scroll.json
similarity index 100%
rename from src/legacy/core_plugins/console/api_server/spec/generated/clear_scroll.json
rename to src/legacy/core_plugins/console/server/api_server/spec/generated/clear_scroll.json
diff --git a/src/legacy/core_plugins/console/api_server/spec/generated/cluster.allocation_explain.json b/src/legacy/core_plugins/console/server/api_server/spec/generated/cluster.allocation_explain.json
similarity index 100%
rename from src/legacy/core_plugins/console/api_server/spec/generated/cluster.allocation_explain.json
rename to src/legacy/core_plugins/console/server/api_server/spec/generated/cluster.allocation_explain.json
diff --git a/src/legacy/core_plugins/console/api_server/spec/generated/cluster.get_settings.json b/src/legacy/core_plugins/console/server/api_server/spec/generated/cluster.get_settings.json
similarity index 100%
rename from src/legacy/core_plugins/console/api_server/spec/generated/cluster.get_settings.json
rename to src/legacy/core_plugins/console/server/api_server/spec/generated/cluster.get_settings.json
diff --git a/src/legacy/core_plugins/console/api_server/spec/generated/cluster.health.json b/src/legacy/core_plugins/console/server/api_server/spec/generated/cluster.health.json
similarity index 100%
rename from src/legacy/core_plugins/console/api_server/spec/generated/cluster.health.json
rename to src/legacy/core_plugins/console/server/api_server/spec/generated/cluster.health.json
diff --git a/src/legacy/core_plugins/console/api_server/spec/generated/cluster.pending_tasks.json b/src/legacy/core_plugins/console/server/api_server/spec/generated/cluster.pending_tasks.json
similarity index 100%
rename from src/legacy/core_plugins/console/api_server/spec/generated/cluster.pending_tasks.json
rename to src/legacy/core_plugins/console/server/api_server/spec/generated/cluster.pending_tasks.json
diff --git a/src/legacy/core_plugins/console/api_server/spec/generated/cluster.put_settings.json b/src/legacy/core_plugins/console/server/api_server/spec/generated/cluster.put_settings.json
similarity index 100%
rename from src/legacy/core_plugins/console/api_server/spec/generated/cluster.put_settings.json
rename to src/legacy/core_plugins/console/server/api_server/spec/generated/cluster.put_settings.json
diff --git a/src/legacy/core_plugins/console/api_server/spec/generated/cluster.remote_info.json b/src/legacy/core_plugins/console/server/api_server/spec/generated/cluster.remote_info.json
similarity index 100%
rename from src/legacy/core_plugins/console/api_server/spec/generated/cluster.remote_info.json
rename to src/legacy/core_plugins/console/server/api_server/spec/generated/cluster.remote_info.json
diff --git a/src/legacy/core_plugins/console/api_server/spec/generated/cluster.reroute.json b/src/legacy/core_plugins/console/server/api_server/spec/generated/cluster.reroute.json
similarity index 100%
rename from src/legacy/core_plugins/console/api_server/spec/generated/cluster.reroute.json
rename to src/legacy/core_plugins/console/server/api_server/spec/generated/cluster.reroute.json
diff --git a/src/legacy/core_plugins/console/api_server/spec/generated/cluster.state.json b/src/legacy/core_plugins/console/server/api_server/spec/generated/cluster.state.json
similarity index 100%
rename from src/legacy/core_plugins/console/api_server/spec/generated/cluster.state.json
rename to src/legacy/core_plugins/console/server/api_server/spec/generated/cluster.state.json
diff --git a/src/legacy/core_plugins/console/api_server/spec/generated/cluster.stats.json b/src/legacy/core_plugins/console/server/api_server/spec/generated/cluster.stats.json
similarity index 100%
rename from src/legacy/core_plugins/console/api_server/spec/generated/cluster.stats.json
rename to src/legacy/core_plugins/console/server/api_server/spec/generated/cluster.stats.json
diff --git a/src/legacy/core_plugins/console/api_server/spec/generated/count.json b/src/legacy/core_plugins/console/server/api_server/spec/generated/count.json
similarity index 100%
rename from src/legacy/core_plugins/console/api_server/spec/generated/count.json
rename to src/legacy/core_plugins/console/server/api_server/spec/generated/count.json
diff --git a/src/legacy/core_plugins/console/api_server/spec/generated/create.json b/src/legacy/core_plugins/console/server/api_server/spec/generated/create.json
similarity index 100%
rename from src/legacy/core_plugins/console/api_server/spec/generated/create.json
rename to src/legacy/core_plugins/console/server/api_server/spec/generated/create.json
diff --git a/src/legacy/core_plugins/console/api_server/spec/generated/delete.json b/src/legacy/core_plugins/console/server/api_server/spec/generated/delete.json
similarity index 100%
rename from src/legacy/core_plugins/console/api_server/spec/generated/delete.json
rename to src/legacy/core_plugins/console/server/api_server/spec/generated/delete.json
diff --git a/src/legacy/core_plugins/console/api_server/spec/generated/delete_by_query.json b/src/legacy/core_plugins/console/server/api_server/spec/generated/delete_by_query.json
similarity index 100%
rename from src/legacy/core_plugins/console/api_server/spec/generated/delete_by_query.json
rename to src/legacy/core_plugins/console/server/api_server/spec/generated/delete_by_query.json
diff --git a/src/legacy/core_plugins/console/api_server/spec/generated/delete_by_query_rethrottle.json b/src/legacy/core_plugins/console/server/api_server/spec/generated/delete_by_query_rethrottle.json
similarity index 100%
rename from src/legacy/core_plugins/console/api_server/spec/generated/delete_by_query_rethrottle.json
rename to src/legacy/core_plugins/console/server/api_server/spec/generated/delete_by_query_rethrottle.json
diff --git a/src/legacy/core_plugins/console/api_server/spec/generated/delete_script.json b/src/legacy/core_plugins/console/server/api_server/spec/generated/delete_script.json
similarity index 100%
rename from src/legacy/core_plugins/console/api_server/spec/generated/delete_script.json
rename to src/legacy/core_plugins/console/server/api_server/spec/generated/delete_script.json
diff --git a/src/legacy/core_plugins/console/api_server/spec/generated/exists.json b/src/legacy/core_plugins/console/server/api_server/spec/generated/exists.json
similarity index 100%
rename from src/legacy/core_plugins/console/api_server/spec/generated/exists.json
rename to src/legacy/core_plugins/console/server/api_server/spec/generated/exists.json
diff --git a/src/legacy/core_plugins/console/api_server/spec/generated/exists_source.json b/src/legacy/core_plugins/console/server/api_server/spec/generated/exists_source.json
similarity index 100%
rename from src/legacy/core_plugins/console/api_server/spec/generated/exists_source.json
rename to src/legacy/core_plugins/console/server/api_server/spec/generated/exists_source.json
diff --git a/src/legacy/core_plugins/console/api_server/spec/generated/explain.json b/src/legacy/core_plugins/console/server/api_server/spec/generated/explain.json
similarity index 100%
rename from src/legacy/core_plugins/console/api_server/spec/generated/explain.json
rename to src/legacy/core_plugins/console/server/api_server/spec/generated/explain.json
diff --git a/src/legacy/core_plugins/console/api_server/spec/generated/field_caps.json b/src/legacy/core_plugins/console/server/api_server/spec/generated/field_caps.json
similarity index 100%
rename from src/legacy/core_plugins/console/api_server/spec/generated/field_caps.json
rename to src/legacy/core_plugins/console/server/api_server/spec/generated/field_caps.json
diff --git a/src/legacy/core_plugins/console/api_server/spec/generated/get.json b/src/legacy/core_plugins/console/server/api_server/spec/generated/get.json
similarity index 100%
rename from src/legacy/core_plugins/console/api_server/spec/generated/get.json
rename to src/legacy/core_plugins/console/server/api_server/spec/generated/get.json
diff --git a/src/legacy/core_plugins/console/api_server/spec/generated/get_script.json b/src/legacy/core_plugins/console/server/api_server/spec/generated/get_script.json
similarity index 100%
rename from src/legacy/core_plugins/console/api_server/spec/generated/get_script.json
rename to src/legacy/core_plugins/console/server/api_server/spec/generated/get_script.json
diff --git a/src/legacy/core_plugins/console/api_server/spec/generated/get_source.json b/src/legacy/core_plugins/console/server/api_server/spec/generated/get_source.json
similarity index 100%
rename from src/legacy/core_plugins/console/api_server/spec/generated/get_source.json
rename to src/legacy/core_plugins/console/server/api_server/spec/generated/get_source.json
diff --git a/src/legacy/core_plugins/console/api_server/spec/generated/index.json b/src/legacy/core_plugins/console/server/api_server/spec/generated/index.json
similarity index 100%
rename from src/legacy/core_plugins/console/api_server/spec/generated/index.json
rename to src/legacy/core_plugins/console/server/api_server/spec/generated/index.json
diff --git a/src/legacy/core_plugins/console/api_server/spec/generated/indices.analyze.json b/src/legacy/core_plugins/console/server/api_server/spec/generated/indices.analyze.json
similarity index 100%
rename from src/legacy/core_plugins/console/api_server/spec/generated/indices.analyze.json
rename to src/legacy/core_plugins/console/server/api_server/spec/generated/indices.analyze.json
diff --git a/src/legacy/core_plugins/console/api_server/spec/generated/indices.clear_cache.json b/src/legacy/core_plugins/console/server/api_server/spec/generated/indices.clear_cache.json
similarity index 100%
rename from src/legacy/core_plugins/console/api_server/spec/generated/indices.clear_cache.json
rename to src/legacy/core_plugins/console/server/api_server/spec/generated/indices.clear_cache.json
diff --git a/src/legacy/core_plugins/console/api_server/spec/generated/indices.clone.json b/src/legacy/core_plugins/console/server/api_server/spec/generated/indices.clone.json
similarity index 100%
rename from src/legacy/core_plugins/console/api_server/spec/generated/indices.clone.json
rename to src/legacy/core_plugins/console/server/api_server/spec/generated/indices.clone.json
diff --git a/src/legacy/core_plugins/console/api_server/spec/generated/indices.close.json b/src/legacy/core_plugins/console/server/api_server/spec/generated/indices.close.json
similarity index 100%
rename from src/legacy/core_plugins/console/api_server/spec/generated/indices.close.json
rename to src/legacy/core_plugins/console/server/api_server/spec/generated/indices.close.json
diff --git a/src/legacy/core_plugins/console/api_server/spec/generated/indices.create.json b/src/legacy/core_plugins/console/server/api_server/spec/generated/indices.create.json
similarity index 100%
rename from src/legacy/core_plugins/console/api_server/spec/generated/indices.create.json
rename to src/legacy/core_plugins/console/server/api_server/spec/generated/indices.create.json
diff --git a/src/legacy/core_plugins/console/api_server/spec/generated/indices.delete.json b/src/legacy/core_plugins/console/server/api_server/spec/generated/indices.delete.json
similarity index 100%
rename from src/legacy/core_plugins/console/api_server/spec/generated/indices.delete.json
rename to src/legacy/core_plugins/console/server/api_server/spec/generated/indices.delete.json
diff --git a/src/legacy/core_plugins/console/api_server/spec/generated/indices.delete_alias.json b/src/legacy/core_plugins/console/server/api_server/spec/generated/indices.delete_alias.json
similarity index 100%
rename from src/legacy/core_plugins/console/api_server/spec/generated/indices.delete_alias.json
rename to src/legacy/core_plugins/console/server/api_server/spec/generated/indices.delete_alias.json
diff --git a/src/legacy/core_plugins/console/api_server/spec/generated/indices.delete_template.json b/src/legacy/core_plugins/console/server/api_server/spec/generated/indices.delete_template.json
similarity index 100%
rename from src/legacy/core_plugins/console/api_server/spec/generated/indices.delete_template.json
rename to src/legacy/core_plugins/console/server/api_server/spec/generated/indices.delete_template.json
diff --git a/src/legacy/core_plugins/console/api_server/spec/generated/indices.exists.json b/src/legacy/core_plugins/console/server/api_server/spec/generated/indices.exists.json
similarity index 100%
rename from src/legacy/core_plugins/console/api_server/spec/generated/indices.exists.json
rename to src/legacy/core_plugins/console/server/api_server/spec/generated/indices.exists.json
diff --git a/src/legacy/core_plugins/console/api_server/spec/generated/indices.exists_alias.json b/src/legacy/core_plugins/console/server/api_server/spec/generated/indices.exists_alias.json
similarity index 100%
rename from src/legacy/core_plugins/console/api_server/spec/generated/indices.exists_alias.json
rename to src/legacy/core_plugins/console/server/api_server/spec/generated/indices.exists_alias.json
diff --git a/src/legacy/core_plugins/console/api_server/spec/generated/indices.exists_template.json b/src/legacy/core_plugins/console/server/api_server/spec/generated/indices.exists_template.json
similarity index 100%
rename from src/legacy/core_plugins/console/api_server/spec/generated/indices.exists_template.json
rename to src/legacy/core_plugins/console/server/api_server/spec/generated/indices.exists_template.json
diff --git a/src/legacy/core_plugins/console/api_server/spec/generated/indices.exists_type.json b/src/legacy/core_plugins/console/server/api_server/spec/generated/indices.exists_type.json
similarity index 100%
rename from src/legacy/core_plugins/console/api_server/spec/generated/indices.exists_type.json
rename to src/legacy/core_plugins/console/server/api_server/spec/generated/indices.exists_type.json
diff --git a/src/legacy/core_plugins/console/api_server/spec/generated/indices.flush.json b/src/legacy/core_plugins/console/server/api_server/spec/generated/indices.flush.json
similarity index 100%
rename from src/legacy/core_plugins/console/api_server/spec/generated/indices.flush.json
rename to src/legacy/core_plugins/console/server/api_server/spec/generated/indices.flush.json
diff --git a/src/legacy/core_plugins/console/api_server/spec/generated/indices.flush_synced.json b/src/legacy/core_plugins/console/server/api_server/spec/generated/indices.flush_synced.json
similarity index 100%
rename from src/legacy/core_plugins/console/api_server/spec/generated/indices.flush_synced.json
rename to src/legacy/core_plugins/console/server/api_server/spec/generated/indices.flush_synced.json
diff --git a/src/legacy/core_plugins/console/api_server/spec/generated/indices.forcemerge.json b/src/legacy/core_plugins/console/server/api_server/spec/generated/indices.forcemerge.json
similarity index 100%
rename from src/legacy/core_plugins/console/api_server/spec/generated/indices.forcemerge.json
rename to src/legacy/core_plugins/console/server/api_server/spec/generated/indices.forcemerge.json
diff --git a/src/legacy/core_plugins/console/api_server/spec/generated/indices.get.json b/src/legacy/core_plugins/console/server/api_server/spec/generated/indices.get.json
similarity index 100%
rename from src/legacy/core_plugins/console/api_server/spec/generated/indices.get.json
rename to src/legacy/core_plugins/console/server/api_server/spec/generated/indices.get.json
diff --git a/src/legacy/core_plugins/console/api_server/spec/generated/indices.get_alias.json b/src/legacy/core_plugins/console/server/api_server/spec/generated/indices.get_alias.json
similarity index 100%
rename from src/legacy/core_plugins/console/api_server/spec/generated/indices.get_alias.json
rename to src/legacy/core_plugins/console/server/api_server/spec/generated/indices.get_alias.json
diff --git a/src/legacy/core_plugins/console/api_server/spec/generated/indices.get_field_mapping.json b/src/legacy/core_plugins/console/server/api_server/spec/generated/indices.get_field_mapping.json
similarity index 100%
rename from src/legacy/core_plugins/console/api_server/spec/generated/indices.get_field_mapping.json
rename to src/legacy/core_plugins/console/server/api_server/spec/generated/indices.get_field_mapping.json
diff --git a/src/legacy/core_plugins/console/api_server/spec/generated/indices.get_mapping.json b/src/legacy/core_plugins/console/server/api_server/spec/generated/indices.get_mapping.json
similarity index 100%
rename from src/legacy/core_plugins/console/api_server/spec/generated/indices.get_mapping.json
rename to src/legacy/core_plugins/console/server/api_server/spec/generated/indices.get_mapping.json
diff --git a/src/legacy/core_plugins/console/api_server/spec/generated/indices.get_settings.json b/src/legacy/core_plugins/console/server/api_server/spec/generated/indices.get_settings.json
similarity index 100%
rename from src/legacy/core_plugins/console/api_server/spec/generated/indices.get_settings.json
rename to src/legacy/core_plugins/console/server/api_server/spec/generated/indices.get_settings.json
diff --git a/src/legacy/core_plugins/console/api_server/spec/generated/indices.get_template.json b/src/legacy/core_plugins/console/server/api_server/spec/generated/indices.get_template.json
similarity index 100%
rename from src/legacy/core_plugins/console/api_server/spec/generated/indices.get_template.json
rename to src/legacy/core_plugins/console/server/api_server/spec/generated/indices.get_template.json
diff --git a/src/legacy/core_plugins/console/api_server/spec/generated/indices.get_upgrade.json b/src/legacy/core_plugins/console/server/api_server/spec/generated/indices.get_upgrade.json
similarity index 100%
rename from src/legacy/core_plugins/console/api_server/spec/generated/indices.get_upgrade.json
rename to src/legacy/core_plugins/console/server/api_server/spec/generated/indices.get_upgrade.json
diff --git a/src/legacy/core_plugins/console/api_server/spec/generated/indices.open.json b/src/legacy/core_plugins/console/server/api_server/spec/generated/indices.open.json
similarity index 100%
rename from src/legacy/core_plugins/console/api_server/spec/generated/indices.open.json
rename to src/legacy/core_plugins/console/server/api_server/spec/generated/indices.open.json
diff --git a/src/legacy/core_plugins/console/api_server/spec/generated/indices.put_alias.json b/src/legacy/core_plugins/console/server/api_server/spec/generated/indices.put_alias.json
similarity index 100%
rename from src/legacy/core_plugins/console/api_server/spec/generated/indices.put_alias.json
rename to src/legacy/core_plugins/console/server/api_server/spec/generated/indices.put_alias.json
diff --git a/src/legacy/core_plugins/console/api_server/spec/generated/indices.put_mapping.json b/src/legacy/core_plugins/console/server/api_server/spec/generated/indices.put_mapping.json
similarity index 100%
rename from src/legacy/core_plugins/console/api_server/spec/generated/indices.put_mapping.json
rename to src/legacy/core_plugins/console/server/api_server/spec/generated/indices.put_mapping.json
diff --git a/src/legacy/core_plugins/console/api_server/spec/generated/indices.put_settings.json b/src/legacy/core_plugins/console/server/api_server/spec/generated/indices.put_settings.json
similarity index 100%
rename from src/legacy/core_plugins/console/api_server/spec/generated/indices.put_settings.json
rename to src/legacy/core_plugins/console/server/api_server/spec/generated/indices.put_settings.json
diff --git a/src/legacy/core_plugins/console/api_server/spec/generated/indices.put_template.json b/src/legacy/core_plugins/console/server/api_server/spec/generated/indices.put_template.json
similarity index 100%
rename from src/legacy/core_plugins/console/api_server/spec/generated/indices.put_template.json
rename to src/legacy/core_plugins/console/server/api_server/spec/generated/indices.put_template.json
diff --git a/src/legacy/core_plugins/console/api_server/spec/generated/indices.recovery.json b/src/legacy/core_plugins/console/server/api_server/spec/generated/indices.recovery.json
similarity index 100%
rename from src/legacy/core_plugins/console/api_server/spec/generated/indices.recovery.json
rename to src/legacy/core_plugins/console/server/api_server/spec/generated/indices.recovery.json
diff --git a/src/legacy/core_plugins/console/api_server/spec/generated/indices.refresh.json b/src/legacy/core_plugins/console/server/api_server/spec/generated/indices.refresh.json
similarity index 100%
rename from src/legacy/core_plugins/console/api_server/spec/generated/indices.refresh.json
rename to src/legacy/core_plugins/console/server/api_server/spec/generated/indices.refresh.json
diff --git a/src/legacy/core_plugins/console/api_server/spec/generated/indices.rollover.json b/src/legacy/core_plugins/console/server/api_server/spec/generated/indices.rollover.json
similarity index 100%
rename from src/legacy/core_plugins/console/api_server/spec/generated/indices.rollover.json
rename to src/legacy/core_plugins/console/server/api_server/spec/generated/indices.rollover.json
diff --git a/src/legacy/core_plugins/console/api_server/spec/generated/indices.segments.json b/src/legacy/core_plugins/console/server/api_server/spec/generated/indices.segments.json
similarity index 100%
rename from src/legacy/core_plugins/console/api_server/spec/generated/indices.segments.json
rename to src/legacy/core_plugins/console/server/api_server/spec/generated/indices.segments.json
diff --git a/src/legacy/core_plugins/console/api_server/spec/generated/indices.shard_stores.json b/src/legacy/core_plugins/console/server/api_server/spec/generated/indices.shard_stores.json
similarity index 100%
rename from src/legacy/core_plugins/console/api_server/spec/generated/indices.shard_stores.json
rename to src/legacy/core_plugins/console/server/api_server/spec/generated/indices.shard_stores.json
diff --git a/src/legacy/core_plugins/console/api_server/spec/generated/indices.shrink.json b/src/legacy/core_plugins/console/server/api_server/spec/generated/indices.shrink.json
similarity index 100%
rename from src/legacy/core_plugins/console/api_server/spec/generated/indices.shrink.json
rename to src/legacy/core_plugins/console/server/api_server/spec/generated/indices.shrink.json
diff --git a/src/legacy/core_plugins/console/api_server/spec/generated/indices.split.json b/src/legacy/core_plugins/console/server/api_server/spec/generated/indices.split.json
similarity index 100%
rename from src/legacy/core_plugins/console/api_server/spec/generated/indices.split.json
rename to src/legacy/core_plugins/console/server/api_server/spec/generated/indices.split.json
diff --git a/src/legacy/core_plugins/console/api_server/spec/generated/indices.stats.json b/src/legacy/core_plugins/console/server/api_server/spec/generated/indices.stats.json
similarity index 100%
rename from src/legacy/core_plugins/console/api_server/spec/generated/indices.stats.json
rename to src/legacy/core_plugins/console/server/api_server/spec/generated/indices.stats.json
diff --git a/src/legacy/core_plugins/console/api_server/spec/generated/indices.update_aliases.json b/src/legacy/core_plugins/console/server/api_server/spec/generated/indices.update_aliases.json
similarity index 100%
rename from src/legacy/core_plugins/console/api_server/spec/generated/indices.update_aliases.json
rename to src/legacy/core_plugins/console/server/api_server/spec/generated/indices.update_aliases.json
diff --git a/src/legacy/core_plugins/console/api_server/spec/generated/indices.upgrade.json b/src/legacy/core_plugins/console/server/api_server/spec/generated/indices.upgrade.json
similarity index 100%
rename from src/legacy/core_plugins/console/api_server/spec/generated/indices.upgrade.json
rename to src/legacy/core_plugins/console/server/api_server/spec/generated/indices.upgrade.json
diff --git a/src/legacy/core_plugins/console/api_server/spec/generated/indices.validate_query.json b/src/legacy/core_plugins/console/server/api_server/spec/generated/indices.validate_query.json
similarity index 100%
rename from src/legacy/core_plugins/console/api_server/spec/generated/indices.validate_query.json
rename to src/legacy/core_plugins/console/server/api_server/spec/generated/indices.validate_query.json
diff --git a/src/legacy/core_plugins/console/api_server/spec/generated/info.json b/src/legacy/core_plugins/console/server/api_server/spec/generated/info.json
similarity index 100%
rename from src/legacy/core_plugins/console/api_server/spec/generated/info.json
rename to src/legacy/core_plugins/console/server/api_server/spec/generated/info.json
diff --git a/src/legacy/core_plugins/console/api_server/spec/generated/ingest.delete_pipeline.json b/src/legacy/core_plugins/console/server/api_server/spec/generated/ingest.delete_pipeline.json
similarity index 100%
rename from src/legacy/core_plugins/console/api_server/spec/generated/ingest.delete_pipeline.json
rename to src/legacy/core_plugins/console/server/api_server/spec/generated/ingest.delete_pipeline.json
diff --git a/src/legacy/core_plugins/console/api_server/spec/generated/ingest.get_pipeline.json b/src/legacy/core_plugins/console/server/api_server/spec/generated/ingest.get_pipeline.json
similarity index 100%
rename from src/legacy/core_plugins/console/api_server/spec/generated/ingest.get_pipeline.json
rename to src/legacy/core_plugins/console/server/api_server/spec/generated/ingest.get_pipeline.json
diff --git a/src/legacy/core_plugins/console/api_server/spec/generated/ingest.processor_grok.json b/src/legacy/core_plugins/console/server/api_server/spec/generated/ingest.processor_grok.json
similarity index 100%
rename from src/legacy/core_plugins/console/api_server/spec/generated/ingest.processor_grok.json
rename to src/legacy/core_plugins/console/server/api_server/spec/generated/ingest.processor_grok.json
diff --git a/src/legacy/core_plugins/console/api_server/spec/generated/ingest.put_pipeline.json b/src/legacy/core_plugins/console/server/api_server/spec/generated/ingest.put_pipeline.json
similarity index 100%
rename from src/legacy/core_plugins/console/api_server/spec/generated/ingest.put_pipeline.json
rename to src/legacy/core_plugins/console/server/api_server/spec/generated/ingest.put_pipeline.json
diff --git a/src/legacy/core_plugins/console/api_server/spec/generated/ingest.simulate.json b/src/legacy/core_plugins/console/server/api_server/spec/generated/ingest.simulate.json
similarity index 100%
rename from src/legacy/core_plugins/console/api_server/spec/generated/ingest.simulate.json
rename to src/legacy/core_plugins/console/server/api_server/spec/generated/ingest.simulate.json
diff --git a/src/legacy/core_plugins/console/api_server/spec/generated/mget.json b/src/legacy/core_plugins/console/server/api_server/spec/generated/mget.json
similarity index 100%
rename from src/legacy/core_plugins/console/api_server/spec/generated/mget.json
rename to src/legacy/core_plugins/console/server/api_server/spec/generated/mget.json
diff --git a/src/legacy/core_plugins/console/api_server/spec/generated/msearch.json b/src/legacy/core_plugins/console/server/api_server/spec/generated/msearch.json
similarity index 100%
rename from src/legacy/core_plugins/console/api_server/spec/generated/msearch.json
rename to src/legacy/core_plugins/console/server/api_server/spec/generated/msearch.json
diff --git a/src/legacy/core_plugins/console/api_server/spec/generated/msearch_template.json b/src/legacy/core_plugins/console/server/api_server/spec/generated/msearch_template.json
similarity index 100%
rename from src/legacy/core_plugins/console/api_server/spec/generated/msearch_template.json
rename to src/legacy/core_plugins/console/server/api_server/spec/generated/msearch_template.json
diff --git a/src/legacy/core_plugins/console/api_server/spec/generated/mtermvectors.json b/src/legacy/core_plugins/console/server/api_server/spec/generated/mtermvectors.json
similarity index 100%
rename from src/legacy/core_plugins/console/api_server/spec/generated/mtermvectors.json
rename to src/legacy/core_plugins/console/server/api_server/spec/generated/mtermvectors.json
diff --git a/src/legacy/core_plugins/console/api_server/spec/generated/nodes.hot_threads.json b/src/legacy/core_plugins/console/server/api_server/spec/generated/nodes.hot_threads.json
similarity index 100%
rename from src/legacy/core_plugins/console/api_server/spec/generated/nodes.hot_threads.json
rename to src/legacy/core_plugins/console/server/api_server/spec/generated/nodes.hot_threads.json
diff --git a/src/legacy/core_plugins/console/api_server/spec/generated/nodes.info.json b/src/legacy/core_plugins/console/server/api_server/spec/generated/nodes.info.json
similarity index 100%
rename from src/legacy/core_plugins/console/api_server/spec/generated/nodes.info.json
rename to src/legacy/core_plugins/console/server/api_server/spec/generated/nodes.info.json
diff --git a/src/legacy/core_plugins/console/api_server/spec/generated/nodes.reload_secure_settings.json b/src/legacy/core_plugins/console/server/api_server/spec/generated/nodes.reload_secure_settings.json
similarity index 100%
rename from src/legacy/core_plugins/console/api_server/spec/generated/nodes.reload_secure_settings.json
rename to src/legacy/core_plugins/console/server/api_server/spec/generated/nodes.reload_secure_settings.json
diff --git a/src/legacy/core_plugins/console/api_server/spec/generated/nodes.stats.json b/src/legacy/core_plugins/console/server/api_server/spec/generated/nodes.stats.json
similarity index 100%
rename from src/legacy/core_plugins/console/api_server/spec/generated/nodes.stats.json
rename to src/legacy/core_plugins/console/server/api_server/spec/generated/nodes.stats.json
diff --git a/src/legacy/core_plugins/console/api_server/spec/generated/nodes.usage.json b/src/legacy/core_plugins/console/server/api_server/spec/generated/nodes.usage.json
similarity index 100%
rename from src/legacy/core_plugins/console/api_server/spec/generated/nodes.usage.json
rename to src/legacy/core_plugins/console/server/api_server/spec/generated/nodes.usage.json
diff --git a/src/legacy/core_plugins/console/api_server/spec/generated/ping.json b/src/legacy/core_plugins/console/server/api_server/spec/generated/ping.json
similarity index 100%
rename from src/legacy/core_plugins/console/api_server/spec/generated/ping.json
rename to src/legacy/core_plugins/console/server/api_server/spec/generated/ping.json
diff --git a/src/legacy/core_plugins/console/api_server/spec/generated/put_script.json b/src/legacy/core_plugins/console/server/api_server/spec/generated/put_script.json
similarity index 100%
rename from src/legacy/core_plugins/console/api_server/spec/generated/put_script.json
rename to src/legacy/core_plugins/console/server/api_server/spec/generated/put_script.json
diff --git a/src/legacy/core_plugins/console/api_server/spec/generated/rank_eval.json b/src/legacy/core_plugins/console/server/api_server/spec/generated/rank_eval.json
similarity index 100%
rename from src/legacy/core_plugins/console/api_server/spec/generated/rank_eval.json
rename to src/legacy/core_plugins/console/server/api_server/spec/generated/rank_eval.json
diff --git a/src/legacy/core_plugins/console/api_server/spec/generated/reindex.json b/src/legacy/core_plugins/console/server/api_server/spec/generated/reindex.json
similarity index 100%
rename from src/legacy/core_plugins/console/api_server/spec/generated/reindex.json
rename to src/legacy/core_plugins/console/server/api_server/spec/generated/reindex.json
diff --git a/src/legacy/core_plugins/console/api_server/spec/generated/reindex_rethrottle.json b/src/legacy/core_plugins/console/server/api_server/spec/generated/reindex_rethrottle.json
similarity index 100%
rename from src/legacy/core_plugins/console/api_server/spec/generated/reindex_rethrottle.json
rename to src/legacy/core_plugins/console/server/api_server/spec/generated/reindex_rethrottle.json
diff --git a/src/legacy/core_plugins/console/api_server/spec/generated/render_search_template.json b/src/legacy/core_plugins/console/server/api_server/spec/generated/render_search_template.json
similarity index 100%
rename from src/legacy/core_plugins/console/api_server/spec/generated/render_search_template.json
rename to src/legacy/core_plugins/console/server/api_server/spec/generated/render_search_template.json
diff --git a/src/legacy/core_plugins/console/api_server/spec/generated/scripts_painless_execute.json b/src/legacy/core_plugins/console/server/api_server/spec/generated/scripts_painless_execute.json
similarity index 100%
rename from src/legacy/core_plugins/console/api_server/spec/generated/scripts_painless_execute.json
rename to src/legacy/core_plugins/console/server/api_server/spec/generated/scripts_painless_execute.json
diff --git a/src/legacy/core_plugins/console/api_server/spec/generated/scroll.json b/src/legacy/core_plugins/console/server/api_server/spec/generated/scroll.json
similarity index 100%
rename from src/legacy/core_plugins/console/api_server/spec/generated/scroll.json
rename to src/legacy/core_plugins/console/server/api_server/spec/generated/scroll.json
diff --git a/src/legacy/core_plugins/console/api_server/spec/generated/search.json b/src/legacy/core_plugins/console/server/api_server/spec/generated/search.json
similarity index 100%
rename from src/legacy/core_plugins/console/api_server/spec/generated/search.json
rename to src/legacy/core_plugins/console/server/api_server/spec/generated/search.json
diff --git a/src/legacy/core_plugins/console/api_server/spec/generated/search_shards.json b/src/legacy/core_plugins/console/server/api_server/spec/generated/search_shards.json
similarity index 100%
rename from src/legacy/core_plugins/console/api_server/spec/generated/search_shards.json
rename to src/legacy/core_plugins/console/server/api_server/spec/generated/search_shards.json
diff --git a/src/legacy/core_plugins/console/api_server/spec/generated/search_template.json b/src/legacy/core_plugins/console/server/api_server/spec/generated/search_template.json
similarity index 100%
rename from src/legacy/core_plugins/console/api_server/spec/generated/search_template.json
rename to src/legacy/core_plugins/console/server/api_server/spec/generated/search_template.json
diff --git a/src/legacy/core_plugins/console/api_server/spec/generated/snapshot.create.json b/src/legacy/core_plugins/console/server/api_server/spec/generated/snapshot.create.json
similarity index 100%
rename from src/legacy/core_plugins/console/api_server/spec/generated/snapshot.create.json
rename to src/legacy/core_plugins/console/server/api_server/spec/generated/snapshot.create.json
diff --git a/src/legacy/core_plugins/console/api_server/spec/generated/snapshot.create_repository.json b/src/legacy/core_plugins/console/server/api_server/spec/generated/snapshot.create_repository.json
similarity index 100%
rename from src/legacy/core_plugins/console/api_server/spec/generated/snapshot.create_repository.json
rename to src/legacy/core_plugins/console/server/api_server/spec/generated/snapshot.create_repository.json
diff --git a/src/legacy/core_plugins/console/api_server/spec/generated/snapshot.delete.json b/src/legacy/core_plugins/console/server/api_server/spec/generated/snapshot.delete.json
similarity index 100%
rename from src/legacy/core_plugins/console/api_server/spec/generated/snapshot.delete.json
rename to src/legacy/core_plugins/console/server/api_server/spec/generated/snapshot.delete.json
diff --git a/src/legacy/core_plugins/console/api_server/spec/generated/snapshot.delete_repository.json b/src/legacy/core_plugins/console/server/api_server/spec/generated/snapshot.delete_repository.json
similarity index 100%
rename from src/legacy/core_plugins/console/api_server/spec/generated/snapshot.delete_repository.json
rename to src/legacy/core_plugins/console/server/api_server/spec/generated/snapshot.delete_repository.json
diff --git a/src/legacy/core_plugins/console/api_server/spec/generated/snapshot.get.json b/src/legacy/core_plugins/console/server/api_server/spec/generated/snapshot.get.json
similarity index 100%
rename from src/legacy/core_plugins/console/api_server/spec/generated/snapshot.get.json
rename to src/legacy/core_plugins/console/server/api_server/spec/generated/snapshot.get.json
diff --git a/src/legacy/core_plugins/console/api_server/spec/generated/snapshot.get_repository.json b/src/legacy/core_plugins/console/server/api_server/spec/generated/snapshot.get_repository.json
similarity index 100%
rename from src/legacy/core_plugins/console/api_server/spec/generated/snapshot.get_repository.json
rename to src/legacy/core_plugins/console/server/api_server/spec/generated/snapshot.get_repository.json
diff --git a/src/legacy/core_plugins/console/api_server/spec/generated/snapshot.restore.json b/src/legacy/core_plugins/console/server/api_server/spec/generated/snapshot.restore.json
similarity index 100%
rename from src/legacy/core_plugins/console/api_server/spec/generated/snapshot.restore.json
rename to src/legacy/core_plugins/console/server/api_server/spec/generated/snapshot.restore.json
diff --git a/src/legacy/core_plugins/console/api_server/spec/generated/snapshot.status.json b/src/legacy/core_plugins/console/server/api_server/spec/generated/snapshot.status.json
similarity index 100%
rename from src/legacy/core_plugins/console/api_server/spec/generated/snapshot.status.json
rename to src/legacy/core_plugins/console/server/api_server/spec/generated/snapshot.status.json
diff --git a/src/legacy/core_plugins/console/api_server/spec/generated/snapshot.verify_repository.json b/src/legacy/core_plugins/console/server/api_server/spec/generated/snapshot.verify_repository.json
similarity index 100%
rename from src/legacy/core_plugins/console/api_server/spec/generated/snapshot.verify_repository.json
rename to src/legacy/core_plugins/console/server/api_server/spec/generated/snapshot.verify_repository.json
diff --git a/src/legacy/core_plugins/console/api_server/spec/generated/tasks.cancel.json b/src/legacy/core_plugins/console/server/api_server/spec/generated/tasks.cancel.json
similarity index 100%
rename from src/legacy/core_plugins/console/api_server/spec/generated/tasks.cancel.json
rename to src/legacy/core_plugins/console/server/api_server/spec/generated/tasks.cancel.json
diff --git a/src/legacy/core_plugins/console/api_server/spec/generated/tasks.get.json b/src/legacy/core_plugins/console/server/api_server/spec/generated/tasks.get.json
similarity index 100%
rename from src/legacy/core_plugins/console/api_server/spec/generated/tasks.get.json
rename to src/legacy/core_plugins/console/server/api_server/spec/generated/tasks.get.json
diff --git a/src/legacy/core_plugins/console/api_server/spec/generated/tasks.list.json b/src/legacy/core_plugins/console/server/api_server/spec/generated/tasks.list.json
similarity index 100%
rename from src/legacy/core_plugins/console/api_server/spec/generated/tasks.list.json
rename to src/legacy/core_plugins/console/server/api_server/spec/generated/tasks.list.json
diff --git a/src/legacy/core_plugins/console/api_server/spec/generated/termvectors.json b/src/legacy/core_plugins/console/server/api_server/spec/generated/termvectors.json
similarity index 100%
rename from src/legacy/core_plugins/console/api_server/spec/generated/termvectors.json
rename to src/legacy/core_plugins/console/server/api_server/spec/generated/termvectors.json
diff --git a/src/legacy/core_plugins/console/api_server/spec/generated/update.json b/src/legacy/core_plugins/console/server/api_server/spec/generated/update.json
similarity index 100%
rename from src/legacy/core_plugins/console/api_server/spec/generated/update.json
rename to src/legacy/core_plugins/console/server/api_server/spec/generated/update.json
diff --git a/src/legacy/core_plugins/console/api_server/spec/generated/update_by_query.json b/src/legacy/core_plugins/console/server/api_server/spec/generated/update_by_query.json
similarity index 100%
rename from src/legacy/core_plugins/console/api_server/spec/generated/update_by_query.json
rename to src/legacy/core_plugins/console/server/api_server/spec/generated/update_by_query.json
diff --git a/src/legacy/core_plugins/console/api_server/spec/generated/update_by_query_rethrottle.json b/src/legacy/core_plugins/console/server/api_server/spec/generated/update_by_query_rethrottle.json
similarity index 100%
rename from src/legacy/core_plugins/console/api_server/spec/generated/update_by_query_rethrottle.json
rename to src/legacy/core_plugins/console/server/api_server/spec/generated/update_by_query_rethrottle.json
diff --git a/src/legacy/core_plugins/console/api_server/spec/index.js b/src/legacy/core_plugins/console/server/api_server/spec/index.js
similarity index 100%
rename from src/legacy/core_plugins/console/api_server/spec/index.js
rename to src/legacy/core_plugins/console/server/api_server/spec/index.js
diff --git a/src/legacy/core_plugins/console/api_server/spec/overrides/cluster.health.json b/src/legacy/core_plugins/console/server/api_server/spec/overrides/cluster.health.json
similarity index 100%
rename from src/legacy/core_plugins/console/api_server/spec/overrides/cluster.health.json
rename to src/legacy/core_plugins/console/server/api_server/spec/overrides/cluster.health.json
diff --git a/src/legacy/core_plugins/console/api_server/spec/overrides/cluster.put_settings.json b/src/legacy/core_plugins/console/server/api_server/spec/overrides/cluster.put_settings.json
similarity index 100%
rename from src/legacy/core_plugins/console/api_server/spec/overrides/cluster.put_settings.json
rename to src/legacy/core_plugins/console/server/api_server/spec/overrides/cluster.put_settings.json
diff --git a/src/legacy/core_plugins/console/api_server/spec/overrides/cluster.reroute.json b/src/legacy/core_plugins/console/server/api_server/spec/overrides/cluster.reroute.json
similarity index 100%
rename from src/legacy/core_plugins/console/api_server/spec/overrides/cluster.reroute.json
rename to src/legacy/core_plugins/console/server/api_server/spec/overrides/cluster.reroute.json
diff --git a/src/legacy/core_plugins/console/api_server/spec/overrides/count.json b/src/legacy/core_plugins/console/server/api_server/spec/overrides/count.json
similarity index 100%
rename from src/legacy/core_plugins/console/api_server/spec/overrides/count.json
rename to src/legacy/core_plugins/console/server/api_server/spec/overrides/count.json
diff --git a/src/legacy/core_plugins/console/api_server/spec/overrides/create.json b/src/legacy/core_plugins/console/server/api_server/spec/overrides/create.json
similarity index 100%
rename from src/legacy/core_plugins/console/api_server/spec/overrides/create.json
rename to src/legacy/core_plugins/console/server/api_server/spec/overrides/create.json
diff --git a/src/legacy/core_plugins/console/api_server/spec/overrides/indices.analyze.json b/src/legacy/core_plugins/console/server/api_server/spec/overrides/indices.analyze.json
similarity index 100%
rename from src/legacy/core_plugins/console/api_server/spec/overrides/indices.analyze.json
rename to src/legacy/core_plugins/console/server/api_server/spec/overrides/indices.analyze.json
diff --git a/src/legacy/core_plugins/console/api_server/spec/overrides/indices.clone.json b/src/legacy/core_plugins/console/server/api_server/spec/overrides/indices.clone.json
similarity index 100%
rename from src/legacy/core_plugins/console/api_server/spec/overrides/indices.clone.json
rename to src/legacy/core_plugins/console/server/api_server/spec/overrides/indices.clone.json
diff --git a/src/legacy/core_plugins/console/api_server/spec/overrides/indices.create.json b/src/legacy/core_plugins/console/server/api_server/spec/overrides/indices.create.json
similarity index 100%
rename from src/legacy/core_plugins/console/api_server/spec/overrides/indices.create.json
rename to src/legacy/core_plugins/console/server/api_server/spec/overrides/indices.create.json
diff --git a/src/legacy/core_plugins/console/api_server/spec/overrides/indices.delete_template.json b/src/legacy/core_plugins/console/server/api_server/spec/overrides/indices.delete_template.json
similarity index 100%
rename from src/legacy/core_plugins/console/api_server/spec/overrides/indices.delete_template.json
rename to src/legacy/core_plugins/console/server/api_server/spec/overrides/indices.delete_template.json
diff --git a/src/legacy/core_plugins/console/api_server/spec/overrides/indices.exists_template.json b/src/legacy/core_plugins/console/server/api_server/spec/overrides/indices.exists_template.json
similarity index 100%
rename from src/legacy/core_plugins/console/api_server/spec/overrides/indices.exists_template.json
rename to src/legacy/core_plugins/console/server/api_server/spec/overrides/indices.exists_template.json
diff --git a/src/legacy/core_plugins/console/api_server/spec/overrides/indices.get_field_mapping.json b/src/legacy/core_plugins/console/server/api_server/spec/overrides/indices.get_field_mapping.json
similarity index 100%
rename from src/legacy/core_plugins/console/api_server/spec/overrides/indices.get_field_mapping.json
rename to src/legacy/core_plugins/console/server/api_server/spec/overrides/indices.get_field_mapping.json
diff --git a/src/legacy/core_plugins/console/api_server/spec/overrides/indices.get_mapping.json b/src/legacy/core_plugins/console/server/api_server/spec/overrides/indices.get_mapping.json
similarity index 100%
rename from src/legacy/core_plugins/console/api_server/spec/overrides/indices.get_mapping.json
rename to src/legacy/core_plugins/console/server/api_server/spec/overrides/indices.get_mapping.json
diff --git a/src/legacy/core_plugins/console/api_server/spec/overrides/indices.get_template.json b/src/legacy/core_plugins/console/server/api_server/spec/overrides/indices.get_template.json
similarity index 100%
rename from src/legacy/core_plugins/console/api_server/spec/overrides/indices.get_template.json
rename to src/legacy/core_plugins/console/server/api_server/spec/overrides/indices.get_template.json
diff --git a/src/legacy/core_plugins/console/api_server/spec/overrides/indices.put_alias.json b/src/legacy/core_plugins/console/server/api_server/spec/overrides/indices.put_alias.json
similarity index 100%
rename from src/legacy/core_plugins/console/api_server/spec/overrides/indices.put_alias.json
rename to src/legacy/core_plugins/console/server/api_server/spec/overrides/indices.put_alias.json
diff --git a/src/legacy/core_plugins/console/api_server/spec/overrides/indices.put_settings.json b/src/legacy/core_plugins/console/server/api_server/spec/overrides/indices.put_settings.json
similarity index 100%
rename from src/legacy/core_plugins/console/api_server/spec/overrides/indices.put_settings.json
rename to src/legacy/core_plugins/console/server/api_server/spec/overrides/indices.put_settings.json
diff --git a/src/legacy/core_plugins/console/api_server/spec/overrides/indices.put_template.json b/src/legacy/core_plugins/console/server/api_server/spec/overrides/indices.put_template.json
similarity index 100%
rename from src/legacy/core_plugins/console/api_server/spec/overrides/indices.put_template.json
rename to src/legacy/core_plugins/console/server/api_server/spec/overrides/indices.put_template.json
diff --git a/src/legacy/core_plugins/console/api_server/spec/overrides/indices.rollover.json b/src/legacy/core_plugins/console/server/api_server/spec/overrides/indices.rollover.json
similarity index 100%
rename from src/legacy/core_plugins/console/api_server/spec/overrides/indices.rollover.json
rename to src/legacy/core_plugins/console/server/api_server/spec/overrides/indices.rollover.json
diff --git a/src/legacy/core_plugins/console/api_server/spec/overrides/indices.update_aliases.json b/src/legacy/core_plugins/console/server/api_server/spec/overrides/indices.update_aliases.json
similarity index 100%
rename from src/legacy/core_plugins/console/api_server/spec/overrides/indices.update_aliases.json
rename to src/legacy/core_plugins/console/server/api_server/spec/overrides/indices.update_aliases.json
diff --git a/src/legacy/core_plugins/console/api_server/spec/overrides/indices.validate_query.json b/src/legacy/core_plugins/console/server/api_server/spec/overrides/indices.validate_query.json
similarity index 100%
rename from src/legacy/core_plugins/console/api_server/spec/overrides/indices.validate_query.json
rename to src/legacy/core_plugins/console/server/api_server/spec/overrides/indices.validate_query.json
diff --git a/src/legacy/core_plugins/console/api_server/spec/overrides/snapshot.create.json b/src/legacy/core_plugins/console/server/api_server/spec/overrides/snapshot.create.json
similarity index 100%
rename from src/legacy/core_plugins/console/api_server/spec/overrides/snapshot.create.json
rename to src/legacy/core_plugins/console/server/api_server/spec/overrides/snapshot.create.json
diff --git a/src/legacy/core_plugins/console/api_server/spec/overrides/snapshot.create_repository.json b/src/legacy/core_plugins/console/server/api_server/spec/overrides/snapshot.create_repository.json
similarity index 100%
rename from src/legacy/core_plugins/console/api_server/spec/overrides/snapshot.create_repository.json
rename to src/legacy/core_plugins/console/server/api_server/spec/overrides/snapshot.create_repository.json
diff --git a/src/legacy/core_plugins/console/api_server/spec/overrides/snapshot.restore.json b/src/legacy/core_plugins/console/server/api_server/spec/overrides/snapshot.restore.json
similarity index 100%
rename from src/legacy/core_plugins/console/api_server/spec/overrides/snapshot.restore.json
rename to src/legacy/core_plugins/console/server/api_server/spec/overrides/snapshot.restore.json