2020-02-03 18:29:59 +01:00
|
|
|
import { i18n } from '@kbn/i18n';
|
2020-08-21 03:50:36 +02:00
|
|
|
import { AppMountParameters, CoreSetup, CoreStart, Plugin } from '<%= importFromRoot('src/core/public') %>';
|
|
|
|
import { <%= upperCamelCase(name) %>PluginSetup, <%= upperCamelCase(name) %>PluginStart, AppPluginStartDependencies } from './types';
|
2020-02-03 18:29:59 +01:00
|
|
|
import { PLUGIN_NAME } from '../common';
|
|
|
|
|
2020-08-21 03:50:36 +02:00
|
|
|
export class <%= upperCamelCase(name) %>Plugin
|
|
|
|
implements Plugin<<%= upperCamelCase(name) %>PluginSetup, <%= upperCamelCase(name) %>PluginStart> {
|
|
|
|
|
|
|
|
public setup(core: CoreSetup): <%= upperCamelCase(name) %>PluginSetup {
|
2020-02-03 18:29:59 +01:00
|
|
|
// Register an application into the side navigation menu
|
|
|
|
core.application.register({
|
|
|
|
id: '<%= camelCase(name) %>',
|
|
|
|
title: PLUGIN_NAME,
|
|
|
|
async mount(params: AppMountParameters) {
|
|
|
|
// Load application bundle
|
|
|
|
const { renderApp } = await import('./application');
|
|
|
|
// Get start services as specified in kibana.json
|
|
|
|
const [coreStart, depsStart] = await core.getStartServices();
|
|
|
|
// Render the application
|
|
|
|
return renderApp(coreStart, depsStart as AppPluginStartDependencies, params);
|
|
|
|
},
|
|
|
|
});
|
|
|
|
|
|
|
|
// Return methods that should be available to other plugins
|
|
|
|
return {
|
|
|
|
getGreeting() {
|
|
|
|
return i18n.translate('<%= camelCase(name) %>.greetingText', {
|
|
|
|
defaultMessage: 'Hello from {name}!',
|
|
|
|
values: {
|
|
|
|
name: PLUGIN_NAME,
|
|
|
|
},
|
|
|
|
});
|
|
|
|
},
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2020-08-21 03:50:36 +02:00
|
|
|
public start(core: CoreStart): <%= upperCamelCase(name) %>PluginStart {
|
2020-02-03 18:29:59 +01:00
|
|
|
return {};
|
|
|
|
}
|
|
|
|
|
|
|
|
public stop() {}
|
|
|
|
}
|