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 8, 2023
1 parent e3230b0 commit b6e17dd
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ export function OpenSearchPanel(props) {
fill
onClick={props.onClose}
href={addBasePath(
`/app/settings/objects?_a=${rison.encode({
`/app/objects?_a=${rison.encode({
tab: SEARCH_OBJECT_TYPE,
})}`
)}
Expand Down
55 changes: 52 additions & 3 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 All @@ -59,9 +66,11 @@ import { DEFAULT_APP_CATEGORIES } from '../../../core/public';
import {
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 @@ -187,12 +196,52 @@ export class SavedObjectsManagementPlugin
'Import, export, and manage your saved searches, visualizations, and dashboards.',
}),
icon: 'savedObjectsApp',
path: '/app/objects',
path: 'app/objects',
showOnHomePage: false,
category: FeatureCatalogueCategory.ADMIN,
});
}

core.application.register({
id: 'objects',
title: i18n.translate('savedObjectsManagement.managementSectionLabel', {
defaultMessage: 'Saved objects',
}),
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: managementParams,
title: SAVED_OBJECT_MANAGEMENT_TITLE_WORDINGS,
});
},
});

// sets up the context mappings and registers any triggers/actions for the plugin
bootstrap(uiActions);

Expand Down

0 comments on commit b6e17dd

Please sign in to comment.