From 032b30c15315102e424ee5afc1d34ee9c24a892b Mon Sep 17 00:00:00 2001 From: Matthias Wilhelm Date: Wed, 15 Jan 2020 08:43:41 +0100 Subject: [PATCH] Simplify code --- .../{constants/routes.ts => constants.ts} | 4 + .../common/constants/index.ts | 8 -- .../common/constants/plugin.ts | 9 -- .../plugins/painless_playground/index.ts | 7 +- .../public/components/painless_playground.tsx | 9 +- .../public/lib/execute_code.ts | 17 ++++ .../painless_playground/public/register.ts | 15 ++++ .../public/register_feature.ts | 23 ----- .../painless_playground/public/render_app.tsx | 4 +- .../services/painless_playground_service.ts | 23 ----- .../lib/{check_license => }/check_license.ts | 0 .../check_license/__tests__/check_license.js | 90 ------------------- .../server/lib/check_license/index.ts | 7 -- .../server/lib/error_wrappers/index.ts | 7 -- .../lib/error_wrappers/wrap_es_error.ts | 18 ---- .../license_pre_routing_factory.ts | 4 +- .../__tests__/license_pre_routing_factory.js | 64 ------------- .../lib/license_pre_routing_factory/index.ts | 7 -- .../lib/register_license_checker/index.ts | 7 -- .../register_license_checker.ts | 6 +- ...te_route.ts => register_simulate_route.ts} | 7 +- 21 files changed, 54 insertions(+), 282 deletions(-) rename x-pack/legacy/plugins/painless_playground/common/{constants/routes.ts => constants.ts} (84%) delete mode 100644 x-pack/legacy/plugins/painless_playground/common/constants/index.ts delete mode 100644 x-pack/legacy/plugins/painless_playground/common/constants/plugin.ts create mode 100644 x-pack/legacy/plugins/painless_playground/public/lib/execute_code.ts delete mode 100644 x-pack/legacy/plugins/painless_playground/public/register_feature.ts delete mode 100644 x-pack/legacy/plugins/painless_playground/public/services/painless_playground_service.ts rename x-pack/legacy/plugins/painless_playground/server/lib/{check_license => }/check_license.ts (100%) delete mode 100644 x-pack/legacy/plugins/painless_playground/server/lib/check_license/__tests__/check_license.js delete mode 100644 x-pack/legacy/plugins/painless_playground/server/lib/check_license/index.ts delete mode 100644 x-pack/legacy/plugins/painless_playground/server/lib/error_wrappers/index.ts delete mode 100644 x-pack/legacy/plugins/painless_playground/server/lib/error_wrappers/wrap_es_error.ts rename x-pack/legacy/plugins/painless_playground/server/lib/{license_pre_routing_factory => }/license_pre_routing_factory.ts (87%) delete mode 100644 x-pack/legacy/plugins/painless_playground/server/lib/license_pre_routing_factory/__tests__/license_pre_routing_factory.js delete mode 100644 x-pack/legacy/plugins/painless_playground/server/lib/license_pre_routing_factory/index.ts delete mode 100644 x-pack/legacy/plugins/painless_playground/server/lib/register_license_checker/index.ts rename x-pack/legacy/plugins/painless_playground/server/{lib/register_license_checker => }/register_license_checker.ts (80%) rename x-pack/legacy/plugins/painless_playground/server/{routes/api/register_painless_playground_simulate_route.ts => register_simulate_route.ts} (73%) diff --git a/x-pack/legacy/plugins/painless_playground/common/constants/routes.ts b/x-pack/legacy/plugins/painless_playground/common/constants.ts similarity index 84% rename from x-pack/legacy/plugins/painless_playground/common/constants/routes.ts rename to x-pack/legacy/plugins/painless_playground/common/constants.ts index ae28e758add5b..f315aaab343f1 100644 --- a/x-pack/legacy/plugins/painless_playground/common/constants/routes.ts +++ b/x-pack/legacy/plugins/painless_playground/common/constants.ts @@ -4,6 +4,10 @@ * you may not use this file except in compliance with the Elastic License. */ +export const PLUGIN = { + ID: 'painless_playground', +}; + export const ROUTES = { API_ROOT: '/api/painless_playground', }; diff --git a/x-pack/legacy/plugins/painless_playground/common/constants/index.ts b/x-pack/legacy/plugins/painless_playground/common/constants/index.ts deleted file mode 100644 index 85b819624b70f..0000000000000 --- a/x-pack/legacy/plugins/painless_playground/common/constants/index.ts +++ /dev/null @@ -1,8 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License; - * you may not use this file except in compliance with the Elastic License. - */ - -export { ROUTES } from './routes'; -export { PLUGIN } from './plugin'; diff --git a/x-pack/legacy/plugins/painless_playground/common/constants/plugin.ts b/x-pack/legacy/plugins/painless_playground/common/constants/plugin.ts deleted file mode 100644 index 07767dd54bd38..0000000000000 --- a/x-pack/legacy/plugins/painless_playground/common/constants/plugin.ts +++ /dev/null @@ -1,9 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License; - * you may not use this file except in compliance with the Elastic License. - */ - -export const PLUGIN = { - ID: 'painless_playground', -}; diff --git a/x-pack/legacy/plugins/painless_playground/index.ts b/x-pack/legacy/plugins/painless_playground/index.ts index b9c01a2b8b369..30ca2847f5a25 100644 --- a/x-pack/legacy/plugins/painless_playground/index.ts +++ b/x-pack/legacy/plugins/painless_playground/index.ts @@ -7,8 +7,8 @@ import { resolve } from 'path'; import { PLUGIN } from './common/constants'; -import { registerLicenseChecker } from './server/lib/register_license_checker'; -import { registerPainlessPlaygroundSimulateRoute } from './server/routes/api/register_painless_playground_simulate_route'; +import { registerLicenseChecker } from './server/register_license_checker'; +import { registerSimulateRoute } from './server/register_simulate_route'; export const painlessPlayground = (kibana: any) => new kibana.Plugin({ @@ -23,10 +23,9 @@ export const painlessPlayground = (kibana: any) => }, uiExports: { devTools: [resolve(__dirname, 'public/register')], - home: [resolve(__dirname, 'public/register_feature')], }, init: (server: any) => { registerLicenseChecker(server); - registerPainlessPlaygroundSimulateRoute(server); + registerSimulateRoute(server); }, }); diff --git a/x-pack/legacy/plugins/painless_playground/public/components/painless_playground.tsx b/x-pack/legacy/plugins/painless_playground/public/components/painless_playground.tsx index c0ae7ae221b30..7114c4b3beb41 100644 --- a/x-pack/legacy/plugins/painless_playground/public/components/painless_playground.tsx +++ b/x-pack/legacy/plugins/painless_playground/public/components/painless_playground.tsx @@ -18,20 +18,21 @@ import { FormattedMessage } from '@kbn/i18n/react'; import { CodeEditor } from '../../../../../../src/plugins/kibana_react/public'; interface Props { - service: any; + executeCode: (payload: Record) => Promise; } interface State { code: string; request?: string; response?: string; - responseObj: Record; + responseObj: Record | null; } export function PainlessPlayground(props: Props) { const [state, setState] = useState({ code: '', request: '', response: '', + responseObj: null, }); const submit = async () => { @@ -41,7 +42,7 @@ export function PainlessPlayground(props: Props) { }, }; try { - const response = await props.service.simulate(request); + const response = await props.executeCode(request); setState({ code: state.code, request: JSON.stringify(request, null, 2), @@ -112,7 +113,7 @@ export function PainlessPlayground(props: Props) { } diff --git a/x-pack/legacy/plugins/painless_playground/public/lib/execute_code.ts b/x-pack/legacy/plugins/painless_playground/public/lib/execute_code.ts new file mode 100644 index 0000000000000..6f345a1e7ea06 --- /dev/null +++ b/x-pack/legacy/plugins/painless_playground/public/lib/execute_code.ts @@ -0,0 +1,17 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import { ROUTES } from '../../common/constants'; + +export async function executeCode(http: any, payload: Record) { + try { + return await http.post(`${ROUTES.API_ROOT}/simulate`, { + body: JSON.stringify(payload), + }); + } catch (e) { + return e; + } +} diff --git a/x-pack/legacy/plugins/painless_playground/public/register.ts b/x-pack/legacy/plugins/painless_playground/public/register.ts index 01789fdc55cfd..ed76f46ee8489 100644 --- a/x-pack/legacy/plugins/painless_playground/public/register.ts +++ b/x-pack/legacy/plugins/painless_playground/public/register.ts @@ -9,6 +9,21 @@ import { i18n } from '@kbn/i18n'; import { xpackInfo } from 'plugins/xpack_main/services/xpack_info'; import { npSetup, npStart } from 'ui/new_platform'; import { registerPainless } from './register_painless'; +import { FeatureCatalogueCategory } from '../../../../../src/plugins/home/public'; + +npSetup.plugins.home.featureCatalogue.register({ + id: 'painless_playground', + title: i18n.translate('xpack.painlessPlayground.registryProviderTitle', { + defaultMessage: 'Painless Playground', + }), + description: i18n.translate('xpack.painlessPlayground.registryProviderDescription', { + defaultMessage: 'Simulate and debug painless code', + }), + icon: '', + path: '/app/kibana#/dev_tools/painless_playground', + showOnHomePage: false, + category: FeatureCatalogueCategory.ADMIN, +}); npSetup.plugins.dev_tools.register({ order: 7, diff --git a/x-pack/legacy/plugins/painless_playground/public/register_feature.ts b/x-pack/legacy/plugins/painless_playground/public/register_feature.ts deleted file mode 100644 index c39aad88e8caa..0000000000000 --- a/x-pack/legacy/plugins/painless_playground/public/register_feature.ts +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License; - * you may not use this file except in compliance with the Elastic License. - */ - -import { i18n } from '@kbn/i18n'; -import { npSetup } from 'ui/new_platform'; -import { FeatureCatalogueCategory } from '../../../../../src/plugins/home/public'; - -npSetup.plugins.home.featureCatalogue.register({ - id: 'painless_playground', - title: i18n.translate('xpack.painlessPlayground.registryProviderTitle', { - defaultMessage: 'Painless Playground', - }), - description: i18n.translate('xpack.painlessPlayground.registryProviderDescription', { - defaultMessage: 'Simulate and debug painless code', - }), - icon: '', - path: '/app/kibana#/dev_tools/painless_playground', - showOnHomePage: false, - category: FeatureCatalogueCategory.ADMIN, -}); diff --git a/x-pack/legacy/plugins/painless_playground/public/render_app.tsx b/x-pack/legacy/plugins/painless_playground/public/render_app.tsx index 1aa9c052de8a0..d58c8f09c869b 100644 --- a/x-pack/legacy/plugins/painless_playground/public/render_app.tsx +++ b/x-pack/legacy/plugins/painless_playground/public/render_app.tsx @@ -8,8 +8,8 @@ import React from 'react'; import { render, unmountComponentAtNode } from 'react-dom'; import { I18nProvider } from '@kbn/i18n/react'; import { PainlessPlayground } from './components/painless_playground'; -import { PainlessPlaygroundService } from './services/painless_playground_service'; import { createKibanaReactContext } from '../../../../../src/plugins/kibana_react/public'; +import { executeCode } from './lib/execute_code'; export function renderApp(element: any, npStart: any) { const { Provider: KibanaReactContextProvider } = createKibanaReactContext({ @@ -18,7 +18,7 @@ export function renderApp(element: any, npStart: any) { render( - + executeCode(npStart.core.http, payload)} /> , element diff --git a/x-pack/legacy/plugins/painless_playground/public/services/painless_playground_service.ts b/x-pack/legacy/plugins/painless_playground/public/services/painless_playground_service.ts deleted file mode 100644 index cf633dbc468d0..0000000000000 --- a/x-pack/legacy/plugins/painless_playground/public/services/painless_playground_service.ts +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License; - * you may not use this file except in compliance with the Elastic License. - */ - -import { ROUTES } from '../../common/constants'; - -export class PainlessPlaygroundService { - constructor(private http: any) { - this.http = http; - } - - async simulate(payload: unknown) { - try { - return await this.http.post(`${ROUTES.API_ROOT}/simulate`, { - body: JSON.stringify(payload), - }); - } catch (e) { - return e; - } - } -} diff --git a/x-pack/legacy/plugins/painless_playground/server/lib/check_license/check_license.ts b/x-pack/legacy/plugins/painless_playground/server/lib/check_license.ts similarity index 100% rename from x-pack/legacy/plugins/painless_playground/server/lib/check_license/check_license.ts rename to x-pack/legacy/plugins/painless_playground/server/lib/check_license.ts diff --git a/x-pack/legacy/plugins/painless_playground/server/lib/check_license/__tests__/check_license.js b/x-pack/legacy/plugins/painless_playground/server/lib/check_license/__tests__/check_license.js deleted file mode 100644 index 7e32d68a67ece..0000000000000 --- a/x-pack/legacy/plugins/painless_playground/server/lib/check_license/__tests__/check_license.js +++ /dev/null @@ -1,90 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License; - * you may not use this file except in compliance with the Elastic License. - */ - -import expect from '@kbn/expect'; -import { set } from 'lodash'; -import { checkLicense } from '../check_license'; - -describe('check_license', function() { - let mockLicenseInfo; - beforeEach(() => (mockLicenseInfo = {})); - - describe('license information is undefined', () => { - beforeEach(() => (mockLicenseInfo = undefined)); - - it('should set enableLink to false', () => { - expect(checkLicense(mockLicenseInfo).enableLink).to.be(false); - }); - - it('should set enableAPIRoute to false', () => { - expect(checkLicense(mockLicenseInfo).enableAPIRoute).to.be(false); - }); - - it('should set a message', () => { - expect(checkLicense(mockLicenseInfo).message).to.not.be(undefined); - }); - }); - - describe('license information is not available', () => { - beforeEach(() => (mockLicenseInfo.isAvailable = () => false)); - - it('should set enableLink to false', () => { - expect(checkLicense(mockLicenseInfo).enableLink).to.be(false); - }); - - it('should set enableAPIRoute to false', () => { - expect(checkLicense(mockLicenseInfo).enableAPIRoute).to.be(false); - }); - - it('should set a message', () => { - expect(checkLicense(mockLicenseInfo).message).to.not.be(undefined); - }); - }); - - describe('license information is available', () => { - beforeEach( - () => - (mockLicenseInfo = { - isAvailable: () => true, - license: { - getType: () => 'foobar', - }, - }) - ); - - describe('& license is active', () => { - beforeEach(() => set(mockLicenseInfo, 'license.isActive', () => true)); - - it('should set enableLink to true', () => { - expect(checkLicense(mockLicenseInfo).enableLink).to.be(true); - }); - - it('should set enableAPIRoute to true', () => { - expect(checkLicense(mockLicenseInfo).enableAPIRoute).to.be(true); - }); - - it('should NOT set a message', () => { - expect(checkLicense(mockLicenseInfo).message).to.be(undefined); - }); - }); - - describe('& license is expired', () => { - beforeEach(() => set(mockLicenseInfo, 'license.isActive', () => false)); - - it('should set enableLink to false', () => { - expect(checkLicense(mockLicenseInfo).enableLink).to.be(false); - }); - - it('should set enableAPIRoute to false', () => { - expect(checkLicense(mockLicenseInfo).enableAPIRoute).to.be(false); - }); - - it('should set a message', () => { - expect(checkLicense(mockLicenseInfo).message).to.not.be(undefined); - }); - }); - }); -}); diff --git a/x-pack/legacy/plugins/painless_playground/server/lib/check_license/index.ts b/x-pack/legacy/plugins/painless_playground/server/lib/check_license/index.ts deleted file mode 100644 index f2c070fd44b6e..0000000000000 --- a/x-pack/legacy/plugins/painless_playground/server/lib/check_license/index.ts +++ /dev/null @@ -1,7 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License; - * you may not use this file except in compliance with the Elastic License. - */ - -export { checkLicense } from './check_license'; diff --git a/x-pack/legacy/plugins/painless_playground/server/lib/error_wrappers/index.ts b/x-pack/legacy/plugins/painless_playground/server/lib/error_wrappers/index.ts deleted file mode 100644 index 3756b0c74fb10..0000000000000 --- a/x-pack/legacy/plugins/painless_playground/server/lib/error_wrappers/index.ts +++ /dev/null @@ -1,7 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License; - * you may not use this file except in compliance with the Elastic License. - */ - -export { wrapEsError } from './wrap_es_error'; diff --git a/x-pack/legacy/plugins/painless_playground/server/lib/error_wrappers/wrap_es_error.ts b/x-pack/legacy/plugins/painless_playground/server/lib/error_wrappers/wrap_es_error.ts deleted file mode 100644 index e48ef500309a7..0000000000000 --- a/x-pack/legacy/plugins/painless_playground/server/lib/error_wrappers/wrap_es_error.ts +++ /dev/null @@ -1,18 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License; - * you may not use this file except in compliance with the Elastic License. - */ - -import Boom from 'boom'; - -/** - * Wraps ES errors into a Boom error response and returns it - * This also handles the permissions issue gracefully - * - * @param err Object ES error - * @return Object Boom error response - */ -export function wrapEsError(err: any) { - return Boom.boomify(err, { statusCode: err.statusCode }); -} diff --git a/x-pack/legacy/plugins/painless_playground/server/lib/license_pre_routing_factory/license_pre_routing_factory.ts b/x-pack/legacy/plugins/painless_playground/server/lib/license_pre_routing_factory.ts similarity index 87% rename from x-pack/legacy/plugins/painless_playground/server/lib/license_pre_routing_factory/license_pre_routing_factory.ts rename to x-pack/legacy/plugins/painless_playground/server/lib/license_pre_routing_factory.ts index 4e183262f9d8f..df135b9e0ef32 100644 --- a/x-pack/legacy/plugins/painless_playground/server/lib/license_pre_routing_factory/license_pre_routing_factory.ts +++ b/x-pack/legacy/plugins/painless_playground/server/lib/license_pre_routing_factory.ts @@ -5,8 +5,8 @@ */ import Boom from 'boom'; -import { ServerFacade } from '../../../types'; -import { PLUGIN } from '../../../common/constants'; +import { PLUGIN } from '../../common/constants'; +import { ServerFacade } from '../../../index_management'; export const licensePreRoutingFactory = (server: ServerFacade) => { const xpackMainPlugin = server.plugins.xpack_main; diff --git a/x-pack/legacy/plugins/painless_playground/server/lib/license_pre_routing_factory/__tests__/license_pre_routing_factory.js b/x-pack/legacy/plugins/painless_playground/server/lib/license_pre_routing_factory/__tests__/license_pre_routing_factory.js deleted file mode 100644 index 854d919b1173d..0000000000000 --- a/x-pack/legacy/plugins/painless_playground/server/lib/license_pre_routing_factory/__tests__/license_pre_routing_factory.js +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License; - * you may not use this file except in compliance with the Elastic License. - */ - -import expect from '@kbn/expect'; -import Boom from 'boom'; -import { licensePreRoutingFactory } from '../license_pre_routing_factory'; - -describe('license_pre_routing_factory', () => { - describe('#painlessPlaygroundFeaturePreRoutingFactory', () => { - let mockServer; - let mockLicenseCheckResults; - - beforeEach(() => { - mockServer = { - plugins: { - xpack_main: { - info: { - feature: () => ({ - getLicenseCheckResults: () => mockLicenseCheckResults, - }), - }, - }, - }, - }; - }); - - describe('isAvailable is false', () => { - beforeEach(() => { - mockLicenseCheckResults = { - isAvailable: false, - }; - }); - - it('replies with 403', async () => { - const licensePreRouting = licensePreRoutingFactory(mockServer); - const stubRequest = {}; - expect(() => licensePreRouting(stubRequest)).to.throwException(response => { - expect(response).to.be.an(Error); - expect(response.isBoom).to.be(true); - expect(response.output.statusCode).to.be(403); - }); - }); - }); - - describe('isAvailable is true', () => { - beforeEach(() => { - mockLicenseCheckResults = { - isAvailable: true, - }; - }); - - it('replies with forbidden', async () => { - const licensePreRouting = licensePreRoutingFactory(mockServer); - const stubRequest = {}; - expect(() => licensePreRouting(stubRequest)).to.throwException(response => { - expect(response).to.eql(Boom.forbidden()); - }); - }); - }); - }); -}); diff --git a/x-pack/legacy/plugins/painless_playground/server/lib/license_pre_routing_factory/index.ts b/x-pack/legacy/plugins/painless_playground/server/lib/license_pre_routing_factory/index.ts deleted file mode 100644 index 0743e443955f4..0000000000000 --- a/x-pack/legacy/plugins/painless_playground/server/lib/license_pre_routing_factory/index.ts +++ /dev/null @@ -1,7 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License; - * you may not use this file except in compliance with the Elastic License. - */ - -export { licensePreRoutingFactory } from './license_pre_routing_factory'; diff --git a/x-pack/legacy/plugins/painless_playground/server/lib/register_license_checker/index.ts b/x-pack/legacy/plugins/painless_playground/server/lib/register_license_checker/index.ts deleted file mode 100644 index 7b0f97c38d129..0000000000000 --- a/x-pack/legacy/plugins/painless_playground/server/lib/register_license_checker/index.ts +++ /dev/null @@ -1,7 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License; - * you may not use this file except in compliance with the Elastic License. - */ - -export { registerLicenseChecker } from './register_license_checker'; diff --git a/x-pack/legacy/plugins/painless_playground/server/lib/register_license_checker/register_license_checker.ts b/x-pack/legacy/plugins/painless_playground/server/register_license_checker.ts similarity index 80% rename from x-pack/legacy/plugins/painless_playground/server/lib/register_license_checker/register_license_checker.ts rename to x-pack/legacy/plugins/painless_playground/server/register_license_checker.ts index bcb7a610b6294..53932582193cf 100644 --- a/x-pack/legacy/plugins/painless_playground/server/lib/register_license_checker/register_license_checker.ts +++ b/x-pack/legacy/plugins/painless_playground/server/register_license_checker.ts @@ -4,9 +4,9 @@ * you may not use this file except in compliance with the Elastic License. */ // @ts-ignore -import { mirrorPluginStatus } from '../../../../../server/lib/mirror_plugin_status'; -import { checkLicense } from '../check_license'; -import { PLUGIN } from '../../../common/constants'; +import { mirrorPluginStatus } from '../../../server/lib/mirror_plugin_status'; +import { checkLicense } from './lib/check_license'; +import { PLUGIN } from '../common/constants'; export function registerLicenseChecker(server: any) { const xpackMainPlugin = server.plugins.xpack_main; diff --git a/x-pack/legacy/plugins/painless_playground/server/routes/api/register_painless_playground_simulate_route.ts b/x-pack/legacy/plugins/painless_playground/server/register_simulate_route.ts similarity index 73% rename from x-pack/legacy/plugins/painless_playground/server/routes/api/register_painless_playground_simulate_route.ts rename to x-pack/legacy/plugins/painless_playground/server/register_simulate_route.ts index 84047ed55431b..9125dd77187f9 100644 --- a/x-pack/legacy/plugins/painless_playground/server/routes/api/register_painless_playground_simulate_route.ts +++ b/x-pack/legacy/plugins/painless_playground/server/register_simulate_route.ts @@ -4,11 +4,10 @@ * you may not use this file except in compliance with the Elastic License. */ -import { wrapEsError } from '../../lib/error_wrappers'; -import { licensePreRoutingFactory } from '../../lib/license_pre_routing_factory'; -import { ServerFacade, RequestFacade } from '../../../types'; +import { licensePreRoutingFactory } from './lib/license_pre_routing_factory'; +import { RequestFacade, ServerFacade } from '../../reporting/types'; -export function registerPainlessPlaygroundSimulateRoute(server: ServerFacade) { +export function registerSimulateRoute(server: ServerFacade) { const licensePreRouting = licensePreRoutingFactory(server); server.route({