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

[Backport 2.x] [Enhancement] De-register reporting when MDS is enabled #412

Merged
merged 1 commit into from
Sep 3, 2024
Merged
Show file tree
Hide file tree
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
4 changes: 3 additions & 1 deletion opensearch_dashboards.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@
"opensearchDashboardsUtils"
],
"optionalPlugins": [
"share"
"share",
"dataSource",
"dataSourceManagement"
],
"server": true,
"ui": true,
Expand Down
77 changes: 44 additions & 33 deletions public/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,48 +10,59 @@ import {
CoreStart,
Plugin,
} from '../../../src/core/public';
import { DataSourcePluginSetup } from '../../../src/plugins/data_source/public';
import { PLUGIN_ID, PLUGIN_NAME } from '../common';
import './components/context_menu/context_menu';
import { applicationService } from './components/utils/application_service';
import { uiSettingsService } from './components/utils/settings_service';
import { registerAllPluginNavGroups } from './plugin_nav';
import {
AppPluginStartDependencies,
ReportsDashboardsPluginSetup,
ReportsDashboardsPluginStart,
AppPluginStartDependencies,
} from './types';
import './components/context_menu/context_menu';
import { PLUGIN_ID, PLUGIN_NAME } from '../common';
import { uiSettingsService } from './components/utils/settings_service';
import { applicationService } from './components/utils/application_service';
import { registerAllPluginNavGroups } from './plugin_nav';

export interface ReportingPluginSetupDependencies {
dataSource: DataSourcePluginSetup;
}

export class ReportsDashboardsPlugin
implements Plugin<ReportsDashboardsPluginSetup, ReportsDashboardsPluginStart> {
public setup(core: CoreSetup): ReportsDashboardsPluginSetup {
implements
Plugin<ReportsDashboardsPluginSetup, ReportsDashboardsPluginStart> {
public setup(
core: CoreSetup,
{ dataSource }: ReportingPluginSetupDependencies
): 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',
if (!dataSource) {
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,
},
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
);
},
});
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
);
},
});
}
registerAllPluginNavGroups(core);
// Return methods that should be available to other plugins
return {};
Expand All @@ -62,5 +73,5 @@ export class ReportsDashboardsPlugin
return {};
}

public stop() { }
public stop() {}
}
Loading