Skip to content

Commit

Permalink
Bring console application in line with https://github.com/elastic/kib…
Browse files Browse the repository at this point in the history
…ana/blob/master/src/core/CONVENTIONS.md#applications

Change log from info level to debug level for console_extensions plugin
  • Loading branch information
jloleysens committed Jan 28, 2020
1 parent 485a462 commit 541ecf5
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 19 deletions.
12 changes: 9 additions & 3 deletions src/plugins/console/public/application/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
*/

import React from 'react';
import { render, unmountComponentAtNode } from 'react-dom';
import { NotificationsSetup } from 'src/core/public';
import { ServicesContextProvider, EditorContextProvider, RequestContextProvider } from './contexts';
import { Main } from './containers';
Expand All @@ -37,14 +38,16 @@ export interface BootDependencies {
notifications: NotificationsSetup;
elasticsearchUrl: string;
usageCollection?: UsageCollectionSetup;
element: HTMLElement;
}

export function boot({
export function renderApp({
I18nContext,
notifications,
docLinkVersion,
elasticsearchUrl,
usageCollection,
element,
}: BootDependencies) {
const trackUiMetric = createUsageTracker(usageCollection);
trackUiMetric.load('opened_app');
Expand All @@ -58,7 +61,7 @@ export function boot({
const objectStorageClient = localStorageObjectClient.create(storage);
settingsRef = settings;

return (
render(
<I18nContext>
<ServicesContextProvider
value={{
Expand All @@ -80,6 +83,9 @@ export function boot({
</EditorContextProvider>
</RequestContextProvider>
</ServicesContextProvider>
</I18nContext>
</I18nContext>,
element
);

return () => unmountComponentAtNode(element);
}
24 changes: 9 additions & 15 deletions src/plugins/console/public/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
* under the License.
*/

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

import { CoreSetup, CoreStart, Plugin } from 'kibana/public';
Expand Down Expand Up @@ -55,25 +54,20 @@ export class ConsoleUIPlugin implements Plugin<void, void, AppSetupUIPluginDepen
}),
enableRouting: false,
mount: async ({ core: { docLinks, i18n: i18nDep } }, { element }) => {
const { boot } = await import('./application');
const { renderApp } = await import('./application');
const [{ injectedMetadata }] = await getStartServices();
const elasticsearchUrl = injectedMetadata.getInjectedVar(
'elasticsearchUrl',
'http://localhost:9200'
) as string;
render(
boot({
docLinkVersion: docLinks.DOC_LINK_VERSION,
I18nContext: i18nDep.Context,
notifications,
elasticsearchUrl,
usageCollection,
}),
element
);
return () => {
unmountComponentAtNode(element);
};
return renderApp({
docLinkVersion: docLinks.DOC_LINK_VERSION,
I18nContext: i18nDep.Context,
notifications,
elasticsearchUrl,
usageCollection,
element,
});
},
});
}
Expand Down
2 changes: 1 addition & 1 deletion x-pack/plugins/console_extensions/server/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export class ConsoleExtensionsServerPlugin implements Plugin<void, void, SetupDe
) {
addExtensionSpecFilePath(join(__dirname, 'spec/'));
processors.forEach(processor => addProcessorDefinition(processor));
this.log.info('Installed console autocomplete extensions.');
this.log.debug('Installed console autocomplete extensions.');
}
start() {}
}

0 comments on commit 541ecf5

Please sign in to comment.