diff --git a/src/plugins/data/common/index_patterns/index_patterns/index_patterns.ts b/src/plugins/data/common/index_patterns/index_patterns/index_patterns.ts index 688605821097..489ad154afa0 100644 --- a/src/plugins/data/common/index_patterns/index_patterns/index_patterns.ts +++ b/src/plugins/data/common/index_patterns/index_patterns/index_patterns.ts @@ -418,11 +418,7 @@ export class IndexPatternsService { ); if (!savedObject.version) { - throw new SavedObjectNotFound( - savedObjectType, - id, - 'management/opensearch-dashboards/indexPatterns' - ); + throw new SavedObjectNotFound(savedObjectType, id, 'indexPatterns'); } const spec = this.savedObjectToSpec(savedObject); diff --git a/src/plugins/data/public/index_patterns/index_patterns/redirect_no_index_pattern.tsx b/src/plugins/data/public/index_patterns/index_patterns/redirect_no_index_pattern.tsx index b09bc8adde6f..1a43ab22aaae 100644 --- a/src/plugins/data/public/index_patterns/index_patterns/redirect_no_index_pattern.tsx +++ b/src/plugins/data/public/index_patterns/index_patterns/redirect_no_index_pattern.tsx @@ -42,9 +42,7 @@ export const onRedirectNoIndexPattern = ( overlays: CoreStart['overlays'] ) => () => { const canManageIndexPatterns = capabilities.management.opensearchDashboards.indexPatterns; - const redirectTarget = canManageIndexPatterns - ? '/management/opensearch-dashboards/indexPatterns' - : '/home'; + const redirectTarget = canManageIndexPatterns ? '/indexPatterns' : '/home'; let timeoutId: NodeJS.Timeout | undefined; if (timeoutId) { @@ -72,8 +70,8 @@ export const onRedirectNoIndexPattern = ( if (redirectTarget === '/home') { navigateToApp('home'); } else { - navigateToApp('management', { - path: `/opensearch-dashboards/indexPatterns?bannerMessage=${bannerMessage}`, + navigateToApp('indexPatterns', { + path: `?bannerMessage=${bannerMessage}`, }); } diff --git a/src/plugins/data/public/search/errors/painless_error.tsx b/src/plugins/data/public/search/errors/painless_error.tsx index 1522dcf97cb0..ee11d77b98f5 100644 --- a/src/plugins/data/public/search/errors/painless_error.tsx +++ b/src/plugins/data/public/search/errors/painless_error.tsx @@ -53,9 +53,7 @@ export class PainlessError extends OsdError { public getErrorMessage(application: ApplicationStart) { function onClick() { - application.navigateToApp('management', { - path: `/opensearch-dashboards/indexPatterns`, - }); + application.navigateToApp('indexPatterns'); } return ( diff --git a/src/plugins/data/server/saved_objects/index_patterns.ts b/src/plugins/data/server/saved_objects/index_patterns.ts index 5f0864bac926..391adf6a973f 100644 --- a/src/plugins/data/server/saved_objects/index_patterns.ts +++ b/src/plugins/data/server/saved_objects/index_patterns.ts @@ -43,15 +43,11 @@ export const indexPatternSavedObjectType: SavedObjectsType = { return obj.attributes.title; }, getEditUrl(obj) { - return `/management/opensearch-dashboards/indexPatterns/patterns/${encodeURIComponent( - obj.id - )}`; + return `/indexPatterns/patterns/${encodeURIComponent(obj.id)}`; }, getInAppUrl(obj) { return { - path: `/app/management/opensearch-dashboards/indexPatterns/patterns/${encodeURIComponent( - obj.id - )}`, + path: `/app/indexPatterns/patterns/${encodeURIComponent(obj.id)}`, uiCapabilitiesPath: 'management.opensearchDashboards.indexPatterns', }; }, diff --git a/src/plugins/index_pattern_management/public/management_app/mount_management_section.tsx b/src/plugins/index_pattern_management/public/management_app/mount_management_section.tsx index 162d1d0876c6..b6bad8b31204 100644 --- a/src/plugins/index_pattern_management/public/management_app/mount_management_section.tsx +++ b/src/plugins/index_pattern_management/public/management_app/mount_management_section.tsx @@ -36,6 +36,7 @@ import { i18n } from '@osd/i18n'; import { I18nProvider } from '@osd/i18n/react'; import { StartServicesAccessor } from 'src/core/public'; +import { EuiPage, EuiPageBody } from '@elastic/eui'; import { OpenSearchDashboardsContextProvider } from '../../../opensearch_dashboards_react/public'; import { ManagementAppMountParams } from '../../../management/public'; import { @@ -90,26 +91,34 @@ export async function mountManagementSection( dataSourceEnabled, }; + const router = ( + + + + + + + + + + + + + + + + + ); + + const content = ( + + {router} + + ); + ReactDOM.render( - - - - - - - - - - - - - - - - - - + {content} , params.element ); diff --git a/src/plugins/index_pattern_management/public/plugin.ts b/src/plugins/index_pattern_management/public/plugin.ts index cf68e043b76c..cdac2c9d982d 100644 --- a/src/plugins/index_pattern_management/public/plugin.ts +++ b/src/plugins/index_pattern_management/public/plugin.ts @@ -29,7 +29,15 @@ */ import { i18n } from '@osd/i18n'; -import { PluginInitializerContext, CoreSetup, CoreStart, Plugin } from 'src/core/public'; +import { + PluginInitializerContext, + CoreSetup, + CoreStart, + Plugin, + AppMountParameters, + ChromeBreadcrumb, + ScopedHistory, +} from 'src/core/public'; import { DataPublicPluginStart } from 'src/plugins/data/public'; import { DataSourcePluginStart } from 'src/plugins/data_source/public'; import { UrlForwardingSetup } from '../../url_forwarding/public'; @@ -39,7 +47,9 @@ import { IndexPatternManagementServiceStart, } from './service'; -import { ManagementSetup } from '../../management/public'; +import { ManagementAppMountParams, ManagementSetup } from '../../management/public'; +import { DEFAULT_APP_CATEGORIES } from '../../../core/public'; +import { reactRouterNavigate } from '../../opensearch_dashboards_react/public'; export interface IndexPatternManagementSetupDependencies { management: ManagementSetup; @@ -83,7 +93,7 @@ export class IndexPatternManagementPlugin throw new Error('`opensearchDashboards` management section not found.'); } - const newAppPath = `management/opensearch-dashboards/${IPM_APP_ID}`; + const newAppPath = IPM_APP_ID; const legacyPatternsPath = 'management/opensearch-dashboards/index_patterns'; urlForwarding.forwardApp( @@ -96,14 +106,39 @@ export class IndexPatternManagementPlugin return pathInApp && `/patterns${pathInApp}`; }); - opensearchDashboardsSection.registerApp({ + // register it under Library + core.application.register({ id: IPM_APP_ID, title: sectionsHeader, - order: 0, - mount: async (params) => { + order: 8100, + category: DEFAULT_APP_CATEGORIES.opensearchDashboards, + mount: async (params: AppMountParameters) => { const { mountManagementSection } = await import('./management_app'); - return mountManagementSection(core.getStartServices, params, () => + 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.getStartServices, managementParams, () => this.indexPatternManagementService.environmentService.getEnvironment().ml() ); }, diff --git a/src/plugins/opensearch_dashboards_overview/public/components/getting_started/__snapshots__/getting_started.test.tsx.snap b/src/plugins/opensearch_dashboards_overview/public/components/getting_started/__snapshots__/getting_started.test.tsx.snap index 9df3bb12caec..db7484e21379 100644 --- a/src/plugins/opensearch_dashboards_overview/public/components/getting_started/__snapshots__/getting_started.test.tsx.snap +++ b/src/plugins/opensearch_dashboards_overview/public/components/getting_started/__snapshots__/getting_started.test.tsx.snap @@ -171,7 +171,7 @@ exports[`GettingStarted dark mode on 1`] = ` = ({ addBasePath, isDarkTheme, apps }) => - + { meta: { title: 'MyIndexPattern*', icon: 'indexPatternApp', - editUrl: '#/management/opensearch-dashboards/indexPatterns/patterns/1', + editUrl: '#/indexPatterns/patterns/1', inAppUrl: { - path: '/management/opensearch-dashboards/indexPatterns/patterns/1', + path: '/indexPatterns/patterns/1', uiCapabilitiesPath: 'management.opensearchDashboards.indexPatterns', }, }, @@ -120,10 +120,10 @@ describe('Relationships', () => { id: '1', relationship: 'child', meta: { - editUrl: '/management/opensearch-dashboards/indexPatterns/patterns/1', + editUrl: '/indexPatterns/patterns/1', icon: 'indexPatternApp', inAppUrl: { - path: '/app/management/opensearch-dashboards/indexPatterns/patterns/1', + path: '/app/indexPatterns/patterns/1', uiCapabilitiesPath: 'management.opensearchDashboards.indexPatterns', }, title: 'My Index Pattern', diff --git a/src/plugins/saved_objects_management/public/management_section/objects_table/components/table.test.tsx b/src/plugins/saved_objects_management/public/management_section/objects_table/components/table.test.tsx index 7e5bb318f4d0..c8e378b93b92 100644 --- a/src/plugins/saved_objects_management/public/management_section/objects_table/components/table.test.tsx +++ b/src/plugins/saved_objects_management/public/management_section/objects_table/components/table.test.tsx @@ -51,9 +51,9 @@ const defaultProps: TableProps = { meta: { title: `MyIndexPattern*`, icon: 'indexPatternApp', - editUrl: '#/management/opensearch-dashboards/indexPatterns/patterns/1', + editUrl: '#/indexPatterns/patterns/1', inAppUrl: { - path: '/management/opensearch-dashboards/indexPatterns/patterns/1', + path: '/indexPatterns/patterns/1', uiCapabilitiesPath: 'management.opensearchDashboards.indexPatterns', }, }, @@ -91,9 +91,9 @@ const defaultProps: TableProps = { meta: { title: `MyIndexPattern*`, icon: 'indexPatternApp', - editUrl: '#/management/opensearch-dashboards/indexPatterns/patterns/1', + editUrl: '#/indexPatterns/patterns/1', inAppUrl: { - path: '/management/opensearch-dashboards/indexPatterns/patterns/1', + path: '/indexPatterns/patterns/1', uiCapabilitiesPath: 'management.opensearchDashboards.indexPatterns', }, }, diff --git a/src/plugins/saved_objects_management/public/management_section/objects_table/saved_objects_table.test.tsx b/src/plugins/saved_objects_management/public/management_section/objects_table/saved_objects_table.test.tsx index 5a6bf0713d95..38dc9f182359 100644 --- a/src/plugins/saved_objects_management/public/management_section/objects_table/saved_objects_table.test.tsx +++ b/src/plugins/saved_objects_management/public/management_section/objects_table/saved_objects_table.test.tsx @@ -172,9 +172,9 @@ describe('SavedObjectsTable', () => { meta: { title: `MyIndexPattern*`, icon: 'indexPatternApp', - editUrl: '#/management/opensearch-dashboards/indexPatterns/patterns/1', + editUrl: '#/indexPatterns/patterns/1', inAppUrl: { - path: '/management/opensearch-dashboards/indexPatterns/patterns/1', + path: '/indexPatterns/patterns/1', uiCapabilitiesPath: 'management.opensearchDashboards.indexPatterns', }, }, diff --git a/src/plugins/saved_objects_management/public/management_section/objects_table/saved_objects_table.tsx b/src/plugins/saved_objects_management/public/management_section/objects_table/saved_objects_table.tsx index 2f78f307d165..2a7947dbf3ee 100644 --- a/src/plugins/saved_objects_management/public/management_section/objects_table/saved_objects_table.tsx +++ b/src/plugins/saved_objects_management/public/management_section/objects_table/saved_objects_table.tsx @@ -543,9 +543,7 @@ export class SavedObjectsTable extends Component