2020-01-28 02:10:34 +01:00
|
|
|
/*
|
|
|
|
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
|
|
* or more contributor license agreements. Licensed under the Elastic License;
|
|
|
|
* you may not use this file except in compliance with the Elastic License.
|
|
|
|
*/
|
2020-08-26 22:00:00 +02:00
|
|
|
|
2020-09-17 13:36:58 +02:00
|
|
|
import { BehaviorSubject } from 'rxjs';
|
2020-08-26 22:00:00 +02:00
|
|
|
import { i18n } from '@kbn/i18n';
|
2020-10-06 13:29:15 +02:00
|
|
|
import { DataPublicPluginSetup } from '../../../../src/plugins/data/public';
|
2020-06-08 09:07:35 +02:00
|
|
|
import {
|
|
|
|
AppMountParameters,
|
2020-09-17 13:36:58 +02:00
|
|
|
AppUpdater,
|
2020-06-08 09:07:35 +02:00
|
|
|
CoreSetup,
|
|
|
|
DEFAULT_APP_CATEGORIES,
|
|
|
|
Plugin as PluginClass,
|
|
|
|
PluginInitializerContext,
|
2020-07-14 16:32:28 +02:00
|
|
|
CoreStart,
|
2020-06-08 09:07:35 +02:00
|
|
|
} from '../../../../src/core/public';
|
2020-08-26 22:00:00 +02:00
|
|
|
import { HomePublicPluginSetup } from '../../../../src/plugins/home/public';
|
2020-06-25 17:19:38 +02:00
|
|
|
import { registerDataHandler } from './data_handler';
|
2020-07-14 16:32:28 +02:00
|
|
|
import { toggleOverviewLinkInNav } from './toggle_overview_link_in_nav';
|
2020-01-28 02:10:34 +01:00
|
|
|
|
2020-06-15 08:46:36 +02:00
|
|
|
export interface ObservabilityPluginSetup {
|
2020-06-25 17:19:38 +02:00
|
|
|
dashboard: { register: typeof registerDataHandler };
|
2020-06-15 08:46:36 +02:00
|
|
|
}
|
|
|
|
|
2020-09-23 15:44:40 +02:00
|
|
|
export interface ObservabilityPluginSetupDeps {
|
2020-08-26 22:00:00 +02:00
|
|
|
home?: HomePublicPluginSetup;
|
2020-10-06 13:29:15 +02:00
|
|
|
data: DataPublicPluginSetup;
|
2020-08-26 22:00:00 +02:00
|
|
|
}
|
|
|
|
|
2020-06-30 19:56:35 +02:00
|
|
|
export type ObservabilityPluginStart = void;
|
|
|
|
|
|
|
|
export class Plugin implements PluginClass<ObservabilityPluginSetup, ObservabilityPluginStart> {
|
2020-09-17 13:36:58 +02:00
|
|
|
private readonly appUpdater$ = new BehaviorSubject<AppUpdater>(() => ({}));
|
|
|
|
|
2020-01-28 02:10:34 +01:00
|
|
|
constructor(context: PluginInitializerContext) {}
|
2020-06-08 09:07:35 +02:00
|
|
|
|
2020-09-23 15:44:40 +02:00
|
|
|
public setup(core: CoreSetup, plugins: ObservabilityPluginSetupDeps) {
|
2020-06-08 09:07:35 +02:00
|
|
|
core.application.register({
|
|
|
|
id: 'observability-overview',
|
|
|
|
title: 'Overview',
|
|
|
|
order: 8000,
|
2020-09-14 21:32:30 +02:00
|
|
|
euiIconType: 'logoObservability',
|
2020-06-08 09:07:35 +02:00
|
|
|
appRoute: '/app/observability',
|
2020-09-17 13:36:58 +02:00
|
|
|
updater$: this.appUpdater$,
|
2020-06-08 09:07:35 +02:00
|
|
|
category: DEFAULT_APP_CATEGORIES.observability,
|
|
|
|
|
2020-06-15 08:46:36 +02:00
|
|
|
mount: async (params: AppMountParameters<unknown>) => {
|
2020-06-08 09:07:35 +02:00
|
|
|
// Load application bundle
|
|
|
|
const { renderApp } = await import('./application');
|
|
|
|
// Get start services
|
|
|
|
const [coreStart] = await core.getStartServices();
|
|
|
|
|
2020-09-23 15:44:40 +02:00
|
|
|
return renderApp(coreStart, plugins, params);
|
2020-06-08 09:07:35 +02:00
|
|
|
},
|
|
|
|
});
|
2020-06-15 08:46:36 +02:00
|
|
|
|
2020-08-26 22:00:00 +02:00
|
|
|
if (plugins.home) {
|
|
|
|
plugins.home.featureCatalogue.registerSolution({
|
|
|
|
id: 'observability',
|
|
|
|
title: i18n.translate('xpack.observability.featureCatalogueTitle', {
|
|
|
|
defaultMessage: 'Observability',
|
|
|
|
}),
|
|
|
|
subtitle: i18n.translate('xpack.observability.featureCatalogueSubtitle', {
|
|
|
|
defaultMessage: 'Centralize & monitor',
|
|
|
|
}),
|
2020-10-06 18:13:31 +02:00
|
|
|
description: i18n.translate('xpack.observability.featureCatalogueDescription', {
|
|
|
|
defaultMessage:
|
|
|
|
'Consolidate your logs, metrics, application traces, and system availability with purpose-built UIs.',
|
|
|
|
}),
|
|
|
|
appDescriptions: [
|
2020-08-26 22:00:00 +02:00
|
|
|
i18n.translate('xpack.observability.featureCatalogueDescription1', {
|
|
|
|
defaultMessage: 'Monitor infrastructure metrics.',
|
|
|
|
}),
|
|
|
|
i18n.translate('xpack.observability.featureCatalogueDescription2', {
|
|
|
|
defaultMessage: 'Trace application requests.',
|
|
|
|
}),
|
|
|
|
i18n.translate('xpack.observability.featureCatalogueDescription3', {
|
|
|
|
defaultMessage: 'Measure SLAs and react to issues.',
|
|
|
|
}),
|
|
|
|
],
|
|
|
|
icon: 'logoObservability',
|
2020-10-06 18:13:31 +02:00
|
|
|
path: '/app/observability/landing',
|
2020-08-26 22:00:00 +02:00
|
|
|
order: 200,
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2020-06-15 08:46:36 +02:00
|
|
|
return {
|
|
|
|
dashboard: { register: registerDataHandler },
|
|
|
|
};
|
2020-06-08 09:07:35 +02:00
|
|
|
}
|
2020-09-17 13:36:58 +02:00
|
|
|
public start({ application }: CoreStart) {
|
|
|
|
toggleOverviewLinkInNav(this.appUpdater$, application);
|
2020-07-14 16:32:28 +02:00
|
|
|
}
|
2020-01-28 02:10:34 +01:00
|
|
|
}
|