forked from opensearch-project/dashboards-reporting
-
Notifications
You must be signed in to change notification settings - Fork 0
/
plugin.ts
64 lines (59 loc) · 1.81 KB
/
plugin.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
/*
* Copyright OpenSearch Contributors
* SPDX-License-Identifier: Apache-2.0
*/
import {
AppMountParameters,
CoreSetup,
CoreStart,
Plugin,
} from '../../../src/core/public';
import {
ReportsDashboardsPluginSetup,
ReportsDashboardsPluginStart,
AppPluginStartDependencies,
} from './types';
import { i18n } from '@osd/i18n';
import './components/context_menu/context_menu';
import { PLUGIN_ID, PLUGIN_NAME } from '../common';
import { uiSettingsService } from './components/utils/settings_service';
export class ReportsDashboardsPlugin
implements Plugin<ReportsDashboardsPluginSetup, ReportsDashboardsPluginStart>
{
public setup(core: CoreSetup): ReportsDashboardsPluginSetup {
uiSettingsService.init(core.uiSettings, core.http);
// Register an application into the side navigation menu
core.application.register({
id: PLUGIN_ID,
title: i18n.translate('opensearch.reports.pluginName', {
defaultMessage: PLUGIN_NAME,
}),
category: {
id: 'opensearch',
label: i18n.translate('opensearch.reports.categoryName', {
defaultMessage: 'OpenSearch Plugins',
}),
order: 2000,
},
order: 2000,
async mount(params: AppMountParameters) {
// Load application bundle
const { renderApp } = await import('./application');
// Get start services as specified in opensearch_dashboards.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 {};
}
public start(core: CoreStart): ReportsDashboardsPluginStart {
return {};
}
public stop() {}
}