Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Painless Lab] NP migration #59794

Merged
merged 8 commits into from
Mar 13, 2020
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,7 @@
/x-pack/plugins/remote_clusters/ @elastic/es-ui
/x-pack/legacy/plugins/rollup/ @elastic/es-ui
/x-pack/plugins/searchprofiler/ @elastic/es-ui
/x-pack/plugins/painless_lab/ @elastic/es-ui
/x-pack/legacy/plugins/snapshot_restore/ @elastic/es-ui
/x-pack/legacy/plugins/upgrade_assistant/ @elastic/es-ui
/x-pack/plugins/upgrade_assistant/ @elastic/es-ui
Expand Down
2 changes: 1 addition & 1 deletion x-pack/.i18nrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"xpack.ml": ["plugins/ml", "legacy/plugins/ml"],
"xpack.monitoring": "legacy/plugins/monitoring",
"xpack.remoteClusters": "plugins/remote_clusters",
"xpack.painlessLab": "legacy/plugins/painless_lab",
"xpack.painlessLab": "plugins/painless_lab",
"xpack.reporting": ["plugins/reporting", "legacy/plugins/reporting"],
"xpack.rollupJobs": "legacy/plugins/rollup",
"xpack.searchProfiler": "plugins/searchprofiler",
Expand Down
2 changes: 0 additions & 2 deletions x-pack/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import { security } from './legacy/plugins/security';
import { ml } from './legacy/plugins/ml';
import { tilemap } from './legacy/plugins/tilemap';
import { grokdebugger } from './legacy/plugins/grokdebugger';
import { painlessLab } from './legacy/plugins/painless_lab';
import { dashboardMode } from './legacy/plugins/dashboard_mode';
import { logstash } from './legacy/plugins/logstash';
import { beats } from './legacy/plugins/beats_management';
Expand Down Expand Up @@ -52,7 +51,6 @@ module.exports = function(kibana) {
ml(kibana),
tilemap(kibana),
grokdebugger(kibana),
painlessLab(kibana),
dashboardMode(kibana),
logstash(kibana),
beats(kibana),
Expand Down
32 changes: 0 additions & 32 deletions x-pack/legacy/plugins/painless_lab/index.ts

This file was deleted.

73 changes: 0 additions & 73 deletions x-pack/legacy/plugins/painless_lab/public/register.tsx

This file was deleted.

46 changes: 0 additions & 46 deletions x-pack/legacy/plugins/painless_lab/server/lib/check_license.ts

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

15 changes: 15 additions & 0 deletions x-pack/plugins/painless_lab/common/constants.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
import { LicenseType } from '../../licensing/common/types';

const basicLicense: LicenseType = 'basic';

export const PLUGIN = {
id: 'painlessLab',
minimumLicenseType: basicLicense,
};

export const API_BASE_PATH = '/api/painless_lab';
16 changes: 16 additions & 0 deletions x-pack/plugins/painless_lab/kibana.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"id": "painlessLab",
"version": "8.0.0",
"kibanaVersion": "kibana",
"requiredPlugins": [
"devTools",
"licensing",
"home"
],
"configPath": [
"xpack",
"painless_lab"
],
"server": true,
"ui": true
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,34 @@
*/

import React from 'react';
import { CoreStart } from 'kibana/public';
import { render, unmountComponentAtNode } from 'react-dom';
import { CoreSetup, CoreStart } from 'kibana/public';
import { Main } from './components/main';
import { createKibanaReactContext } from '../../../../../src/plugins/kibana_react/public';

export function renderApp(element: any, { http, i18n, uiSettings }: CoreStart) {
interface AppDependencies {
http: CoreSetup['http'];
I18nContext: CoreStart['i18n']['Context'];
uiSettings: CoreSetup['uiSettings'];
}

export function renderApp(
element: HTMLElement | null,
{ http, I18nContext, uiSettings }: AppDependencies
) {
if (!element) {
return () => undefined;
}

const { Provider: KibanaReactContextProvider } = createKibanaReactContext({
uiSettings,
});
render(
<i18n.Context>
<I18nContext>
<KibanaReactContextProvider>
<Main http={http} />
</KibanaReactContextProvider>
</i18n.Context>,
</I18nContext>,
element
);
return () => unmountComponentAtNode(element);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
* you may not use this file except in compliance with the Elastic License.
*/

import { API_ROUTE_EXECUTE } from '../../common/constants';
import { API_BASE_PATH } from '../../../common/constants';

export async function executeCode(http: any, payload: Record<string, any>) {
return await http.post(API_ROUTE_EXECUTE, {
return await http.post(`${API_BASE_PATH}/execute`, {
body: JSON.stringify(payload),
});
}
1 change: 1 addition & 0 deletions x-pack/plugins/painless_lab/public/index.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
@import 'styles/index'
13 changes: 13 additions & 0 deletions x-pack/plugins/painless_lab/public/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/

import './styles/_index.scss';
import { PluginInitializerContext } from 'src/core/public';
import { PainlessLabUIPlugin } from './plugin';

export function plugin(ctx: PluginInitializerContext) {
return new PainlessLabUIPlugin(ctx);
}
Loading