Skip to content
Merged
Changes from all 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
14 changes: 12 additions & 2 deletions x-pack/legacy/plugins/infra/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,13 @@ import { i18n } from '@kbn/i18n';
import JoiNamespace from 'joi';
import { resolve } from 'path';

import { getConfigSchema, initServerWithKibana, KbnServer } from './server/kibana.index';
import { getConfigSchema, initServerWithKibana } from './server/kibana.index';
import { savedObjectMappings } from './server/saved_objects';

const APP_ID = 'infra';
const logsSampleDataLinkLabel = i18n.translate('xpack.infra.sampleDataLinkLabel', {
defaultMessage: 'Logs',
});

export function infra(kibana: any) {
return new kibana.Plugin({
Expand Down Expand Up @@ -67,8 +70,15 @@ export function infra(kibana: any) {
config(Joi: typeof JoiNamespace) {
return getConfigSchema(Joi);
},
init(server: KbnServer) {
init(server: any) {
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This follows the same convention used in other plugins that call server.addAppLinksToSampleDataset

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So according to LegacyPluginOptions that function should have the signature of InitPluginFunction and server should be of type Server. APM's index.ts file seems to be close to the "right way". We can either fix this now by expanding the scope of your PR or fix it in a follow up PR. Either way, I think we should fix it so the typing works as expected.

See: https://github.com/elastic/kibana/blob/master/src/legacy/plugin_discovery/types.ts#L87

initServerWithKibana(server);
server.addAppLinksToSampleDataset('logs', [
{
path: `/app/${APP_ID}#/logs`,
label: logsSampleDataLinkLabel,
icon: 'loggingApp',
},
]);
},
});
}