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

[Logs UI] Add link from the sample web logs to the Logs UI #42635

Merged
merged 4 commits into from
Aug 12, 2019
Merged
Changes from 3 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
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
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',
},
]);
},
});
}