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

Shim dev tools #49349

Merged
merged 52 commits into from
Nov 14, 2019
Merged
Show file tree
Hide file tree
Changes from 49 commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
62f3164
centralize dependencies
flash1293 Oct 18, 2019
0bf00ae
move more stuff into kibana_services
flash1293 Oct 18, 2019
e72e51a
fix tests and dependency
flash1293 Oct 18, 2019
b42f417
bootstrap home via local application service
flash1293 Oct 19, 2019
0d2521e
fix routing for home app
flash1293 Oct 19, 2019
12fb70b
Merge remote-tracking branch 'upstream/master' into centralize-home
flash1293 Oct 21, 2019
af3ad7f
switch to dependency getter instead of direct exports
flash1293 Oct 21, 2019
a455322
Merge branch 'centralize-home' into local-application-service
flash1293 Oct 21, 2019
a1295d3
clean up
flash1293 Oct 21, 2019
082748a
add redirect functionality to local application service
flash1293 Oct 21, 2019
2bf3bf6
return early from route change handlers on dummy wrapper route
flash1293 Oct 21, 2019
398299c
fix jest tests
flash1293 Oct 21, 2019
822cdac
Merge remote-tracking branch 'upstream/master' into centralize-home
flash1293 Oct 22, 2019
4ea2e63
fix broken tests
flash1293 Oct 22, 2019
22c5588
Merge branch 'centralize-home' into local-application-service
flash1293 Oct 22, 2019
1bd6b3b
local application service
flash1293 Oct 22, 2019
c417060
fix mounting home several times
flash1293 Oct 22, 2019
48ecdf7
Merge branch 'master' into flash1293/local-application-service
elasticmachine Oct 24, 2019
2bc8856
started shimming dev tools and switching to new registry
flash1293 Oct 25, 2019
74fb184
Merge remote-tracking branch 'upstream/master' into flash1293/local-a…
flash1293 Oct 28, 2019
79a1a14
Merge branch 'flash1293/local-application-service' of github.com:flas…
flash1293 Oct 28, 2019
caa489a
Merge branch 'flash1293/local-application-service' into shim-dev_tools
flash1293 Oct 28, 2019
5195ebf
review fixes
flash1293 Oct 28, 2019
ebc5d96
move registry into new platform and honor ui capabilities
flash1293 Oct 28, 2019
cff57c2
document dev tools registry
flash1293 Oct 29, 2019
22ee254
Merge remote-tracking branch 'upstream/master' into shim-dev_tools
flash1293 Oct 30, 2019
6bc61a8
Merge remote-tracking branch 'upstream/master' into flash1293/local-a…
flash1293 Oct 30, 2019
a724d7b
review fixes
flash1293 Oct 30, 2019
5aedc62
decouple from home PR
flash1293 Oct 30, 2019
f7e3079
Merge branch 'flash1293/local-application-service' into shim-dev_tools
flash1293 Oct 30, 2019
23558e3
deangularize grokdebugger
flash1293 Oct 30, 2019
2717229
clean up grokdebugger and dev tools integration
flash1293 Oct 30, 2019
b455c15
Merge remote-tracking branch 'upstream/master' into shim-dev_tools
flash1293 Oct 31, 2019
fc08919
Merge remote-tracking branch 'upstream/master' into shim-dev_tools
flash1293 Nov 3, 2019
2c63955
Merge remote-tracking branch 'upstream/master' into shim-dev_tools
flash1293 Nov 3, 2019
6f2235c
finalize dev tools PR
flash1293 Nov 3, 2019
84b3e4b
add karma mock
flash1293 Nov 3, 2019
3f176f4
fix import
flash1293 Nov 4, 2019
8936fbb
Merge remote-tracking branch 'upstream/master' into shim-dev_tools
flash1293 Nov 4, 2019
0e6d46f
add data-test subj for dev toola
flash1293 Nov 4, 2019
e2a29ab
fix infra by avoiding route_setup import
flash1293 Nov 4, 2019
21ef98a
fix functional tests
flash1293 Nov 5, 2019
1aff48e
add todos
flash1293 Nov 5, 2019
1604156
move console feature registration to right place
flash1293 Nov 5, 2019
7ec64ba
fix translations
flash1293 Nov 5, 2019
2b26b78
Merge branch 'master' into shim-dev_tools
elasticmachine Nov 7, 2019
79a38a2
Merge remote-tracking branch 'upstream/master' into shim-dev_tools
flash1293 Nov 10, 2019
f93ceb0
do not render on redirect
flash1293 Nov 10, 2019
57e0197
Merge branch 'shim-dev_tools' of github.com:flash1293/kibana into shi…
flash1293 Nov 10, 2019
1d6faa6
Merge branch 'master' into shim-dev_tools
elasticmachine Nov 12, 2019
38498db
address review comments
flash1293 Nov 12, 2019
7017789
Merge branch 'master' into shim-dev_tools
elasticmachine Nov 13, 2019
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
3 changes: 0 additions & 3 deletions src/legacy/core_plugins/console/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ export default function(kibana: any) {
const npSrc = resolve(__dirname, 'np_ready/public');

let defaultVars: any;
const apps: any[] = [];
return new kibana.Plugin({
id: 'console',
require: ['elasticsearch'],
Expand Down Expand Up @@ -181,8 +180,6 @@ export default function(kibana: any) {
},

uiExports: {
apps,
hacks: ['plugins/console/quarantined/hacks/register'],
devTools: [`${npSrc}/legacy`],
styleSheetPaths: resolve(__dirname, 'public/quarantined/index.scss'),

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ export function Main() {
};

return (
<>
<div id="consoleRoot">
<EuiFlexGroup
className="consoleContainer"
gutterSize="none"
Expand Down Expand Up @@ -124,6 +124,6 @@ export function Main() {
{showSettings ? <Settings onClose={() => setShowSettings(false)} /> : null}

{showHelp ? <HelpPanel onClose={() => setShowHelp(false)} /> : null}
</>
</div>
);
}
69 changes: 10 additions & 59 deletions src/legacy/core_plugins/console/np_ready/public/legacy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,80 +24,31 @@ import 'brace/mode/json';
import 'brace/mode/text';

/* eslint-disable @kbn/eslint/no-restricted-paths */
import { toastNotifications as notifications } from 'ui/notify';
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/capabilities/route_setup';
/* eslint-enable @kbn/eslint/no-restricted-paths */

import template from '../../public/quarantined/index.html';
import { App, AppUnmount, NotificationsSetup } from '../../../../../core/public';

export interface XPluginSet {
devTools: DevToolsSetup;
feature_catalogue: FeatureCatalogueSetup;
__LEGACY: {
I18nContext: any;
ResizeChecker: any;
docLinkVersion: string;
};
}

import { plugin } from '.';
import { DevToolsSetup } from '../../../../../plugins/dev_tools/public';
import { FeatureCatalogueSetup } from '../../../../../plugins/feature_catalogue/public';

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<HTMLDivElement>('#consoleRoot');
if (!targetElement) {
const message = `Could not mount Console App!`;
npSetup.core.fatalErrors.add(message);
throw new Error(message);
}

let unmount: AppUnmount | Promise<AppUnmount>;

const mockedSetupCore = {
...npSetup.core,
notifications: (notifications as unknown) as NotificationsSetup,
application: {
register(app: App): void {
try {
unmount = 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);

$scope.$on('$destroy', async () => {
if (unmount) {
const fn = await unmount;
fn();
}
});
};
pluginInstance.setup(npSetup.core, {
...npSetup.plugins,
__LEGACY: {
I18nContext,
ResizeChecker,
},
template,
});
pluginInstance.start(npStart.core);
43 changes: 36 additions & 7 deletions src/legacy/core_plugins/console/np_ready/public/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,26 +18,55 @@
*/

import { render, unmountComponentAtNode } from 'react-dom';
import { i18n } from '@kbn/i18n';

import { FeatureCatalogueCategory } from 'ui/registry/feature_catalogue';
import { PluginInitializerContext, Plugin, CoreStart, CoreSetup } from '../../../../../core/public';
import { XPluginSet } from './legacy';
import { boot } from './application';

export class ConsoleUIPlugin implements Plugin<any, any> {
// @ts-ignore
constructor(private readonly ctx: PluginInitializerContext) {}

async setup({ application, notifications }: CoreSetup, pluginSet: XPluginSet) {
async setup({ notifications }: CoreSetup, pluginSet: XPluginSet) {
const {
__LEGACY: { docLinkVersion, I18nContext, ResizeChecker },
__LEGACY: { I18nContext, ResizeChecker },
devTools,
feature_catalogue,
} = pluginSet;

application.register({
feature_catalogue.register({
id: 'console',
title: i18n.translate('console.devToolsTitle', {
defaultMessage: 'Console',
}),
description: i18n.translate('console.devToolsDescription', {
defaultMessage: 'Skip cURL and use this JSON interface to work with your data directly.',
}),
icon: 'consoleApp',
path: '/app/kibana#/dev_tools/console',
showOnHomePage: true,
category: FeatureCatalogueCategory.ADMIN,
});

devTools.register({
id: 'console',
order: 1,
title: 'Console',
mount(ctx, { element }) {
render(boot({ docLinkVersion, I18nContext, ResizeChecker, notifications }), element);
title: i18n.translate('console.consoleDisplayName', {
defaultMessage: 'Console',
}),
enableRouting: false,
async mount(ctx, { element }) {
const { boot } = await import('./application');
render(
boot({
docLinkVersion: ctx.core.docLinks.DOC_LINK_VERSION,
I18nContext,
ResizeChecker,
notifications,
}),
element
);
return () => {
unmountComponentAtNode(element);
};
Expand Down
3 changes: 0 additions & 3 deletions src/legacy/core_plugins/console/public/quarantined/index.html

This file was deleted.

2 changes: 1 addition & 1 deletion src/legacy/core_plugins/kibana/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ export default function (kibana) {

uiExports: {
hacks: [
'plugins/kibana/dev_tools/hacks/hide_empty_tools',
'plugins/kibana/dev_tools',
],
fieldFormats: ['plugins/kibana/field_formats/register'],
savedObjectTypes: [
Expand Down
3 changes: 3 additions & 0 deletions src/legacy/core_plugins/kibana/public/dev_tools/_index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,6 @@
}
}

.devApp {
height: 100%;
}

This file was deleted.

This file was deleted.

This file was deleted.

Loading