Skip to content

Commit

Permalink
fix: update path
Browse files Browse the repository at this point in the history
Signed-off-by: tygao <tygao@amazon.com>
  • Loading branch information
raintygao committed Sep 12, 2023
1 parent 9fd67b5 commit 96f74a9
Showing 1 changed file with 38 additions and 7 deletions.
45 changes: 38 additions & 7 deletions src/plugins/saved_objects_management/public/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,17 @@
*/

import { i18n } from '@osd/i18n';
import { AppMountParameters, CoreSetup, CoreStart, Plugin } from 'src/core/public';
import {
AppMountParameters,
CoreSetup,
CoreStart,
Plugin,
ChromeBreadcrumb,
ScopedHistory,
} from 'src/core/public';

import { VisBuilderStart } from '../../vis_builder/public';
import { ManagementSetup } from '../../management/public';
import { ManagementSetup, ManagementAppMountParams } from '../../management/public';
import { UiActionsSetup, UiActionsStart } from '../../ui_actions/public';
import { DataPublicPluginStart } from '../../data/public';
import { DashboardStart } from '../../dashboard/public';
Expand Down Expand Up @@ -61,9 +68,11 @@ import {
SAVED_OBJECT_MANAGEMENT_TITLE_WORDINGS,
ALL_LIBRARY_OBJECTS_TITLE_WORDINGS,
ALL_LIBRARY_OBJECTS_WORDINGS,
SAVED_OBJECT_MANAGEMENT_TITLE_WORDINGS,
SAVED_QUERIES_WORDINGS,
SAVED_SEARCHES_WORDINGS,
} from './constants';
import { reactRouterNavigate } from '../../opensearch_dashboards_react/public';

export interface SavedObjectsManagementPluginSetup {
actions: SavedObjectsManagementActionServiceSetup;
Expand Down Expand Up @@ -195,19 +204,41 @@ export class SavedObjectsManagementPlugin
});
}

const opensearchDashboardsSection = management.sections.section.opensearchDashboards;
opensearchDashboardsSection.registerApp({
core.application.register({
id: 'objects',
title: i18n.translate('savedObjectsManagement.managementSectionLabel', {
defaultMessage: 'Saved objects',
}),
order: 1,
mount: async (mountParams) => {
category: DEFAULT_APP_CATEGORIES.opensearchDashboards,
mount: async (params: AppMountParameters) => {
const { mountManagementSection } = await import('./management_section');
const [coreStart] = await core.getStartServices();

const setBreadcrumbsScope = (
crumbs: ChromeBreadcrumb[] = [],
appHistory?: ScopedHistory
) => {
const wrapBreadcrumb = (item: ChromeBreadcrumb, scopedHistory: ScopedHistory) => ({
...item,
...(item.href ? reactRouterNavigate(scopedHistory, item.href) : {}),
});

coreStart.chrome.setBreadcrumbs([
...crumbs.map((item) => wrapBreadcrumb(item, appHistory || params.history)),
]);
};

const managementParams: ManagementAppMountParams = {
element: params.element,
history: params.history,
setBreadcrumbs: setBreadcrumbsScope,
basePath: params.appBasePath,
};

return mountManagementSection({
core,
serviceRegistry: this.serviceRegistry,
mountParams,
mountParams: managementParams,
title: SAVED_OBJECT_MANAGEMENT_TITLE_WORDINGS,
});
},
Expand Down

0 comments on commit 96f74a9

Please sign in to comment.