From 60b517a6079d036be0bcdd05e9fd76920280ddc7 Mon Sep 17 00:00:00 2001 From: saarikabhasi Date: Fri, 24 Jan 2025 14:30:25 -0500 Subject: [PATCH 01/38] update index management breadcrumb check extensionService value in index_list --- .../shared/management/public/plugin.tsx | 15 +++++++++-- .../sections/home/index_list/index_list.tsx | 7 +++++- .../application/services/breadcrumbs.ts | 25 +++++++++++++++++-- 3 files changed, 42 insertions(+), 5 deletions(-) diff --git a/src/platform/plugins/shared/management/public/plugin.tsx b/src/platform/plugins/shared/management/public/plugin.tsx index 97778792316ea..86df814b20676 100644 --- a/src/platform/plugins/shared/management/public/plugin.tsx +++ b/src/platform/plugins/shared/management/public/plugin.tsx @@ -131,9 +131,20 @@ export class ManagementPlugin const [, ...trailingBreadcrumbs] = newBreadcrumbs; deps.serverless.setBreadcrumbs(trailingBreadcrumbs); } else { - coreStart.chrome.setBreadcrumbs(newBreadcrumbs, { - project: { value: newBreadcrumbs, absolute: true }, + coreStart.chrome.getActiveSolutionNavId$().subscribe((activeSolutionId) => { + if (activeSolutionId === 'es') { + const [, ...trailingBreadcrumbs] = newBreadcrumbs; + coreStart.chrome.setBreadcrumbs(trailingBreadcrumbs, { + project: { value: trailingBreadcrumbs, absolute: true }, + }); + } else { + coreStart.chrome.setBreadcrumbs(newBreadcrumbs, { + project: { value: newBreadcrumbs, absolute: true }, + }); + } }); + + // coreStart.chrome.setBreadcrumbs(trailingBreadcrumbs); } }, isSidebarEnabled$: managementPlugin.isSidebarEnabled$, diff --git a/x-pack/platform/plugins/shared/index_management/public/application/sections/home/index_list/index_list.tsx b/x-pack/platform/plugins/shared/index_management/public/application/sections/home/index_list/index_list.tsx index 4969a51d857a4..e1f985ac1b3c0 100644 --- a/x-pack/platform/plugins/shared/index_management/public/application/sections/home/index_list/index_list.tsx +++ b/x-pack/platform/plugins/shared/index_management/public/application/sections/home/index_list/index_list.tsx @@ -17,6 +17,7 @@ import { IndexTable } from './index_table'; export const IndexList: React.FunctionComponent = ({ history }) => { const { core: { executionContext }, + services: { extensionsService }, } = useAppContext(); useExecutionContext(executionContext, { @@ -25,7 +26,11 @@ export const IndexList: React.FunctionComponent = ({ histor }); useEffect(() => { - breadcrumbService.setBreadcrumbs(IndexManagementBreadcrumb.indices); + if (!extensionsService.indexDetailsPageRoute) { + breadcrumbService.setBreadcrumbs(IndexManagementBreadcrumb.indices); + } else { + breadcrumbService.setBreadcrumbs(IndexManagementBreadcrumb.indexList); + } }, []); return ( diff --git a/x-pack/platform/plugins/shared/index_management/public/application/services/breadcrumbs.ts b/x-pack/platform/plugins/shared/index_management/public/application/services/breadcrumbs.ts index 3b91a447f89da..dd04e5428640c 100644 --- a/x-pack/platform/plugins/shared/index_management/public/application/services/breadcrumbs.ts +++ b/x-pack/platform/plugins/shared/index_management/public/application/services/breadcrumbs.ts @@ -44,6 +44,10 @@ export enum IndexManagementBreadcrumb { */ enrichPolicies = 'enrichPolicies', enrichPoliciesCreate = 'enrichPoliciesCreate', + + content = 'content', + indexList ='indexList' + } class BreadcrumbService { @@ -56,7 +60,14 @@ class BreadcrumbService { public setup(setBreadcrumbsHandler: SetBreadcrumbs): void { this.setBreadcrumbsHandler = setBreadcrumbsHandler; - + this.breadcrumbs.content = [ + { + text: i18n.translate('xpack.idxMgmt.breadcrumb.contentLabel', { + defaultMessage: 'Content', + }), + href: ``, + }, + ]; this.breadcrumbs.home = [ { text: i18n.translate('xpack.idxMgmt.breadcrumb.homeLabel', { @@ -194,6 +205,16 @@ class BreadcrumbService { href: `/enrich_policies/create`, }, ]; + this.breadcrumbs.indexList = [ + ...this.breadcrumbs.content, + ...this.breadcrumbs.home, + { + text: i18n.translate('xpack.idxMgmt.breadcrumb.indicesLabel', { + defaultMessage: 'Indices List', + }), + href: `/indices`, + }, + ]; } public setBreadcrumbs( @@ -203,7 +224,7 @@ class BreadcrumbService { if (!this.setBreadcrumbsHandler) { throw new Error(`BreadcrumbService#setup() must be called first!`); } - + console.log("type", type) const newBreadcrumbs = this.breadcrumbs[type] ? [...this.breadcrumbs[type]!] : [...this.breadcrumbs.home!]; From 858d4d52cfc0f3d12270b564b670d38ab1a42f33 Mon Sep 17 00:00:00 2001 From: saarikabhasi Date: Tue, 28 Jan 2025 16:43:19 -0500 Subject: [PATCH 02/38] add index name for stack solution nav --- .../sections/home/index_list/index_list.tsx | 2 +- .../public/application/services/breadcrumbs.ts | 12 ++++++------ .../public/application/services/routing.ts | 2 ++ 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/x-pack/platform/plugins/shared/index_management/public/application/sections/home/index_list/index_list.tsx b/x-pack/platform/plugins/shared/index_management/public/application/sections/home/index_list/index_list.tsx index e1f985ac1b3c0..d50bffe832db7 100644 --- a/x-pack/platform/plugins/shared/index_management/public/application/sections/home/index_list/index_list.tsx +++ b/x-pack/platform/plugins/shared/index_management/public/application/sections/home/index_list/index_list.tsx @@ -29,7 +29,7 @@ export const IndexList: React.FunctionComponent = ({ histor if (!extensionsService.indexDetailsPageRoute) { breadcrumbService.setBreadcrumbs(IndexManagementBreadcrumb.indices); } else { - breadcrumbService.setBreadcrumbs(IndexManagementBreadcrumb.indexList); + breadcrumbService.setBreadcrumbs(IndexManagementBreadcrumb.indicesList); } }, []); diff --git a/x-pack/platform/plugins/shared/index_management/public/application/services/breadcrumbs.ts b/x-pack/platform/plugins/shared/index_management/public/application/services/breadcrumbs.ts index dd04e5428640c..0d98bad4f62b0 100644 --- a/x-pack/platform/plugins/shared/index_management/public/application/services/breadcrumbs.ts +++ b/x-pack/platform/plugins/shared/index_management/public/application/services/breadcrumbs.ts @@ -46,7 +46,7 @@ export enum IndexManagementBreadcrumb { enrichPoliciesCreate = 'enrichPoliciesCreate', content = 'content', - indexList ='indexList' + indicesList ='indicesList' } @@ -205,12 +205,12 @@ class BreadcrumbService { href: `/enrich_policies/create`, }, ]; - this.breadcrumbs.indexList = [ + this.breadcrumbs.indicesList = [ ...this.breadcrumbs.content, ...this.breadcrumbs.home, { - text: i18n.translate('xpack.idxMgmt.breadcrumb.indicesLabel', { - defaultMessage: 'Indices List', + text: i18n.translate('xpack.idxMgmt.breadcrumb.indicesListLabel', { + defaultMessage: 'Indices', }), href: `/indices`, }, @@ -224,13 +224,13 @@ class BreadcrumbService { if (!this.setBreadcrumbsHandler) { throw new Error(`BreadcrumbService#setup() must be called first!`); } - console.log("type", type) + const newBreadcrumbs = this.breadcrumbs[type] ? [...this.breadcrumbs[type]!] : [...this.breadcrumbs.home!]; if (additionalBreadcrumb) { - newBreadcrumbs.push(additionalBreadcrumb); + newBreadcrumbs.push(additionalBreadcrumb) } // Pop off last breadcrumb diff --git a/x-pack/platform/plugins/shared/index_management/public/application/services/routing.ts b/x-pack/platform/plugins/shared/index_management/public/application/services/routing.ts index 89143bbd79d02..8023242bd0719 100644 --- a/x-pack/platform/plugins/shared/index_management/public/application/services/routing.ts +++ b/x-pack/platform/plugins/shared/index_management/public/application/services/routing.ts @@ -11,6 +11,7 @@ import { Section } from '../../../common/constants'; import type { IndexDetailsTabId } from '../../../common/constants'; import { ExtensionsService } from '../../services/extensions_service'; import { IndexDetailsSection } from '../../../common/constants'; +import { breadcrumbService, IndexManagementBreadcrumb } from '../../application/services/breadcrumbs'; export const getTemplateListLink = () => `/templates`; @@ -108,5 +109,6 @@ export const navigateToIndexDetailsPage = ( } else { const route = extensionsService.indexDetailsPageRoute.renderRoute(indexName, tabId); application.navigateToUrl(http.basePath.prepend(route)); + breadcrumbService.setBreadcrumbs(IndexManagementBreadcrumb.indicesList, [ {text: indexName}]); } }; From 2ce55e32cf08f75db1afae6ae23962a0f7d8a6ee Mon Sep 17 00:00:00 2001 From: saarikabhasi Date: Fri, 31 Jan 2025 18:12:46 -0500 Subject: [PATCH 03/38] fix serverless version breadcrumb --- .../sections/home/index_list/index_list.tsx | 16 +++++++++++----- .../public/application/services/breadcrumbs.ts | 2 +- .../public/application/services/routing.ts | 3 ++- 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/x-pack/platform/plugins/shared/index_management/public/application/sections/home/index_list/index_list.tsx b/x-pack/platform/plugins/shared/index_management/public/application/sections/home/index_list/index_list.tsx index d50bffe832db7..00abfeb3ab65b 100644 --- a/x-pack/platform/plugins/shared/index_management/public/application/sections/home/index_list/index_list.tsx +++ b/x-pack/platform/plugins/shared/index_management/public/application/sections/home/index_list/index_list.tsx @@ -13,25 +13,31 @@ import { APP_WRAPPER_CLASS, useExecutionContext } from '../../../../shared_impor import { breadcrumbService, IndexManagementBreadcrumb } from '../../../services/breadcrumbs'; import { useAppContext } from '../../../app_context'; import { IndexTable } from './index_table'; +import useObservable from 'react-use/lib/useObservable'; export const IndexList: React.FunctionComponent = ({ history }) => { const { - core: { executionContext }, + core: { executionContext, chrome }, services: { extensionsService }, + plugins: { cloud }, } = useAppContext(); useExecutionContext(executionContext, { type: 'application', page: 'indexManagementIndicesTab', }); - + const activeSolutionId = useObservable(chrome.getActiveSolutionNavId$()); useEffect(() => { - if (!extensionsService.indexDetailsPageRoute) { + if (cloud?.isServerlessEnabled) { breadcrumbService.setBreadcrumbs(IndexManagementBreadcrumb.indices); } else { - breadcrumbService.setBreadcrumbs(IndexManagementBreadcrumb.indicesList); + if (activeSolutionId === 'es') { + breadcrumbService.setBreadcrumbs(IndexManagementBreadcrumb.indicesList); + } else { + breadcrumbService.setBreadcrumbs(IndexManagementBreadcrumb.indices); + } } - }, []); + }, [activeSolutionId, cloud]); return (
diff --git a/x-pack/platform/plugins/shared/index_management/public/application/services/breadcrumbs.ts b/x-pack/platform/plugins/shared/index_management/public/application/services/breadcrumbs.ts index 0d98bad4f62b0..06f59a2da3d6c 100644 --- a/x-pack/platform/plugins/shared/index_management/public/application/services/breadcrumbs.ts +++ b/x-pack/platform/plugins/shared/index_management/public/application/services/breadcrumbs.ts @@ -230,7 +230,7 @@ class BreadcrumbService { : [...this.breadcrumbs.home!]; if (additionalBreadcrumb) { - newBreadcrumbs.push(additionalBreadcrumb) + newBreadcrumbs.push(additionalBreadcrumb); } // Pop off last breadcrumb diff --git a/x-pack/platform/plugins/shared/index_management/public/application/services/routing.ts b/x-pack/platform/plugins/shared/index_management/public/application/services/routing.ts index 8023242bd0719..688f4f4b9a004 100644 --- a/x-pack/platform/plugins/shared/index_management/public/application/services/routing.ts +++ b/x-pack/platform/plugins/shared/index_management/public/application/services/routing.ts @@ -109,6 +109,7 @@ export const navigateToIndexDetailsPage = ( } else { const route = extensionsService.indexDetailsPageRoute.renderRoute(indexName, tabId); application.navigateToUrl(http.basePath.prepend(route)); - breadcrumbService.setBreadcrumbs(IndexManagementBreadcrumb.indicesList, [ {text: indexName}]); + console.log("indexName", indexName) + breadcrumbService.setBreadcrumbs(IndexManagementBreadcrumb.indicesList, { text: indexName }); } }; From e47735c5d3d1f1f378c938e8b298bd68bc22910c Mon Sep 17 00:00:00 2001 From: saarikabhasi Date: Fri, 31 Jan 2025 18:14:08 -0500 Subject: [PATCH 04/38] clean up fix linting --- src/platform/plugins/shared/management/public/plugin.tsx | 2 -- .../public/application/sections/home/index_list/index_list.tsx | 2 +- .../public/application/services/breadcrumbs.ts | 3 +-- .../index_management/public/application/services/routing.ts | 3 +-- 4 files changed, 3 insertions(+), 7 deletions(-) diff --git a/src/platform/plugins/shared/management/public/plugin.tsx b/src/platform/plugins/shared/management/public/plugin.tsx index 86df814b20676..b1ea4a8db8653 100644 --- a/src/platform/plugins/shared/management/public/plugin.tsx +++ b/src/platform/plugins/shared/management/public/plugin.tsx @@ -143,8 +143,6 @@ export class ManagementPlugin }); } }); - - // coreStart.chrome.setBreadcrumbs(trailingBreadcrumbs); } }, isSidebarEnabled$: managementPlugin.isSidebarEnabled$, diff --git a/x-pack/platform/plugins/shared/index_management/public/application/sections/home/index_list/index_list.tsx b/x-pack/platform/plugins/shared/index_management/public/application/sections/home/index_list/index_list.tsx index 00abfeb3ab65b..8385b7dd32c91 100644 --- a/x-pack/platform/plugins/shared/index_management/public/application/sections/home/index_list/index_list.tsx +++ b/x-pack/platform/plugins/shared/index_management/public/application/sections/home/index_list/index_list.tsx @@ -9,11 +9,11 @@ import React, { useEffect } from 'react'; import { RouteComponentProps } from 'react-router-dom'; import { ScopedHistory } from '@kbn/core/public'; +import useObservable from 'react-use/lib/useObservable'; import { APP_WRAPPER_CLASS, useExecutionContext } from '../../../../shared_imports'; import { breadcrumbService, IndexManagementBreadcrumb } from '../../../services/breadcrumbs'; import { useAppContext } from '../../../app_context'; import { IndexTable } from './index_table'; -import useObservable from 'react-use/lib/useObservable'; export const IndexList: React.FunctionComponent = ({ history }) => { const { diff --git a/x-pack/platform/plugins/shared/index_management/public/application/services/breadcrumbs.ts b/x-pack/platform/plugins/shared/index_management/public/application/services/breadcrumbs.ts index 06f59a2da3d6c..92dcab634954a 100644 --- a/x-pack/platform/plugins/shared/index_management/public/application/services/breadcrumbs.ts +++ b/x-pack/platform/plugins/shared/index_management/public/application/services/breadcrumbs.ts @@ -46,8 +46,7 @@ export enum IndexManagementBreadcrumb { enrichPoliciesCreate = 'enrichPoliciesCreate', content = 'content', - indicesList ='indicesList' - + indicesList = 'indicesList', } class BreadcrumbService { diff --git a/x-pack/platform/plugins/shared/index_management/public/application/services/routing.ts b/x-pack/platform/plugins/shared/index_management/public/application/services/routing.ts index 688f4f4b9a004..f3e0a0791edc1 100644 --- a/x-pack/platform/plugins/shared/index_management/public/application/services/routing.ts +++ b/x-pack/platform/plugins/shared/index_management/public/application/services/routing.ts @@ -11,7 +11,7 @@ import { Section } from '../../../common/constants'; import type { IndexDetailsTabId } from '../../../common/constants'; import { ExtensionsService } from '../../services/extensions_service'; import { IndexDetailsSection } from '../../../common/constants'; -import { breadcrumbService, IndexManagementBreadcrumb } from '../../application/services/breadcrumbs'; +import { breadcrumbService, IndexManagementBreadcrumb } from './breadcrumbs'; export const getTemplateListLink = () => `/templates`; @@ -109,7 +109,6 @@ export const navigateToIndexDetailsPage = ( } else { const route = extensionsService.indexDetailsPageRoute.renderRoute(indexName, tabId); application.navigateToUrl(http.basePath.prepend(route)); - console.log("indexName", indexName) breadcrumbService.setBreadcrumbs(IndexManagementBreadcrumb.indicesList, { text: indexName }); } }; From 42e6684a583a18a26d4cd03d2798a3792299b4fc Mon Sep 17 00:00:00 2001 From: saarikabhasi Date: Tue, 4 Feb 2025 11:51:37 -0500 Subject: [PATCH 05/38] update FTR --- .../sections/home/index_list/index_list.tsx | 1 - .../page_objects/index_management_page.ts | 5 + .../page_objects/search_navigation.ts | 21 ++- .../tests/search_index_details.ts | 138 +++++++++--------- 4 files changed, 86 insertions(+), 79 deletions(-) diff --git a/x-pack/platform/plugins/shared/index_management/public/application/sections/home/index_list/index_list.tsx b/x-pack/platform/plugins/shared/index_management/public/application/sections/home/index_list/index_list.tsx index 8385b7dd32c91..074ee5291452b 100644 --- a/x-pack/platform/plugins/shared/index_management/public/application/sections/home/index_list/index_list.tsx +++ b/x-pack/platform/plugins/shared/index_management/public/application/sections/home/index_list/index_list.tsx @@ -18,7 +18,6 @@ import { IndexTable } from './index_table'; export const IndexList: React.FunctionComponent = ({ history }) => { const { core: { executionContext, chrome }, - services: { extensionsService }, plugins: { cloud }, } = useAppContext(); diff --git a/x-pack/test/functional/page_objects/index_management_page.ts b/x-pack/test/functional/page_objects/index_management_page.ts index 5402c679debe5..1163152f83d72 100644 --- a/x-pack/test/functional/page_objects/index_management_page.ts +++ b/x-pack/test/functional/page_objects/index_management_page.ts @@ -208,6 +208,11 @@ export function IndexManagementPageProvider({ getService }: FtrProviderContext) ) { await testSubjects.click(tab); }, + async expectBreadcrumbNavigationToHaveBreadcrumb(breadcrumbName: string) { + await testSubjects.existOrFail('euiBreadcrumb'); + expect(await testSubjects.getVisibleText('breadcrumb first')).to.contain("Stack Management"); + expect(await testSubjects.getVisibleText('breadcrumb last')).to.contain(breadcrumbName); + }, }, async clickCreateIndexButton() { await testSubjects.click('createIndexButton'); diff --git a/x-pack/test/functional/page_objects/search_navigation.ts b/x-pack/test/functional/page_objects/search_navigation.ts index 323382255850d..c5d9704efb34c 100644 --- a/x-pack/test/functional/page_objects/search_navigation.ts +++ b/x-pack/test/functional/page_objects/search_navigation.ts @@ -4,15 +4,17 @@ * 2.0; you may not use this file except in compliance with the Elastic License * 2.0. */ - +import expect from '@kbn/expect'; import type { FtrProviderContext } from '../ftr_provider_context'; export function SearchNavigationProvider({ getService, getPageObjects }: FtrProviderContext) { const retry = getService('retry'); - const { common, indexManagement, header } = getPageObjects([ + const { common, indexManagement, header, solutionNavigation, searchIndexDetailsPage } = getPageObjects([ 'common', 'indexManagement', 'header', + 'solutionNavigation', + 'searchIndexDetailsPage' ]); const testSubjects = getService('testSubjects'); @@ -35,13 +37,16 @@ export function SearchNavigationProvider({ getService, getPageObjects }: FtrProv } }); }, - async navigateToIndexDetailPage(indexName: string) { - await retry.tryForTime(60 * 1000, async () => { - await common.navigateToApp(`elasticsearch/indices/index_details/${indexName}`, { - shouldLoginIfPrompted: false, - }); + + async navigateToIndexDetailPage(indexName: string, spaceId?:number) { + await solutionNavigation.sidenav.expectLinkExists({ text: 'Index Management' }); + await solutionNavigation.sidenav.clickLink({ + deepLinkId: 'management:index_management', }); - await testSubjects.existOrFail('searchIndicesDetailsPage', { timeout: 2000 }); + await searchIndexDetailsPage.openIndicesDetailFromIndexManagementIndicesListTable( + 0 + ); + await testSubjects.existOrFail('searchIndicesDetailsPage', { timeout: 10000 }); }, async navigateToInferenceManagementPage(expectRedirect: boolean = false) { await common.navigateToApp('searchInferenceEndpoints', { diff --git a/x-pack/test/functional_search/tests/search_index_details.ts b/x-pack/test/functional_search/tests/search_index_details.ts index 0dd464cc5864e..c985da7683f0c 100644 --- a/x-pack/test/functional_search/tests/search_index_details.ts +++ b/x-pack/test/functional_search/tests/search_index_details.ts @@ -16,6 +16,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { 'common', 'indexManagement', 'searchNavigation', + 'solutionNavigation', ]); const es = getService('es'); const browser = getService('browser'); @@ -27,7 +28,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { describe('Search index details page', function () { describe('Solution Nav - Search', function () { - let cleanUp: () => Promise; + let cleanUpSpace: () => Promise; let spaceCreated: { id: string } = { id: '' }; before(async () => { @@ -37,28 +38,70 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { }); // Create a space with the search solution and navigate to its home page - ({ cleanUp, space: spaceCreated } = await spaces.create({ - name: 'search-ftr', + ({ cleanUp: cleanUpSpace, space: spaceCreated } = await spaces.create({ + name: 'search-index-details-ftr', solution: 'es', })); + await pageObjects.searchApiKeys.deleteAPIKeys(); + await es.indices.create({ index: indexName }); }); after(async () => { // Clean up space created - await cleanUp(); + await cleanUpSpace(); await esDeleteAllIndices(indexName); }); + describe('index management index list page', () => { + beforeEach(async () => { + // Navigate to search solution space + await browser.navigateTo(spaces.getRootUrl(spaceCreated.id)); + // Navigate to index management app + await pageObjects.common.navigateToApp('indexManagement', { + basePath: `s/${spaceCreated.id}`, + }); + // Navigate to the indices tab + await pageObjects.indexManagement.changeTabs('indicesTab'); + await pageObjects.header.waitUntilLoadingHasFinished(); + }); + describe('manage index action', () => { + beforeEach(async () => { + await pageObjects.indexManagement.manageIndex(indexName); + await pageObjects.indexManagement.manageIndexContextMenuExists(); + }); + it('navigates to overview tab', async () => { + await pageObjects.indexManagement.changeManageIndexTab('showOverviewIndexMenuButton'); + await pageObjects.searchIndexDetailsPage.expectIndexDetailPageHeader(); + await pageObjects.searchIndexDetailsPage.expectUrlShouldChangeTo('data'); + }); + + it('navigates to settings tab', async () => { + await pageObjects.indexManagement.changeManageIndexTab('showSettingsIndexMenuButton'); + await pageObjects.searchIndexDetailsPage.expectIndexDetailPageHeader(); + await pageObjects.searchIndexDetailsPage.expectUrlShouldChangeTo('settings'); + }); + it('navigates to mappings tab', async () => { + await pageObjects.indexManagement.changeManageIndexTab('showMappingsIndexMenuButton'); + await pageObjects.searchIndexDetailsPage.expectIndexDetailPageHeader(); + await pageObjects.searchIndexDetailsPage.expectUrlShouldChangeTo('mappings'); + }); + }); + describe('can view search index details', function () { + it('renders search index details with no documents', async () => { + await pageObjects.searchIndexDetailsPage.openIndicesDetailFromIndexManagementIndicesListTable( + 0 + ); + await pageObjects.searchIndexDetailsPage.expectIndexDetailPageHeader(); + await pageObjects.searchIndexDetailsPage.expectSearchIndexDetailsTabsExists(); + await pageObjects.searchIndexDetailsPage.expectAPIReferenceDocLinkExists(); + }); + }); + }); describe('search index details page', () => { before(async () => { // Navigate to the spaces management page which will log us in Kibana - await pageObjects.searchApiKeys.deleteAPIKeys(); await browser.navigateTo(spaces.getRootUrl(spaceCreated.id)); - await es.indices.create({ index: indexName }); - await pageObjects.searchNavigation.navigateToIndexDetailPage(indexName); - }); - after(async () => { - await esDeleteAllIndices(indexName); + await pageObjects.searchNavigation.navigateToIndexDetailPage(indexName, spaceCreated?.id); }); it('can load index detail page', async () => { await pageObjects.searchIndexDetailsPage.expectIndexDetailPageHeader(); @@ -130,6 +173,12 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { await pageObjects.searchIndexDetailsPage.expectQuickStatsAIMappingsToHaveVectorFields(); }); + it('should have breadcrumb navigation', async () => { + await pageObjects.searchIndexDetailsPage.expectBreadcrumbNavigationWithIndexName( + indexName + ); + }); + it('should show code examples for adding documents', async () => { await pageObjects.searchIndexDetailsPage.expectAddDocumentCodeExamples(); await pageObjects.searchIndexDetailsPage.expectSelectedLanguage('python'); @@ -264,61 +313,10 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { }); }); - describe('index management index list page', () => { - before(async () => { - await esDeleteAllIndices(indexName); - await es.indices.create({ index: indexName }); - }); - beforeEach(async () => { - // Navigate to search solution space - await browser.navigateTo(spaces.getRootUrl(spaceCreated.id)); - // Navigate to index management app - await pageObjects.common.navigateToApp('indexManagement', { - basePath: `s/${spaceCreated.id}`, - }); - // Navigate to the indices tab - await pageObjects.indexManagement.changeTabs('indicesTab'); - await pageObjects.header.waitUntilLoadingHasFinished(); - }); - after(async () => { - await esDeleteAllIndices(indexName); - }); - describe('manage index action', () => { - beforeEach(async () => { - await pageObjects.indexManagement.manageIndex(indexName); - await pageObjects.indexManagement.manageIndexContextMenuExists(); - }); - it('navigates to overview tab', async () => { - await pageObjects.indexManagement.changeManageIndexTab('showOverviewIndexMenuButton'); - await pageObjects.searchIndexDetailsPage.expectIndexDetailPageHeader(); - await pageObjects.searchIndexDetailsPage.expectUrlShouldChangeTo('data'); - }); - it('navigates to settings tab', async () => { - await pageObjects.indexManagement.changeManageIndexTab('showSettingsIndexMenuButton'); - await pageObjects.searchIndexDetailsPage.expectIndexDetailPageHeader(); - await pageObjects.searchIndexDetailsPage.expectUrlShouldChangeTo('settings'); - }); - it('navigates to mappings tab', async () => { - await pageObjects.indexManagement.changeManageIndexTab('showMappingsIndexMenuButton'); - await pageObjects.searchIndexDetailsPage.expectIndexDetailPageHeader(); - await pageObjects.searchIndexDetailsPage.expectUrlShouldChangeTo('mappings'); - }); - }); - describe('can view search index details', function () { - it('renders search index details with no documents', async () => { - await pageObjects.searchIndexDetailsPage.openIndicesDetailFromIndexManagementIndicesListTable( - 0 - ); - await pageObjects.searchIndexDetailsPage.expectIndexDetailPageHeader(); - await pageObjects.searchIndexDetailsPage.expectSearchIndexDetailsTabsExists(); - await pageObjects.searchIndexDetailsPage.expectAPIReferenceDocLinkExists(); - }); - }); - }); }); describe('Classic Nav', function () { - let cleanUp: () => Promise; + let cleanUpSpace: () => Promise; let spaceCreated: { id: string } = { id: '' }; before(async () => { @@ -327,24 +325,21 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { shouldUseHashForSubUrl: false, }); - // Create a space with the search solution and navigate to its home page - ({ cleanUp, space: spaceCreated } = await spaces.create({ - name: 'classic-nav', + // Create a space with the classic nav solution and navigate to its home page + ({ cleanUp: cleanUpSpace, space: spaceCreated } = await spaces.create({ + name: 'search-index-details-classic-nav-ftr', solution: 'classic', })); await pageObjects.searchApiKeys.deleteAPIKeys(); + await es.indices.create({ index: indexName }); }); after(async () => { // Clean up space created - await cleanUp(); + await cleanUpSpace(); await esDeleteAllIndices(indexName); }); describe('index management index list page', () => { - before(async () => { - await esDeleteAllIndices(indexName); - await es.indices.create({ index: indexName }); - }); beforeEach(async () => { // Navigate to search solution space await browser.navigateTo(spaces.getRootUrl(spaceCreated.id)); @@ -388,6 +383,9 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { // click the first index in the table and wait for the index details page await pageObjects.indexManagement.indexDetailsPage.openIndexDetailsPage(0); await pageObjects.indexManagement.indexDetailsPage.expectIndexDetailsPageIsLoaded(); + await pageObjects.indexManagement.indexDetailsPage.expectBreadcrumbNavigationToHaveBreadcrumb( + 'Overview' + ); }); }); }); From 6cf92e2becfea219dfb05fc4ad80b867bea44825 Mon Sep 17 00:00:00 2001 From: kibanamachine <42973632+kibanamachine@users.noreply.github.com> Date: Tue, 4 Feb 2025 18:00:09 +0000 Subject: [PATCH 06/38] [CI] Auto-commit changed files from 'node scripts/eslint --no-cache --fix' --- .../page_objects/index_management_page.ts | 4 +++- .../page_objects/search_navigation.ts | 22 +++++++++---------- .../tests/search_index_details.ts | 2 -- 3 files changed, 13 insertions(+), 15 deletions(-) diff --git a/x-pack/test/functional/page_objects/index_management_page.ts b/x-pack/test/functional/page_objects/index_management_page.ts index 1163152f83d72..dea28c1dcc90b 100644 --- a/x-pack/test/functional/page_objects/index_management_page.ts +++ b/x-pack/test/functional/page_objects/index_management_page.ts @@ -210,7 +210,9 @@ export function IndexManagementPageProvider({ getService }: FtrProviderContext) }, async expectBreadcrumbNavigationToHaveBreadcrumb(breadcrumbName: string) { await testSubjects.existOrFail('euiBreadcrumb'); - expect(await testSubjects.getVisibleText('breadcrumb first')).to.contain("Stack Management"); + expect(await testSubjects.getVisibleText('breadcrumb first')).to.contain( + 'Stack Management' + ); expect(await testSubjects.getVisibleText('breadcrumb last')).to.contain(breadcrumbName); }, }, diff --git a/x-pack/test/functional/page_objects/search_navigation.ts b/x-pack/test/functional/page_objects/search_navigation.ts index c5d9704efb34c..bbf8c4d298cf4 100644 --- a/x-pack/test/functional/page_objects/search_navigation.ts +++ b/x-pack/test/functional/page_objects/search_navigation.ts @@ -4,18 +4,18 @@ * 2.0; you may not use this file except in compliance with the Elastic License * 2.0. */ -import expect from '@kbn/expect'; import type { FtrProviderContext } from '../ftr_provider_context'; export function SearchNavigationProvider({ getService, getPageObjects }: FtrProviderContext) { const retry = getService('retry'); - const { common, indexManagement, header, solutionNavigation, searchIndexDetailsPage } = getPageObjects([ - 'common', - 'indexManagement', - 'header', - 'solutionNavigation', - 'searchIndexDetailsPage' - ]); + const { common, indexManagement, header, solutionNavigation, searchIndexDetailsPage } = + getPageObjects([ + 'common', + 'indexManagement', + 'header', + 'solutionNavigation', + 'searchIndexDetailsPage', + ]); const testSubjects = getService('testSubjects'); return { @@ -38,14 +38,12 @@ export function SearchNavigationProvider({ getService, getPageObjects }: FtrProv }); }, - async navigateToIndexDetailPage(indexName: string, spaceId?:number) { + async navigateToIndexDetailPage(indexName: string, spaceId?: number) { await solutionNavigation.sidenav.expectLinkExists({ text: 'Index Management' }); await solutionNavigation.sidenav.clickLink({ deepLinkId: 'management:index_management', }); - await searchIndexDetailsPage.openIndicesDetailFromIndexManagementIndicesListTable( - 0 - ); + await searchIndexDetailsPage.openIndicesDetailFromIndexManagementIndicesListTable(0); await testSubjects.existOrFail('searchIndicesDetailsPage', { timeout: 10000 }); }, async navigateToInferenceManagementPage(expectRedirect: boolean = false) { diff --git a/x-pack/test/functional_search/tests/search_index_details.ts b/x-pack/test/functional_search/tests/search_index_details.ts index c985da7683f0c..84292918c262e 100644 --- a/x-pack/test/functional_search/tests/search_index_details.ts +++ b/x-pack/test/functional_search/tests/search_index_details.ts @@ -312,8 +312,6 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { }); }); }); - - }); describe('Classic Nav', function () { let cleanUpSpace: () => Promise; From 82b297cb5f99222bca884fe6ae1d9b5a7feef5bc Mon Sep 17 00:00:00 2001 From: saarikabhasi Date: Tue, 4 Feb 2025 16:13:25 -0500 Subject: [PATCH 07/38] fix ci & clean up --- .../page_objects/search_index_details_page.ts | 2 +- .../page_objects/search_navigation.ts | 6 ++-- x-pack/test/functional_search/index.ts | 8 ++--- .../tests/search_index_details.ts | 4 +-- .../tests/solution_navigation.ts | 2 +- .../functional/test_suites/search/index.ts | 32 +++++++++---------- 6 files changed, 27 insertions(+), 27 deletions(-) diff --git a/x-pack/test/functional/page_objects/search_index_details_page.ts b/x-pack/test/functional/page_objects/search_index_details_page.ts index 61e9b4e031262..21376b80ec38d 100644 --- a/x-pack/test/functional/page_objects/search_index_details_page.ts +++ b/x-pack/test/functional/page_objects/search_index_details_page.ts @@ -284,7 +284,7 @@ export function SearchIndexDetailPageProvider({ getService }: FtrProviderContext }); }, - async expectBreadcrumbNavigationWithIndexName(indexName: string) { + async expectIndexNametoBeInBreadcrumbs(indexName: string) { await testSubjects.existOrFail('euiBreadcrumb'); expect(await testSubjects.getVisibleText('breadcrumb last')).to.contain(indexName); }, diff --git a/x-pack/test/functional/page_objects/search_navigation.ts b/x-pack/test/functional/page_objects/search_navigation.ts index c5d9704efb34c..af868820655eb 100644 --- a/x-pack/test/functional/page_objects/search_navigation.ts +++ b/x-pack/test/functional/page_objects/search_navigation.ts @@ -4,7 +4,7 @@ * 2.0; you may not use this file except in compliance with the Elastic License * 2.0. */ -import expect from '@kbn/expect'; + import type { FtrProviderContext } from '../ftr_provider_context'; export function SearchNavigationProvider({ getService, getPageObjects }: FtrProviderContext) { @@ -38,7 +38,7 @@ export function SearchNavigationProvider({ getService, getPageObjects }: FtrProv }); }, - async navigateToIndexDetailPage(indexName: string, spaceId?:number) { + async navigateToIndexDetailPage(indexName: string) { await solutionNavigation.sidenav.expectLinkExists({ text: 'Index Management' }); await solutionNavigation.sidenav.clickLink({ deepLinkId: 'management:index_management', @@ -46,7 +46,7 @@ export function SearchNavigationProvider({ getService, getPageObjects }: FtrProv await searchIndexDetailsPage.openIndicesDetailFromIndexManagementIndicesListTable( 0 ); - await testSubjects.existOrFail('searchIndicesDetailsPage', { timeout: 10000 }); + await testSubjects.existOrFail('searchIndicesDetailsPage', { timeout: 2000 }); }, async navigateToInferenceManagementPage(expectRedirect: boolean = false) { await common.navigateToApp('searchInferenceEndpoints', { diff --git a/x-pack/test/functional_search/index.ts b/x-pack/test/functional_search/index.ts index 2c3f711102532..b6a542b2465d0 100644 --- a/x-pack/test/functional_search/index.ts +++ b/x-pack/test/functional_search/index.ts @@ -10,10 +10,10 @@ import { FtrProviderContext } from './ftr_provider_context'; export default ({ loadTestFile }: FtrProviderContext): void => { describe('Search solution tests', function () { - loadTestFile(require.resolve('./tests/search_overview')); - loadTestFile(require.resolve('./tests/classic_navigation')); - loadTestFile(require.resolve('./tests/solution_navigation')); - loadTestFile(require.resolve('./tests/search_start')); + // loadTestFile(require.resolve('./tests/search_overview')); + // loadTestFile(require.resolve('./tests/classic_navigation')); + // loadTestFile(require.resolve('./tests/solution_navigation')); + // loadTestFile(require.resolve('./tests/search_start')); loadTestFile(require.resolve('./tests/search_index_details')); }); }; diff --git a/x-pack/test/functional_search/tests/search_index_details.ts b/x-pack/test/functional_search/tests/search_index_details.ts index c985da7683f0c..7a60bbdeb7887 100644 --- a/x-pack/test/functional_search/tests/search_index_details.ts +++ b/x-pack/test/functional_search/tests/search_index_details.ts @@ -101,7 +101,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { before(async () => { // Navigate to the spaces management page which will log us in Kibana await browser.navigateTo(spaces.getRootUrl(spaceCreated.id)); - await pageObjects.searchNavigation.navigateToIndexDetailPage(indexName, spaceCreated?.id); + await pageObjects.searchNavigation.navigateToIndexDetailPage(indexName); }); it('can load index detail page', async () => { await pageObjects.searchIndexDetailsPage.expectIndexDetailPageHeader(); @@ -174,7 +174,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { }); it('should have breadcrumb navigation', async () => { - await pageObjects.searchIndexDetailsPage.expectBreadcrumbNavigationWithIndexName( + await pageObjects.searchIndexDetailsPage.expectIndexNametoBeInBreadcrumbs( indexName ); }); diff --git a/x-pack/test/functional_search/tests/solution_navigation.ts b/x-pack/test/functional_search/tests/solution_navigation.ts index b9bd403b43b4a..7a54931709ed5 100644 --- a/x-pack/test/functional_search/tests/solution_navigation.ts +++ b/x-pack/test/functional_search/tests/solution_navigation.ts @@ -117,7 +117,7 @@ export default function searchSolutionNavigation({ deepLinkId: 'management:index_management', }); await solutionNavigation.breadcrumbs.expectBreadcrumbExists({ text: 'Deployment' }); - await solutionNavigation.breadcrumbs.expectBreadcrumbExists({ text: 'Stack Management' }); + await solutionNavigation.breadcrumbs.expectBreadcrumbExists({ text: 'Content' }); await solutionNavigation.breadcrumbs.expectBreadcrumbExists({ text: 'Index Management' }); await solutionNavigation.breadcrumbs.expectBreadcrumbExists({ text: 'Indices', diff --git a/x-pack/test_serverless/functional/test_suites/search/index.ts b/x-pack/test_serverless/functional/test_suites/search/index.ts index dd7021aebe800..dbd298559912d 100644 --- a/x-pack/test_serverless/functional/test_suites/search/index.ts +++ b/x-pack/test_serverless/functional/test_suites/search/index.ts @@ -11,23 +11,23 @@ export default function ({ loadTestFile }: FtrProviderContext) { describe('serverless search UI', function () { this.tags(['esGate']); - loadTestFile(require.resolve('./navigation')); + // loadTestFile(require.resolve('./navigation')); loadTestFile(require.resolve('./elasticsearch_start.ts')); loadTestFile(require.resolve('./search_index_detail.ts')); - loadTestFile(require.resolve('./getting_started')); - loadTestFile(require.resolve('./index_management')); - loadTestFile(require.resolve('./connectors/connectors_overview')); - loadTestFile(require.resolve('./default_dataview')); - loadTestFile(require.resolve('./pipelines')); - loadTestFile(require.resolve('./cases/attachment_framework')); - loadTestFile(require.resolve('./dashboards/build_dashboard')); - loadTestFile(require.resolve('./dashboards/import_dashboard')); - loadTestFile(require.resolve('./advanced_settings')); - loadTestFile(require.resolve('./rules/rule_details')); - loadTestFile(require.resolve('./console_notebooks')); - loadTestFile(require.resolve('./search_playground/playground_overview')); - loadTestFile(require.resolve('./ml')); - loadTestFile(require.resolve('./custom_role_access')); - loadTestFile(require.resolve('./inference_management')); + // loadTestFile(require.resolve('./getting_started')); + // loadTestFile(require.resolve('./index_management')); + // loadTestFile(require.resolve('./connectors/connectors_overview')); + // loadTestFile(require.resolve('./default_dataview')); + // loadTestFile(require.resolve('./pipelines')); + // loadTestFile(require.resolve('./cases/attachment_framework')); + // loadTestFile(require.resolve('./dashboards/build_dashboard')); + // loadTestFile(require.resolve('./dashboards/import_dashboard')); + // loadTestFile(require.resolve('./advanced_settings')); + // loadTestFile(require.resolve('./rules/rule_details')); + // loadTestFile(require.resolve('./console_notebooks')); + // loadTestFile(require.resolve('./search_playground/playground_overview')); + // loadTestFile(require.resolve('./ml')); + // loadTestFile(require.resolve('./custom_role_access')); + // loadTestFile(require.resolve('./inference_management')); }); } From d61d6ba69b17fe5cba0c37f2e64c66a6de300372 Mon Sep 17 00:00:00 2001 From: saarikabhasi Date: Tue, 4 Feb 2025 16:21:08 -0500 Subject: [PATCH 08/38] revert unintended change --- x-pack/test/functional_search/index.ts | 8 ++--- .../functional/test_suites/search/index.ts | 32 +++++++++---------- 2 files changed, 20 insertions(+), 20 deletions(-) diff --git a/x-pack/test/functional_search/index.ts b/x-pack/test/functional_search/index.ts index b6a542b2465d0..2c3f711102532 100644 --- a/x-pack/test/functional_search/index.ts +++ b/x-pack/test/functional_search/index.ts @@ -10,10 +10,10 @@ import { FtrProviderContext } from './ftr_provider_context'; export default ({ loadTestFile }: FtrProviderContext): void => { describe('Search solution tests', function () { - // loadTestFile(require.resolve('./tests/search_overview')); - // loadTestFile(require.resolve('./tests/classic_navigation')); - // loadTestFile(require.resolve('./tests/solution_navigation')); - // loadTestFile(require.resolve('./tests/search_start')); + loadTestFile(require.resolve('./tests/search_overview')); + loadTestFile(require.resolve('./tests/classic_navigation')); + loadTestFile(require.resolve('./tests/solution_navigation')); + loadTestFile(require.resolve('./tests/search_start')); loadTestFile(require.resolve('./tests/search_index_details')); }); }; diff --git a/x-pack/test_serverless/functional/test_suites/search/index.ts b/x-pack/test_serverless/functional/test_suites/search/index.ts index dbd298559912d..dd7021aebe800 100644 --- a/x-pack/test_serverless/functional/test_suites/search/index.ts +++ b/x-pack/test_serverless/functional/test_suites/search/index.ts @@ -11,23 +11,23 @@ export default function ({ loadTestFile }: FtrProviderContext) { describe('serverless search UI', function () { this.tags(['esGate']); - // loadTestFile(require.resolve('./navigation')); + loadTestFile(require.resolve('./navigation')); loadTestFile(require.resolve('./elasticsearch_start.ts')); loadTestFile(require.resolve('./search_index_detail.ts')); - // loadTestFile(require.resolve('./getting_started')); - // loadTestFile(require.resolve('./index_management')); - // loadTestFile(require.resolve('./connectors/connectors_overview')); - // loadTestFile(require.resolve('./default_dataview')); - // loadTestFile(require.resolve('./pipelines')); - // loadTestFile(require.resolve('./cases/attachment_framework')); - // loadTestFile(require.resolve('./dashboards/build_dashboard')); - // loadTestFile(require.resolve('./dashboards/import_dashboard')); - // loadTestFile(require.resolve('./advanced_settings')); - // loadTestFile(require.resolve('./rules/rule_details')); - // loadTestFile(require.resolve('./console_notebooks')); - // loadTestFile(require.resolve('./search_playground/playground_overview')); - // loadTestFile(require.resolve('./ml')); - // loadTestFile(require.resolve('./custom_role_access')); - // loadTestFile(require.resolve('./inference_management')); + loadTestFile(require.resolve('./getting_started')); + loadTestFile(require.resolve('./index_management')); + loadTestFile(require.resolve('./connectors/connectors_overview')); + loadTestFile(require.resolve('./default_dataview')); + loadTestFile(require.resolve('./pipelines')); + loadTestFile(require.resolve('./cases/attachment_framework')); + loadTestFile(require.resolve('./dashboards/build_dashboard')); + loadTestFile(require.resolve('./dashboards/import_dashboard')); + loadTestFile(require.resolve('./advanced_settings')); + loadTestFile(require.resolve('./rules/rule_details')); + loadTestFile(require.resolve('./console_notebooks')); + loadTestFile(require.resolve('./search_playground/playground_overview')); + loadTestFile(require.resolve('./ml')); + loadTestFile(require.resolve('./custom_role_access')); + loadTestFile(require.resolve('./inference_management')); }); } From 4816549a77e44ef4652a3402be752b6a24d1c6d0 Mon Sep 17 00:00:00 2001 From: saarikabhasi Date: Tue, 4 Feb 2025 16:22:55 -0500 Subject: [PATCH 09/38] Clean ups --- x-pack/test/functional/page_objects/index_management_page.ts | 2 +- x-pack/test/functional_search/tests/search_index_details.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/x-pack/test/functional/page_objects/index_management_page.ts b/x-pack/test/functional/page_objects/index_management_page.ts index dea28c1dcc90b..14396aa99821f 100644 --- a/x-pack/test/functional/page_objects/index_management_page.ts +++ b/x-pack/test/functional/page_objects/index_management_page.ts @@ -208,7 +208,7 @@ export function IndexManagementPageProvider({ getService }: FtrProviderContext) ) { await testSubjects.click(tab); }, - async expectBreadcrumbNavigationToHaveBreadcrumb(breadcrumbName: string) { + async expectBreadcrumbNavigationToHaveBreadcrumbName(breadcrumbName: string) { await testSubjects.existOrFail('euiBreadcrumb'); expect(await testSubjects.getVisibleText('breadcrumb first')).to.contain( 'Stack Management' diff --git a/x-pack/test/functional_search/tests/search_index_details.ts b/x-pack/test/functional_search/tests/search_index_details.ts index ebde92741d133..bc2b02c3d09d6 100644 --- a/x-pack/test/functional_search/tests/search_index_details.ts +++ b/x-pack/test/functional_search/tests/search_index_details.ts @@ -381,7 +381,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { // click the first index in the table and wait for the index details page await pageObjects.indexManagement.indexDetailsPage.openIndexDetailsPage(0); await pageObjects.indexManagement.indexDetailsPage.expectIndexDetailsPageIsLoaded(); - await pageObjects.indexManagement.indexDetailsPage.expectBreadcrumbNavigationToHaveBreadcrumb( + await pageObjects.indexManagement.indexDetailsPage.expectBreadcrumbNavigationToHaveBreadcrumbName( 'Overview' ); }); From 950958c5d23e1b44627ad71f6727abef480622e5 Mon Sep 17 00:00:00 2001 From: kibanamachine <42973632+kibanamachine@users.noreply.github.com> Date: Tue, 4 Feb 2025 21:56:09 +0000 Subject: [PATCH 10/38] [CI] Auto-commit changed files from 'node scripts/eslint --no-cache --fix' --- x-pack/test/functional/page_objects/search_navigation.ts | 4 +--- x-pack/test/functional_search/tests/search_index_details.ts | 4 +--- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/x-pack/test/functional/page_objects/search_navigation.ts b/x-pack/test/functional/page_objects/search_navigation.ts index c19916c15f6ee..2716ec0e87496 100644 --- a/x-pack/test/functional/page_objects/search_navigation.ts +++ b/x-pack/test/functional/page_objects/search_navigation.ts @@ -43,9 +43,7 @@ export function SearchNavigationProvider({ getService, getPageObjects }: FtrProv await solutionNavigation.sidenav.clickLink({ deepLinkId: 'management:index_management', }); - await searchIndexDetailsPage.openIndicesDetailFromIndexManagementIndicesListTable( - 0 - ); + await searchIndexDetailsPage.openIndicesDetailFromIndexManagementIndicesListTable(0); await testSubjects.existOrFail('searchIndicesDetailsPage', { timeout: 2000 }); }, async navigateToInferenceManagementPage(expectRedirect: boolean = false) { diff --git a/x-pack/test/functional_search/tests/search_index_details.ts b/x-pack/test/functional_search/tests/search_index_details.ts index bc2b02c3d09d6..980d9ec5ddb20 100644 --- a/x-pack/test/functional_search/tests/search_index_details.ts +++ b/x-pack/test/functional_search/tests/search_index_details.ts @@ -174,9 +174,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { }); it('should have breadcrumb navigation', async () => { - await pageObjects.searchIndexDetailsPage.expectIndexNametoBeInBreadcrumbs( - indexName - ); + await pageObjects.searchIndexDetailsPage.expectIndexNametoBeInBreadcrumbs(indexName); }); it('should show code examples for adding documents', async () => { From fa25cc6d12cb971b39e77d82511c143843828cd9 Mon Sep 17 00:00:00 2001 From: saarikabhasi Date: Tue, 4 Feb 2025 17:10:03 -0500 Subject: [PATCH 11/38] remove indexName --- .../page_objects/search_navigation.ts | 2 +- .../tests/search_index_details.ts | 28 +++++++++---------- 2 files changed, 14 insertions(+), 16 deletions(-) diff --git a/x-pack/test/functional/page_objects/search_navigation.ts b/x-pack/test/functional/page_objects/search_navigation.ts index c19916c15f6ee..22796157a43d8 100644 --- a/x-pack/test/functional/page_objects/search_navigation.ts +++ b/x-pack/test/functional/page_objects/search_navigation.ts @@ -38,7 +38,7 @@ export function SearchNavigationProvider({ getService, getPageObjects }: FtrProv }); }, - async navigateToIndexDetailPage(indexName: string) { + async navigateToIndexDetailPage() { await solutionNavigation.sidenav.expectLinkExists({ text: 'Index Management' }); await solutionNavigation.sidenav.clickLink({ deepLinkId: 'management:index_management', diff --git a/x-pack/test/functional_search/tests/search_index_details.ts b/x-pack/test/functional_search/tests/search_index_details.ts index bc2b02c3d09d6..757c2c4380c18 100644 --- a/x-pack/test/functional_search/tests/search_index_details.ts +++ b/x-pack/test/functional_search/tests/search_index_details.ts @@ -39,7 +39,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { // Create a space with the search solution and navigate to its home page ({ cleanUp: cleanUpSpace, space: spaceCreated } = await spaces.create({ - name: 'search-index-details-ftr', + name: 'solution-nav-search-index-details-ftr', solution: 'es', })); @@ -101,7 +101,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { before(async () => { // Navigate to the spaces management page which will log us in Kibana await browser.navigateTo(spaces.getRootUrl(spaceCreated.id)); - await pageObjects.searchNavigation.navigateToIndexDetailPage(indexName); + await pageObjects.searchNavigation.navigateToIndexDetailPage(); }); it('can load index detail page', async () => { await pageObjects.searchIndexDetailsPage.expectIndexDetailPageHeader(); @@ -120,7 +120,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { const indexNameCodeExample = 'test-my-index2'; before(async () => { await es.indices.create({ index: indexNameCodeExample }); - await pageObjects.searchNavigation.navigateToIndexDetailPage(indexNameCodeExample); + await pageObjects.searchNavigation.navigateToIndexDetailPage(); }); after(async () => { @@ -135,7 +135,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { describe('API key details', () => { it('should show api key', async () => { await pageObjects.searchApiKeys.deleteAPIKeys(); - await pageObjects.searchNavigation.navigateToIndexDetailPage(indexName); + await pageObjects.searchNavigation.navigateToIndexDetailPage(); // sometimes the API key exists in the cluster and its lost in sessionStorage // if fails we retry to delete the API key and refresh the browser await retry.try( @@ -169,14 +169,12 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { }, }, }); - await pageObjects.searchNavigation.navigateToIndexDetailPage(indexName); + await pageObjects.searchNavigation.navigateToIndexDetailPage(); await pageObjects.searchIndexDetailsPage.expectQuickStatsAIMappingsToHaveVectorFields(); }); it('should have breadcrumb navigation', async () => { - await pageObjects.searchIndexDetailsPage.expectIndexNametoBeInBreadcrumbs( - indexName - ); + await pageObjects.searchIndexDetailsPage.expectIndexNametoBeInBreadcrumbs(indexName); }); it('should show code examples for adding documents', async () => { @@ -206,7 +204,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { my_field: [1, 0, 1], }, }); - await pageObjects.searchNavigation.navigateToIndexDetailPage(indexName); + await pageObjects.searchNavigation.navigateToIndexDetailPage(); }); it('should have index documents', async () => { await pageObjects.searchIndexDetailsPage.expectHasIndexDocuments(); @@ -241,7 +239,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { // re-open page to refresh queries for test (these will auto-refresh, // but waiting for that will make this test flakey) - await pageObjects.searchNavigation.navigateToIndexDetailPage(indexName); + await pageObjects.searchNavigation.navigateToIndexDetailPage(); await pageObjects.searchIndexDetailsPage.expectAddDocumentCodeExamples(); await pageObjects.searchIndexDetailsPage.expectQuickStatsToHaveDocumentCount(0); }); @@ -254,11 +252,11 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { my_field: [1, 0, 1], }, }); - await pageObjects.searchNavigation.navigateToIndexDetailPage(indexName); + await pageObjects.searchNavigation.navigateToIndexDetailPage(); }); beforeEach(async () => { - await pageObjects.searchNavigation.navigateToIndexDetailPage(indexName); + await pageObjects.searchNavigation.navigateToIndexDetailPage(); }); it('delete document button is enabled', async () => { @@ -283,7 +281,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { describe('page loading error', () => { before(async () => { - await pageObjects.searchNavigation.navigateToIndexDetailPage(indexName); + await pageObjects.searchNavigation.navigateToIndexDetailPage(); await esDeleteAllIndices(indexName); }); it('has page load error section', async () => { @@ -298,7 +296,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { }); describe('Index more options menu', () => { before(async () => { - await pageObjects.searchNavigation.navigateToIndexDetailPage(indexName); + await pageObjects.searchNavigation.navigateToIndexDetailPage(); }); it('shows action menu in actions popover', async () => { await pageObjects.searchIndexDetailsPage.expectMoreOptionsActionButtonExists(); @@ -325,7 +323,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { // Create a space with the classic nav solution and navigate to its home page ({ cleanUp: cleanUpSpace, space: spaceCreated } = await spaces.create({ - name: 'search-index-details-classic-nav-ftr', + name: 'classic-nav-search-index-details-ftr', solution: 'classic', })); await pageObjects.searchApiKeys.deleteAPIKeys(); From 2c60095cd069b12c2d6e488d7bc9c789094d76b8 Mon Sep 17 00:00:00 2001 From: saarikabhasi Date: Wed, 5 Feb 2025 17:57:14 -0500 Subject: [PATCH 12/38] fix ci error --- .../index_actions_context_menu.js | 4 ++++ .../home/index_list/index_table/index_table.js | 4 +++- .../public/application/services/breadcrumbs.ts | 2 +- .../public/application/services/routing.test.ts | 14 +++++++++++++- .../public/application/services/routing.ts | 5 +++-- .../tests/search_sidenav.ts | 2 +- 6 files changed, 25 insertions(+), 6 deletions(-) diff --git a/x-pack/platform/plugins/shared/index_management/public/application/sections/home/index_list/index_actions_context_menu/index_actions_context_menu.js b/x-pack/platform/plugins/shared/index_management/public/application/sections/home/index_list/index_actions_context_menu/index_actions_context_menu.js index 21f77ae11337d..c9e13487eb4be 100644 --- a/x-pack/platform/plugins/shared/index_management/public/application/sections/home/index_list/index_actions_context_menu/index_actions_context_menu.js +++ b/x-pack/platform/plugins/shared/index_management/public/application/sections/home/index_list/index_actions_context_menu/index_actions_context_menu.js @@ -25,6 +25,7 @@ import { flattenPanelTree } from '../../../../lib/flatten_panel_tree'; import { INDEX_OPEN, IndexDetailsSection } from '../../../../../../common/constants'; import { getIndexDetailsLink, navigateToIndexDetailsPage } from '../../../../services/routing'; import { AppContext } from '../../../../app_context'; +import { breadcrumbService } from '../../../../services/breadcrumbs'; export class IndexActionsContextMenu extends Component { static contextType = AppContext; @@ -88,6 +89,7 @@ export class IndexActionsContextMenu extends Component { extensionsService, application, http, + breadcrumbService, IndexDetailsSection.Overview ); }, @@ -104,6 +106,7 @@ export class IndexActionsContextMenu extends Component { extensionsService, application, http, + breadcrumbService, IndexDetailsSection.Settings ); }, @@ -120,6 +123,7 @@ export class IndexActionsContextMenu extends Component { extensionsService, application, http, + breadcrumbService, IndexDetailsSection.Mappings ); }, diff --git a/x-pack/platform/plugins/shared/index_management/public/application/sections/home/index_list/index_table/index_table.js b/x-pack/platform/plugins/shared/index_management/public/application/sections/home/index_list/index_table/index_table.js index ee72f56d2103d..d1e5e90662930 100644 --- a/x-pack/platform/plugins/shared/index_management/public/application/sections/home/index_list/index_table/index_table.js +++ b/x-pack/platform/plugins/shared/index_management/public/application/sections/home/index_list/index_table/index_table.js @@ -49,6 +49,7 @@ import { NoMatch, DataHealth } from '../../../../components'; import { IndexActionsContextMenu } from '../index_actions_context_menu'; import { CreateIndexButton } from '../create_index/create_index_button'; import { IndexTablePagination, PAGE_SIZE_OPTIONS } from './index_table_pagination'; +import { breadcrumbService } from '../../../../services/breadcrumbs'; const getColumnConfigs = ({ showIndexStats, @@ -78,7 +79,8 @@ const getColumnConfigs = ({ location.search || '', extensionsService, application, - http + http, + breadcrumbService ); }} > diff --git a/x-pack/platform/plugins/shared/index_management/public/application/services/breadcrumbs.ts b/x-pack/platform/plugins/shared/index_management/public/application/services/breadcrumbs.ts index 92dcab634954a..3dc91b55ce676 100644 --- a/x-pack/platform/plugins/shared/index_management/public/application/services/breadcrumbs.ts +++ b/x-pack/platform/plugins/shared/index_management/public/application/services/breadcrumbs.ts @@ -49,7 +49,7 @@ export enum IndexManagementBreadcrumb { indicesList = 'indicesList', } -class BreadcrumbService { +export class BreadcrumbService { private breadcrumbs: { [key in IndexManagementBreadcrumb]?: EuiBreadcrumb[]; } = { diff --git a/x-pack/platform/plugins/shared/index_management/public/application/services/routing.test.ts b/x-pack/platform/plugins/shared/index_management/public/application/services/routing.test.ts index 0b1462deab58b..635e042d8ce6c 100644 --- a/x-pack/platform/plugins/shared/index_management/public/application/services/routing.test.ts +++ b/x-pack/platform/plugins/shared/index_management/public/application/services/routing.test.ts @@ -9,6 +9,7 @@ import { getIndexDetailsLink, getIndexListUri, navigateToIndexDetailsPage } from import { applicationServiceMock, httpServiceMock } from '@kbn/core/public/mocks'; import { ExtensionsService } from '../../services/extensions_service'; import { IndexDetailsSection } from '../../../common/constants'; +import { BreadcrumbService } from './breadcrumbs'; describe('routing', () => { describe('index details link', () => { @@ -36,7 +37,12 @@ describe('routing', () => { const extensionService = { indexDetailsPageRoute: null, } as ExtensionsService; - navigateToIndexDetailsPage('testIndex', '', extensionService, application, http); + + const breadcrumbs = { + setBreadcrumbs: jest.fn() + } as unknown as BreadcrumbService; + + navigateToIndexDetailsPage('testIndex', '', extensionService, application, http, breadcrumbs); expect(application.navigateToUrl).toHaveBeenCalled(); }); @@ -48,12 +54,18 @@ describe('routing', () => { }, }, } as ExtensionsService; + + const breadcrumbs = { + setBreadcrumbs: jest.fn(), + } as unknown as BreadcrumbService; + navigateToIndexDetailsPage( 'testIndex', '', extensionService, application, http, + breadcrumbs, IndexDetailsSection.Settings ); expect(application.navigateToUrl).toHaveBeenCalled(); diff --git a/x-pack/platform/plugins/shared/index_management/public/application/services/routing.ts b/x-pack/platform/plugins/shared/index_management/public/application/services/routing.ts index f3e0a0791edc1..1ba519bba1ee7 100644 --- a/x-pack/platform/plugins/shared/index_management/public/application/services/routing.ts +++ b/x-pack/platform/plugins/shared/index_management/public/application/services/routing.ts @@ -11,8 +11,8 @@ import { Section } from '../../../common/constants'; import type { IndexDetailsTabId } from '../../../common/constants'; import { ExtensionsService } from '../../services/extensions_service'; import { IndexDetailsSection } from '../../../common/constants'; -import { breadcrumbService, IndexManagementBreadcrumb } from './breadcrumbs'; - +import { IndexManagementBreadcrumb } from './breadcrumbs'; +import { BreadcrumbService } from './breadcrumbs'; export const getTemplateListLink = () => `/templates`; export const getTemplateDetailsLink = (name: string, isLegacy?: boolean) => { @@ -94,6 +94,7 @@ export const navigateToIndexDetailsPage = ( extensionsService: ExtensionsService, application: ApplicationStart, http: HttpSetup, + breadcrumbService: BreadcrumbService, tabId?: IndexDetailsSection ) => { if (!extensionsService.indexDetailsPageRoute) { diff --git a/x-pack/test/functional_solution_sidenav/tests/search_sidenav.ts b/x-pack/test/functional_solution_sidenav/tests/search_sidenav.ts index 743f1cad451e6..62a44d68ee17a 100644 --- a/x-pack/test/functional_solution_sidenav/tests/search_sidenav.ts +++ b/x-pack/test/functional_solution_sidenav/tests/search_sidenav.ts @@ -56,7 +56,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { deepLinkId: 'management:index_management', }); await solutionNavigation.breadcrumbs.expectBreadcrumbExists({ text: 'Deployment' }); - await solutionNavigation.breadcrumbs.expectBreadcrumbExists({ text: 'Stack Management' }); + await solutionNavigation.breadcrumbs.expectBreadcrumbExists({ text: 'Content' }); await solutionNavigation.breadcrumbs.expectBreadcrumbExists({ text: 'Index Management' }); await solutionNavigation.breadcrumbs.expectBreadcrumbExists({ text: 'Indices', From 0972fc71a00bc377e941872cca8e4a5eb99b6b98 Mon Sep 17 00:00:00 2001 From: saarikabhasi Date: Thu, 6 Feb 2025 13:12:21 -0500 Subject: [PATCH 13/38] address feedback and update FTR tests navigate to details page --- .../sections/home/index_list/index_list.tsx | 11 ++++------ .../application/services/breadcrumbs.ts | 1 - .../application/services/routing.test.ts | 2 +- .../page_objects/search_navigation.ts | 14 ++++++++----- .../tests/search_index_details.ts | 20 +++++++++---------- 5 files changed, 24 insertions(+), 24 deletions(-) diff --git a/x-pack/platform/plugins/shared/index_management/public/application/sections/home/index_list/index_list.tsx b/x-pack/platform/plugins/shared/index_management/public/application/sections/home/index_list/index_list.tsx index 074ee5291452b..0ec6e08283edd 100644 --- a/x-pack/platform/plugins/shared/index_management/public/application/sections/home/index_list/index_list.tsx +++ b/x-pack/platform/plugins/shared/index_management/public/application/sections/home/index_list/index_list.tsx @@ -26,15 +26,12 @@ export const IndexList: React.FunctionComponent = ({ histor page: 'indexManagementIndicesTab', }); const activeSolutionId = useObservable(chrome.getActiveSolutionNavId$()); + useEffect(() => { - if (cloud?.isServerlessEnabled) { - breadcrumbService.setBreadcrumbs(IndexManagementBreadcrumb.indices); + if (!cloud?.isServerlessEnabled && activeSolutionId === 'es') { + breadcrumbService.setBreadcrumbs(IndexManagementBreadcrumb.indicesList); } else { - if (activeSolutionId === 'es') { - breadcrumbService.setBreadcrumbs(IndexManagementBreadcrumb.indicesList); - } else { - breadcrumbService.setBreadcrumbs(IndexManagementBreadcrumb.indices); - } + breadcrumbService.setBreadcrumbs(IndexManagementBreadcrumb.indices); } }, [activeSolutionId, cloud]); diff --git a/x-pack/platform/plugins/shared/index_management/public/application/services/breadcrumbs.ts b/x-pack/platform/plugins/shared/index_management/public/application/services/breadcrumbs.ts index 3dc91b55ce676..6aad9f4988f66 100644 --- a/x-pack/platform/plugins/shared/index_management/public/application/services/breadcrumbs.ts +++ b/x-pack/platform/plugins/shared/index_management/public/application/services/breadcrumbs.ts @@ -64,7 +64,6 @@ export class BreadcrumbService { text: i18n.translate('xpack.idxMgmt.breadcrumb.contentLabel', { defaultMessage: 'Content', }), - href: ``, }, ]; this.breadcrumbs.home = [ diff --git a/x-pack/platform/plugins/shared/index_management/public/application/services/routing.test.ts b/x-pack/platform/plugins/shared/index_management/public/application/services/routing.test.ts index 635e042d8ce6c..7fb35119e355f 100644 --- a/x-pack/platform/plugins/shared/index_management/public/application/services/routing.test.ts +++ b/x-pack/platform/plugins/shared/index_management/public/application/services/routing.test.ts @@ -39,7 +39,7 @@ describe('routing', () => { } as ExtensionsService; const breadcrumbs = { - setBreadcrumbs: jest.fn() + setBreadcrumbs: jest.fn(), } as unknown as BreadcrumbService; navigateToIndexDetailsPage('testIndex', '', extensionService, application, http, breadcrumbs); diff --git a/x-pack/test/functional/page_objects/search_navigation.ts b/x-pack/test/functional/page_objects/search_navigation.ts index 586332930deec..4e2247414f4b6 100644 --- a/x-pack/test/functional/page_objects/search_navigation.ts +++ b/x-pack/test/functional/page_objects/search_navigation.ts @@ -13,8 +13,7 @@ export function SearchNavigationProvider({ getService, getPageObjects }: FtrProv 'common', 'indexManagement', 'header', - 'solutionNavigation', - 'searchIndexDetailsPage', + 'solutionNavigation' ]); const testSubjects = getService('testSubjects'); @@ -37,13 +36,18 @@ export function SearchNavigationProvider({ getService, getPageObjects }: FtrProv } }); }, - - async navigateToIndexDetailPage() { + async navigateToIndexDetailPage(indexName: string) { await solutionNavigation.sidenav.expectLinkExists({ text: 'Index Management' }); await solutionNavigation.sidenav.clickLink({ deepLinkId: 'management:index_management', }); - await searchIndexDetailsPage.openIndicesDetailFromIndexManagementIndicesListTable(0); + const indexNamesList = await testSubjects.findAll('indexTableIndexNameLink') + for (const indexNameLink of indexNamesList){ + if((await indexNameLink.getVisibleText()).includes(indexName)){ + await indexNameLink.click() + return; + } + } await testSubjects.existOrFail('searchIndicesDetailsPage', { timeout: 2000 }); }, async navigateToInferenceManagementPage(expectRedirect: boolean = false) { diff --git a/x-pack/test/functional_search/tests/search_index_details.ts b/x-pack/test/functional_search/tests/search_index_details.ts index 0149fe888e876..e70984c4a54a1 100644 --- a/x-pack/test/functional_search/tests/search_index_details.ts +++ b/x-pack/test/functional_search/tests/search_index_details.ts @@ -102,7 +102,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { before(async () => { // Navigate to the spaces management page which will log us in Kibana await browser.navigateTo(spaces.getRootUrl(spaceCreated.id)); - await pageObjects.searchNavigation.navigateToIndexDetailPage(); + await pageObjects.searchNavigation.navigateToIndexDetailPage(indexName); }); it('can load index detail page', async () => { await pageObjects.searchIndexDetailsPage.expectIndexDetailPageHeader(); @@ -121,7 +121,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { const indexNameCodeExample = 'test-my-index2'; before(async () => { await es.indices.create({ index: indexNameCodeExample }); - await pageObjects.searchNavigation.navigateToIndexDetailPage(); + await pageObjects.searchNavigation.navigateToIndexDetailPage(indexName); }); after(async () => { @@ -136,7 +136,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { describe('API key details', () => { it('should show api key', async () => { await pageObjects.searchApiKeys.deleteAPIKeys(); - await pageObjects.searchNavigation.navigateToIndexDetailPage(); + await pageObjects.searchNavigation.navigateToIndexDetailPage(indexName); // sometimes the API key exists in the cluster and its lost in sessionStorage // if fails we retry to delete the API key and refresh the browser await retry.try( @@ -170,7 +170,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { }, }, }); - await pageObjects.searchNavigation.navigateToIndexDetailPage(); + await pageObjects.searchNavigation.navigateToIndexDetailPage(indexName); await pageObjects.searchIndexDetailsPage.expectQuickStatsAIMappingsToHaveVectorFields(); }); @@ -205,7 +205,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { my_field: [1, 0, 1], }, }); - await pageObjects.searchNavigation.navigateToIndexDetailPage(); + await pageObjects.searchNavigation.navigateToIndexDetailPage(indexName); }); it('should have index documents', async () => { await pageObjects.searchIndexDetailsPage.expectHasIndexDocuments(); @@ -240,7 +240,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { // re-open page to refresh queries for test (these will auto-refresh, // but waiting for that will make this test flakey) - await pageObjects.searchNavigation.navigateToIndexDetailPage(); + await pageObjects.searchNavigation.navigateToIndexDetailPage(indexName); await pageObjects.searchIndexDetailsPage.expectAddDocumentCodeExamples(); await pageObjects.searchIndexDetailsPage.expectQuickStatsToHaveDocumentCount(0); }); @@ -253,11 +253,11 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { my_field: [1, 0, 1], }, }); - await pageObjects.searchNavigation.navigateToIndexDetailPage(); + await pageObjects.searchNavigation.navigateToIndexDetailPage(indexName); }); beforeEach(async () => { - await pageObjects.searchNavigation.navigateToIndexDetailPage(); + await pageObjects.searchNavigation.navigateToIndexDetailPage(indexName); }); it('delete document button is enabled', async () => { @@ -282,7 +282,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { describe('page loading error', () => { before(async () => { - await pageObjects.searchNavigation.navigateToIndexDetailPage(); + await pageObjects.searchNavigation.navigateToIndexDetailPage(indexName); await esDeleteAllIndices(indexName); }); it('has page load error section', async () => { @@ -297,7 +297,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { }); describe('Index more options menu', () => { before(async () => { - await pageObjects.searchNavigation.navigateToIndexDetailPage(); + await pageObjects.searchNavigation.navigateToIndexDetailPage(indexName); }); it('shows action menu in actions popover', async () => { await pageObjects.searchIndexDetailsPage.expectMoreOptionsActionButtonExists(); From 0d998b64c1a2f7bd39dace51ebd634cdc685a53d Mon Sep 17 00:00:00 2001 From: saarikabhasi Date: Thu, 6 Feb 2025 14:27:07 -0500 Subject: [PATCH 14/38] move index management to separate file & fix ci remove index management tests from search_index_details --- .../page_objects/search_navigation.ts | 17 ++-- x-pack/test/functional_search/index.ts | 1 + .../tests/index_management.ts | 90 +++++++++++++++++++ .../tests/search_index_details.ts | 47 +--------- 4 files changed, 98 insertions(+), 57 deletions(-) create mode 100644 x-pack/test/functional_search/tests/index_management.ts diff --git a/x-pack/test/functional/page_objects/search_navigation.ts b/x-pack/test/functional/page_objects/search_navigation.ts index 4e2247414f4b6..8bdda764e02b6 100644 --- a/x-pack/test/functional/page_objects/search_navigation.ts +++ b/x-pack/test/functional/page_objects/search_navigation.ts @@ -8,13 +8,8 @@ import type { FtrProviderContext } from '../ftr_provider_context'; export function SearchNavigationProvider({ getService, getPageObjects }: FtrProviderContext) { const retry = getService('retry'); - const { common, indexManagement, header, solutionNavigation, searchIndexDetailsPage } = - getPageObjects([ - 'common', - 'indexManagement', - 'header', - 'solutionNavigation' - ]); + const { common, indexManagement, header, solutionNavigation } = + getPageObjects(['common', 'indexManagement', 'header', 'solutionNavigation']); const testSubjects = getService('testSubjects'); return { @@ -41,10 +36,10 @@ export function SearchNavigationProvider({ getService, getPageObjects }: FtrProv await solutionNavigation.sidenav.clickLink({ deepLinkId: 'management:index_management', }); - const indexNamesList = await testSubjects.findAll('indexTableIndexNameLink') - for (const indexNameLink of indexNamesList){ - if((await indexNameLink.getVisibleText()).includes(indexName)){ - await indexNameLink.click() + const indexNamesList = await testSubjects.findAll('indexTableIndexNameLink'); + for (const indexNameLink of indexNamesList) { + if ((await indexNameLink.getVisibleText()).includes(indexName)) { + await indexNameLink.click(); return; } } diff --git a/x-pack/test/functional_search/index.ts b/x-pack/test/functional_search/index.ts index 2c3f711102532..6f2eb1dccff72 100644 --- a/x-pack/test/functional_search/index.ts +++ b/x-pack/test/functional_search/index.ts @@ -15,5 +15,6 @@ export default ({ loadTestFile }: FtrProviderContext): void => { loadTestFile(require.resolve('./tests/solution_navigation')); loadTestFile(require.resolve('./tests/search_start')); loadTestFile(require.resolve('./tests/search_index_details')); + loadTestFile(require.resolve('./tests/index_management')); }); }; diff --git a/x-pack/test/functional_search/tests/index_management.ts b/x-pack/test/functional_search/tests/index_management.ts new file mode 100644 index 0000000000000..ba452eb954e17 --- /dev/null +++ b/x-pack/test/functional_search/tests/index_management.ts @@ -0,0 +1,90 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ +import type { FtrProviderContext } from '../ftr_provider_context'; +export default function ({ getPageObjects, getService }: FtrProviderContext) { + const pageObjects = getPageObjects([ + 'searchIndexDetailsPage', + 'header', + 'common', + 'indexManagement', + ]); + const es = getService('es'); + const browser = getService('browser'); + const spaces = getService('spaces'); + const esDeleteAllIndices = getService('esDeleteAllIndices'); + + const indexName = 'search_index'; + describe('Index management list page', function () { + let cleanUpSpace: () => Promise; + let spaceCreated: { id: string } = { id: '' }; + before(async () => { + // Navigate to the spaces management page which will log us in Kibana + await pageObjects.common.navigateToUrl('management', 'kibana/spaces', { + shouldUseHashForSubUrl: false, + }); + + // Create a space with the search solution and navigate to its home page + ({ cleanUp: cleanUpSpace, space: spaceCreated } = await spaces.create({ + name: 'search-index-management-listpage-ftr', + solution: 'es', + })); + + await es.indices.create({ index: indexName }); + }); + + after(async () => { + // Clean up space created + await cleanUpSpace(); + await esDeleteAllIndices(indexName); + }); + describe('index management index list page', () => { + beforeEach(async () => { + // Navigate to search solution space + await browser.navigateTo(spaces.getRootUrl(spaceCreated.id)); + // Navigate to index management app + await pageObjects.common.navigateToApp('indexManagement', { + basePath: `s/${spaceCreated.id}`, + }); + // Navigate to the indices tab + await pageObjects.indexManagement.changeTabs('indicesTab'); + await pageObjects.header.waitUntilLoadingHasFinished(); + }); + describe('manage index action', () => { + beforeEach(async () => { + await pageObjects.indexManagement.manageIndex(indexName); + await pageObjects.indexManagement.manageIndexContextMenuExists(); + }); + it('navigates to overview tab', async () => { + await pageObjects.indexManagement.changeManageIndexTab('showOverviewIndexMenuButton'); + await pageObjects.searchIndexDetailsPage.expectIndexDetailPageHeader(); + await pageObjects.searchIndexDetailsPage.expectUrlShouldChangeTo('data'); + }); + + it('navigates to settings tab', async () => { + await pageObjects.indexManagement.changeManageIndexTab('showSettingsIndexMenuButton'); + await pageObjects.searchIndexDetailsPage.expectIndexDetailPageHeader(); + await pageObjects.searchIndexDetailsPage.expectUrlShouldChangeTo('settings'); + }); + it('navigates to mappings tab', async () => { + await pageObjects.indexManagement.changeManageIndexTab('showMappingsIndexMenuButton'); + await pageObjects.searchIndexDetailsPage.expectIndexDetailPageHeader(); + await pageObjects.searchIndexDetailsPage.expectUrlShouldChangeTo('mappings'); + }); + }); + describe('can view search index details', function () { + it('renders search index details with no documents', async () => { + await pageObjects.searchIndexDetailsPage.openIndicesDetailFromIndexManagementIndicesListTable( + 0 + ); + await pageObjects.searchIndexDetailsPage.expectIndexDetailPageHeader(); + await pageObjects.searchIndexDetailsPage.expectSearchIndexDetailsTabsExists(); + await pageObjects.searchIndexDetailsPage.expectAPIReferenceDocLinkExists(); + }); + }); + }); + }); +} diff --git a/x-pack/test/functional_search/tests/search_index_details.ts b/x-pack/test/functional_search/tests/search_index_details.ts index e70984c4a54a1..1ff4476ad6f78 100644 --- a/x-pack/test/functional_search/tests/search_index_details.ts +++ b/x-pack/test/functional_search/tests/search_index_details.ts @@ -53,51 +53,6 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { await cleanUpSpace(); await esDeleteAllIndices(indexName); }); - describe('index management index list page', () => { - beforeEach(async () => { - // Navigate to search solution space - await browser.navigateTo(spaces.getRootUrl(spaceCreated.id)); - // Navigate to index management app - await pageObjects.common.navigateToApp('indexManagement', { - basePath: `s/${spaceCreated.id}`, - }); - // Navigate to the indices tab - await pageObjects.indexManagement.changeTabs('indicesTab'); - await pageObjects.header.waitUntilLoadingHasFinished(); - }); - describe('manage index action', () => { - beforeEach(async () => { - await pageObjects.indexManagement.manageIndex(indexName); - await pageObjects.indexManagement.manageIndexContextMenuExists(); - }); - it('navigates to overview tab', async () => { - await pageObjects.indexManagement.changeManageIndexTab('showOverviewIndexMenuButton'); - await pageObjects.searchIndexDetailsPage.expectIndexDetailPageHeader(); - await pageObjects.searchIndexDetailsPage.expectUrlShouldChangeTo('data'); - }); - - it('navigates to settings tab', async () => { - await pageObjects.indexManagement.changeManageIndexTab('showSettingsIndexMenuButton'); - await pageObjects.searchIndexDetailsPage.expectIndexDetailPageHeader(); - await pageObjects.searchIndexDetailsPage.expectUrlShouldChangeTo('settings'); - }); - it('navigates to mappings tab', async () => { - await pageObjects.indexManagement.changeManageIndexTab('showMappingsIndexMenuButton'); - await pageObjects.searchIndexDetailsPage.expectIndexDetailPageHeader(); - await pageObjects.searchIndexDetailsPage.expectUrlShouldChangeTo('mappings'); - }); - }); - describe('can view search index details', function () { - it('renders search index details with no documents', async () => { - await pageObjects.searchIndexDetailsPage.openIndicesDetailFromIndexManagementIndicesListTable( - 0 - ); - await pageObjects.searchIndexDetailsPage.expectIndexDetailPageHeader(); - await pageObjects.searchIndexDetailsPage.expectSearchIndexDetailsTabsExists(); - await pageObjects.searchIndexDetailsPage.expectAPIReferenceDocLinkExists(); - }); - }); - }); describe('search index details page', () => { before(async () => { // Navigate to the spaces management page which will log us in Kibana @@ -121,7 +76,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { const indexNameCodeExample = 'test-my-index2'; before(async () => { await es.indices.create({ index: indexNameCodeExample }); - await pageObjects.searchNavigation.navigateToIndexDetailPage(indexName); + await pageObjects.searchNavigation.navigateToIndexDetailPage(indexNameCodeExample); }); after(async () => { From 5e0e326c82c05d108622aed3fa6493ebb106f1e4 Mon Sep 17 00:00:00 2001 From: saarikabhasi Date: Thu, 6 Feb 2025 16:30:18 -0500 Subject: [PATCH 15/38] move index management tests from classic nav to index mgmt file --- .../page_objects/search_navigation.ts | 8 +- .../tests/index_management.ts | 186 +++++++++++++----- .../tests/search_index_details.ts | 75 ------- 3 files changed, 138 insertions(+), 131 deletions(-) diff --git a/x-pack/test/functional/page_objects/search_navigation.ts b/x-pack/test/functional/page_objects/search_navigation.ts index 8bdda764e02b6..55db7356f5da9 100644 --- a/x-pack/test/functional/page_objects/search_navigation.ts +++ b/x-pack/test/functional/page_objects/search_navigation.ts @@ -8,8 +8,12 @@ import type { FtrProviderContext } from '../ftr_provider_context'; export function SearchNavigationProvider({ getService, getPageObjects }: FtrProviderContext) { const retry = getService('retry'); - const { common, indexManagement, header, solutionNavigation } = - getPageObjects(['common', 'indexManagement', 'header', 'solutionNavigation']); + const { common, indexManagement, header, solutionNavigation } = getPageObjects([ + 'common', + 'indexManagement', + 'header', + 'solutionNavigation', + ]); const testSubjects = getService('testSubjects'); return { diff --git a/x-pack/test/functional_search/tests/index_management.ts b/x-pack/test/functional_search/tests/index_management.ts index ba452eb954e17..0010ba4e713de 100644 --- a/x-pack/test/functional_search/tests/index_management.ts +++ b/x-pack/test/functional_search/tests/index_management.ts @@ -8,6 +8,7 @@ import type { FtrProviderContext } from '../ftr_provider_context'; export default function ({ getPageObjects, getService }: FtrProviderContext) { const pageObjects = getPageObjects([ 'searchIndexDetailsPage', + 'searchApiKeys', 'header', 'common', 'indexManagement', @@ -17,72 +18,149 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { const spaces = getService('spaces'); const esDeleteAllIndices = getService('esDeleteAllIndices'); - const indexName = 'search_index'; - describe('Index management list page', function () { - let cleanUpSpace: () => Promise; - let spaceCreated: { id: string } = { id: '' }; - before(async () => { - // Navigate to the spaces management page which will log us in Kibana - await pageObjects.common.navigateToUrl('management', 'kibana/spaces', { - shouldUseHashForSubUrl: false, + const indexName = 'index_mgmt_search_index'; + describe('Index management', function () { + describe('Search solution nav', function () { + let cleanUpSpace: () => Promise; + let spaceCreated: { id: string } = { id: '' }; + before(async () => { + // Navigate to the spaces management page which will log us in Kibana + await pageObjects.common.navigateToUrl('management', 'kibana/spaces', { + shouldUseHashForSubUrl: false, + }); + + // Create a space with the search solution and navigate to its home page + ({ cleanUp: cleanUpSpace, space: spaceCreated } = await spaces.create({ + name: 'search-solution-nav-index-management-listpage-ftr', + solution: 'es', + })); + + await es.indices.create({ index: indexName }); }); - // Create a space with the search solution and navigate to its home page - ({ cleanUp: cleanUpSpace, space: spaceCreated } = await spaces.create({ - name: 'search-index-management-listpage-ftr', - solution: 'es', - })); + after(async () => { + // Clean up space created + await cleanUpSpace(); + await esDeleteAllIndices(indexName); + }); + describe('Index list page', () => { + beforeEach(async () => { + // Navigate to search solution space + await browser.navigateTo(spaces.getRootUrl(spaceCreated.id)); + // Navigate to index management app + await pageObjects.common.navigateToApp('indexManagement', { + basePath: `s/${spaceCreated.id}`, + }); + // Navigate to the indices tab + await pageObjects.indexManagement.changeTabs('indicesTab'); + await pageObjects.header.waitUntilLoadingHasFinished(); + }); + describe('manage index action', () => { + beforeEach(async () => { + await pageObjects.indexManagement.manageIndex(indexName); + await pageObjects.indexManagement.manageIndexContextMenuExists(); + }); + it('navigates to overview tab', async () => { + await pageObjects.indexManagement.changeManageIndexTab('showOverviewIndexMenuButton'); + await pageObjects.searchIndexDetailsPage.expectIndexDetailPageHeader(); + await pageObjects.searchIndexDetailsPage.expectUrlShouldChangeTo('data'); + }); - await es.indices.create({ index: indexName }); + it('navigates to settings tab', async () => { + await pageObjects.indexManagement.changeManageIndexTab('showSettingsIndexMenuButton'); + await pageObjects.searchIndexDetailsPage.expectIndexDetailPageHeader(); + await pageObjects.searchIndexDetailsPage.expectUrlShouldChangeTo('settings'); + }); + it('navigates to mappings tab', async () => { + await pageObjects.indexManagement.changeManageIndexTab('showMappingsIndexMenuButton'); + await pageObjects.searchIndexDetailsPage.expectIndexDetailPageHeader(); + await pageObjects.searchIndexDetailsPage.expectUrlShouldChangeTo('mappings'); + }); + }); + describe('can view search index details', function () { + it('renders search index details with no documents', async () => { + await pageObjects.searchIndexDetailsPage.openIndicesDetailFromIndexManagementIndicesListTable( + 0 + ); + await pageObjects.searchIndexDetailsPage.expectIndexDetailPageHeader(); + await pageObjects.searchIndexDetailsPage.expectSearchIndexDetailsTabsExists(); + await pageObjects.searchIndexDetailsPage.expectAPIReferenceDocLinkExists(); + }); + }); + }); }); + describe('Classic Nav', function () { + let cleanUpSpace: () => Promise; + let spaceCreated: { id: string } = { id: '' }; - after(async () => { - // Clean up space created - await cleanUpSpace(); - await esDeleteAllIndices(indexName); - }); - describe('index management index list page', () => { - beforeEach(async () => { - // Navigate to search solution space - await browser.navigateTo(spaces.getRootUrl(spaceCreated.id)); - // Navigate to index management app - await pageObjects.common.navigateToApp('indexManagement', { - basePath: `s/${spaceCreated.id}`, + before(async () => { + // Navigate to the spaces management page which will log us in Kibana + await pageObjects.common.navigateToUrl('management', 'kibana/spaces', { + shouldUseHashForSubUrl: false, }); - // Navigate to the indices tab - await pageObjects.indexManagement.changeTabs('indicesTab'); - await pageObjects.header.waitUntilLoadingHasFinished(); + + // Create a space with the classic nav solution and navigate to its home page + ({ cleanUp: cleanUpSpace, space: spaceCreated } = await spaces.create({ + name: 'classic-nav-index-management-listpage-ftr', + solution: 'classic', + })); + await pageObjects.searchApiKeys.deleteAPIKeys(); + await es.indices.create({ index: indexName }); }); - describe('manage index action', () => { + + after(async () => { + // Clean up space created + await cleanUpSpace(); + await esDeleteAllIndices(indexName); + }); + describe('Index list page', () => { beforeEach(async () => { - await pageObjects.indexManagement.manageIndex(indexName); - await pageObjects.indexManagement.manageIndexContextMenuExists(); + // Navigate to search solution space + await browser.navigateTo(spaces.getRootUrl(spaceCreated.id)); + // Navigate to index management app + await pageObjects.common.navigateToApp('indexManagement', { + basePath: `s/${spaceCreated.id}`, + }); + // Navigate to the indices tab + await pageObjects.indexManagement.changeTabs('indicesTab'); + await pageObjects.header.waitUntilLoadingHasFinished(); }); - it('navigates to overview tab', async () => { - await pageObjects.indexManagement.changeManageIndexTab('showOverviewIndexMenuButton'); - await pageObjects.searchIndexDetailsPage.expectIndexDetailPageHeader(); - await pageObjects.searchIndexDetailsPage.expectUrlShouldChangeTo('data'); + after(async () => { + await esDeleteAllIndices(indexName); }); + describe('manage index action', () => { + beforeEach(async () => { + await pageObjects.indexManagement.manageIndex(indexName); + await pageObjects.indexManagement.manageIndexContextMenuExists(); + }); + it('navigates to overview tab', async () => { + await pageObjects.indexManagement.changeManageIndexTab('showOverviewIndexMenuButton'); + await pageObjects.indexManagement.indexDetailsPage.expectIndexDetailsPageIsLoaded(); + await pageObjects.indexManagement.indexDetailsPage.expectUrlShouldChangeTo('overview'); + }); - it('navigates to settings tab', async () => { - await pageObjects.indexManagement.changeManageIndexTab('showSettingsIndexMenuButton'); - await pageObjects.searchIndexDetailsPage.expectIndexDetailPageHeader(); - await pageObjects.searchIndexDetailsPage.expectUrlShouldChangeTo('settings'); - }); - it('navigates to mappings tab', async () => { - await pageObjects.indexManagement.changeManageIndexTab('showMappingsIndexMenuButton'); - await pageObjects.searchIndexDetailsPage.expectIndexDetailPageHeader(); - await pageObjects.searchIndexDetailsPage.expectUrlShouldChangeTo('mappings'); + it('navigates to settings tab', async () => { + await pageObjects.indexManagement.changeManageIndexTab('showSettingsIndexMenuButton'); + await pageObjects.indexManagement.indexDetailsPage.expectIndexDetailsPageIsLoaded(); + await pageObjects.indexManagement.indexDetailsPage.expectUrlShouldChangeTo('settings'); + }); + it('navigates to mappings tab', async () => { + await pageObjects.indexManagement.changeManageIndexTab('showMappingsIndexMenuButton'); + await pageObjects.indexManagement.indexDetailsPage.expectIndexDetailsPageIsLoaded(); + await pageObjects.indexManagement.indexDetailsPage.expectUrlShouldChangeTo('mappings'); + }); }); - }); - describe('can view search index details', function () { - it('renders search index details with no documents', async () => { - await pageObjects.searchIndexDetailsPage.openIndicesDetailFromIndexManagementIndicesListTable( - 0 - ); - await pageObjects.searchIndexDetailsPage.expectIndexDetailPageHeader(); - await pageObjects.searchIndexDetailsPage.expectSearchIndexDetailsTabsExists(); - await pageObjects.searchIndexDetailsPage.expectAPIReferenceDocLinkExists(); + describe('can view index management index details page', function () { + it('navigates to the index management index details page from the home page', async () => { + // display hidden indices to have some rows in the indices table + await pageObjects.indexManagement.toggleHiddenIndices(); + // click the first index in the table and wait for the index details page + await pageObjects.indexManagement.indexDetailsPage.openIndexDetailsPage(0); + await pageObjects.indexManagement.indexDetailsPage.expectIndexDetailsPageIsLoaded(); + await pageObjects.indexManagement.indexDetailsPage.expectBreadcrumbNavigationToHaveBreadcrumbName( + 'Overview' + ); + }); }); }); }); diff --git a/x-pack/test/functional_search/tests/search_index_details.ts b/x-pack/test/functional_search/tests/search_index_details.ts index 1ff4476ad6f78..fefdddbf3f2f6 100644 --- a/x-pack/test/functional_search/tests/search_index_details.ts +++ b/x-pack/test/functional_search/tests/search_index_details.ts @@ -267,80 +267,5 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { }); }); }); - describe('Classic Nav', function () { - let cleanUpSpace: () => Promise; - let spaceCreated: { id: string } = { id: '' }; - - before(async () => { - // Navigate to the spaces management page which will log us in Kibana - await pageObjects.common.navigateToUrl('management', 'kibana/spaces', { - shouldUseHashForSubUrl: false, - }); - - // Create a space with the classic nav solution and navigate to its home page - ({ cleanUp: cleanUpSpace, space: spaceCreated } = await spaces.create({ - name: 'classic-nav-search-index-details-ftr', - solution: 'classic', - })); - await pageObjects.searchApiKeys.deleteAPIKeys(); - await es.indices.create({ index: indexName }); - }); - - after(async () => { - // Clean up space created - await cleanUpSpace(); - await esDeleteAllIndices(indexName); - }); - describe('index management index list page', () => { - beforeEach(async () => { - // Navigate to search solution space - await browser.navigateTo(spaces.getRootUrl(spaceCreated.id)); - // Navigate to index management app - await pageObjects.common.navigateToApp('indexManagement', { - basePath: `s/${spaceCreated.id}`, - }); - // Navigate to the indices tab - await pageObjects.indexManagement.changeTabs('indicesTab'); - await pageObjects.header.waitUntilLoadingHasFinished(); - }); - after(async () => { - await esDeleteAllIndices(indexName); - }); - describe('manage index action', () => { - beforeEach(async () => { - await pageObjects.indexManagement.manageIndex(indexName); - await pageObjects.indexManagement.manageIndexContextMenuExists(); - }); - it('navigates to overview tab', async () => { - await pageObjects.indexManagement.changeManageIndexTab('showOverviewIndexMenuButton'); - await pageObjects.indexManagement.indexDetailsPage.expectIndexDetailsPageIsLoaded(); - await pageObjects.indexManagement.indexDetailsPage.expectUrlShouldChangeTo('overview'); - }); - - it('navigates to settings tab', async () => { - await pageObjects.indexManagement.changeManageIndexTab('showSettingsIndexMenuButton'); - await pageObjects.indexManagement.indexDetailsPage.expectIndexDetailsPageIsLoaded(); - await pageObjects.indexManagement.indexDetailsPage.expectUrlShouldChangeTo('settings'); - }); - it('navigates to mappings tab', async () => { - await pageObjects.indexManagement.changeManageIndexTab('showMappingsIndexMenuButton'); - await pageObjects.indexManagement.indexDetailsPage.expectIndexDetailsPageIsLoaded(); - await pageObjects.indexManagement.indexDetailsPage.expectUrlShouldChangeTo('mappings'); - }); - }); - describe('can view index management index details page', function () { - it('navigates to the index management index details page from the home page', async () => { - // display hidden indices to have some rows in the indices table - await pageObjects.indexManagement.toggleHiddenIndices(); - // click the first index in the table and wait for the index details page - await pageObjects.indexManagement.indexDetailsPage.openIndexDetailsPage(0); - await pageObjects.indexManagement.indexDetailsPage.expectIndexDetailsPageIsLoaded(); - await pageObjects.indexManagement.indexDetailsPage.expectBreadcrumbNavigationToHaveBreadcrumbName( - 'Overview' - ); - }); - }); - }); - }); }); } From 7c815fc25054a272813f4b72ae271c4e71c87fb4 Mon Sep 17 00:00:00 2001 From: saarikabhasi Date: Sun, 9 Feb 2025 12:57:20 -0500 Subject: [PATCH 16/38] add new variable to the setBreadcrumb add breadcrumb to management plugin --- .../public/components/landing/landing.tsx | 3 ++ .../management_app/management_app.tsx | 9 ++++-- .../management_app/management_router.tsx | 4 +++ .../management_app_wrapper.tsx | 5 ++- .../shared/management/public/plugin.tsx | 13 ++------ .../plugins/shared/management/public/types.ts | 1 + .../management/public/utils/breadcrumbs.ts | 6 ++++ .../shared/management/public/utils/index.ts | 6 +++- .../helpers/setup_environment.tsx | 5 ++- .../__jest__/components/index_table.test.js | 5 ++- .../helpers/setup_environment.tsx | 5 ++- .../application/mount_management_section.ts | 4 +-- .../sections/home/index_list/index_list.tsx | 8 ++--- .../application/services/breadcrumbs.ts | 31 ++++++++----------- .../public/application/services/routing.ts | 2 +- x-pack/test/functional_search/index.ts | 10 +++--- 16 files changed, 68 insertions(+), 49 deletions(-) diff --git a/src/platform/plugins/shared/management/public/components/landing/landing.tsx b/src/platform/plugins/shared/management/public/components/landing/landing.tsx index ffa5c7d0fd7e2..6acf576cf8023 100644 --- a/src/platform/plugins/shared/management/public/components/landing/landing.tsx +++ b/src/platform/plugins/shared/management/public/components/landing/landing.tsx @@ -19,15 +19,18 @@ import { SolutionEmptyPrompt } from './solution_empty_prompt'; interface ManagementLandingPageProps { onAppMounted: (id: string) => void; setBreadcrumbs: () => void; + setContentBreadcrumbs?: () => void; } export const ManagementLandingPage = ({ setBreadcrumbs, onAppMounted, + setContentBreadcrumbs, }: ManagementLandingPageProps) => { const { appBasePath, sections, kibanaVersion, cardsNavigationConfig, chromeStyle, coreStart } = useAppContext(); setBreadcrumbs(); + if (setContentBreadcrumbs) setContentBreadcrumbs(); useEffect(() => { onAppMounted(''); diff --git a/src/platform/plugins/shared/management/public/components/management_app/management_app.tsx b/src/platform/plugins/shared/management/public/components/management_app/management_app.tsx index 39e38182ddbeb..4ae9a97ed7ef1 100644 --- a/src/platform/plugins/shared/management/public/components/management_app/management_app.tsx +++ b/src/platform/plugins/shared/management/public/components/management_app/management_app.tsx @@ -27,6 +27,7 @@ import { ManagementSection, MANAGEMENT_BREADCRUMB, MANAGEMENT_BREADCRUMB_NO_HREF, + CONTENT_BREADCRUMB_NO_HREF, } from '../../utils'; import { ManagementRouter } from './management_router'; import { managementSidebarNav } from '../management_sidebar_nav/management_sidebar_nav'; @@ -61,6 +62,7 @@ export const ManagementApp = ({ dependencies, history, appBasePath }: Management setSelectedId(id); window.scrollTo(0, 0); }, []); + const [showContentBreadcrumbs, setContentBreadcrumbs] = useState(undefined); const setBreadcrumbsScoped = useCallback( (crumbs: ChromeBreadcrumb[] = [], appHistory?: ScopedHistory) => { @@ -72,7 +74,9 @@ export const ManagementApp = ({ dependencies, history, appBasePath }: Management // Clicking the Management breadcrumb to navigate back to the "root" only // makes sense if there's a management app open. So when one isn't open // this breadcrumb shouldn't be a clickable link. - const managementBreadcrumb = crumbs.length + const managementBreadcrumb = showContentBreadcrumbs + ? CONTENT_BREADCRUMB_NO_HREF + : crumbs.length ? MANAGEMENT_BREADCRUMB : MANAGEMENT_BREADCRUMB_NO_HREF; setBreadcrumbs([ @@ -80,7 +84,7 @@ export const ManagementApp = ({ dependencies, history, appBasePath }: Management ...crumbs.map((item) => wrapBreadcrumb(item, appHistory || history)), ]); }, - [setBreadcrumbs, history] + [setBreadcrumbs, history, showContentBreadcrumbs] ); useEffect(() => { @@ -134,6 +138,7 @@ export const ManagementApp = ({ dependencies, history, appBasePath }: Management onAppMounted={onAppMounted} sections={sections} analytics={coreStart.analytics} + setContentBreadcrumbs={(value?: boolean) => setContentBreadcrumbs(value)} /> diff --git a/src/platform/plugins/shared/management/public/components/management_app/management_router.tsx b/src/platform/plugins/shared/management/public/components/management_app/management_router.tsx index f10b26d1bae06..c2c8c1edbfc8d 100644 --- a/src/platform/plugins/shared/management/public/components/management_app/management_router.tsx +++ b/src/platform/plugins/shared/management/public/components/management_app/management_router.tsx @@ -29,6 +29,7 @@ interface ManagementRouterProps { onAppMounted: (id: string) => void; sections: ManagementSection[]; analytics: AnalyticsServiceStart; + setContentBreadcrumbs?: (value?: boolean) => void; } export const ManagementRouter = memo( @@ -39,6 +40,7 @@ export const ManagementRouter = memo( sections, theme, analytics, + setContentBreadcrumbs, }: ManagementRouterProps) => { return ( @@ -58,6 +60,7 @@ export const ManagementRouter = memo( onAppMounted={onAppMounted} history={history} theme={theme} + setContentBreadcrumbs={setContentBreadcrumbs} /> )} /> @@ -76,6 +79,7 @@ export const ManagementRouter = memo( )} /> diff --git a/src/platform/plugins/shared/management/public/components/management_app_wrapper/management_app_wrapper.tsx b/src/platform/plugins/shared/management/public/components/management_app_wrapper/management_app_wrapper.tsx index 2105b94739c75..834bbec31fa75 100644 --- a/src/platform/plugins/shared/management/public/components/management_app_wrapper/management_app_wrapper.tsx +++ b/src/platform/plugins/shared/management/public/components/management_app_wrapper/management_app_wrapper.tsx @@ -27,6 +27,7 @@ interface ManagementSectionWrapperProps { onAppMounted: (id: string) => void; history: AppMountParameters['history']; theme: ThemeServiceStart; + setContentBreadcrumbs?: (value: boolean) => void; } interface ManagementSectionWrapperState { @@ -46,7 +47,7 @@ export class ManagementAppWrapper extends Component< } componentDidMount() { - const { setBreadcrumbs, app, onAppMounted, history, theme } = this.props; + const { setBreadcrumbs, app, onAppMounted, history, theme, setContentBreadcrumbs } = this.props; const { mount, basePath } = app; const appHistory = history.createSubHistory(app.basePath); @@ -60,6 +61,8 @@ export class ManagementAppWrapper extends Component< history: appHistory, theme, theme$, + setContentBreadcrumbs: (value) => + setContentBreadcrumbs ? setContentBreadcrumbs(value) : undefined, }); onAppMounted(app.id); diff --git a/src/platform/plugins/shared/management/public/plugin.tsx b/src/platform/plugins/shared/management/public/plugin.tsx index b1ea4a8db8653..97778792316ea 100644 --- a/src/platform/plugins/shared/management/public/plugin.tsx +++ b/src/platform/plugins/shared/management/public/plugin.tsx @@ -131,17 +131,8 @@ export class ManagementPlugin const [, ...trailingBreadcrumbs] = newBreadcrumbs; deps.serverless.setBreadcrumbs(trailingBreadcrumbs); } else { - coreStart.chrome.getActiveSolutionNavId$().subscribe((activeSolutionId) => { - if (activeSolutionId === 'es') { - const [, ...trailingBreadcrumbs] = newBreadcrumbs; - coreStart.chrome.setBreadcrumbs(trailingBreadcrumbs, { - project: { value: trailingBreadcrumbs, absolute: true }, - }); - } else { - coreStart.chrome.setBreadcrumbs(newBreadcrumbs, { - project: { value: newBreadcrumbs, absolute: true }, - }); - } + coreStart.chrome.setBreadcrumbs(newBreadcrumbs, { + project: { value: newBreadcrumbs, absolute: true }, }); } }, diff --git a/src/platform/plugins/shared/management/public/types.ts b/src/platform/plugins/shared/management/public/types.ts index 2e6f900de6298..f7916c46afa5d 100644 --- a/src/platform/plugins/shared/management/public/types.ts +++ b/src/platform/plugins/shared/management/public/types.ts @@ -81,6 +81,7 @@ export interface ManagementAppMountParams { theme: ThemeServiceStart; /** @deprecated - use `theme` **/ theme$: Observable; + setContentBreadcrumbs?: (showContentBreadcrumbs: boolean) => void; } export interface CreateManagementItemArgs { diff --git a/src/platform/plugins/shared/management/public/utils/breadcrumbs.ts b/src/platform/plugins/shared/management/public/utils/breadcrumbs.ts index e6467173387a9..6d183c6bd146e 100644 --- a/src/platform/plugins/shared/management/public/utils/breadcrumbs.ts +++ b/src/platform/plugins/shared/management/public/utils/breadcrumbs.ts @@ -12,6 +12,9 @@ import { i18n } from '@kbn/i18n'; const managementBreadcrumbText = i18n.translate('management.breadcrumb', { defaultMessage: 'Stack Management', }); +const contentBreadcrumbText = i18n.translate('content.breadcrumb', { + defaultMessage: 'Content', +}); export const MANAGEMENT_BREADCRUMB_NO_HREF = { text: managementBreadcrumbText, @@ -21,3 +24,6 @@ export const MANAGEMENT_BREADCRUMB = { text: managementBreadcrumbText, href: '/', }; +export const CONTENT_BREADCRUMB_NO_HREF = { + text: contentBreadcrumbText, +}; diff --git a/src/platform/plugins/shared/management/public/utils/index.ts b/src/platform/plugins/shared/management/public/utils/index.ts index 6af869fe694bb..f0602ec8bc25f 100644 --- a/src/platform/plugins/shared/management/public/utils/index.ts +++ b/src/platform/plugins/shared/management/public/utils/index.ts @@ -7,7 +7,11 @@ * License v3.0 only", or the "Server Side Public License, v 1". */ -export { MANAGEMENT_BREADCRUMB, MANAGEMENT_BREADCRUMB_NO_HREF } from './breadcrumbs'; +export { + MANAGEMENT_BREADCRUMB, + MANAGEMENT_BREADCRUMB_NO_HREF, + CONTENT_BREADCRUMB_NO_HREF, +} from './breadcrumbs'; export type { RegisterManagementAppArgs } from './management_app'; export { ManagementApp } from './management_app'; export type { RegisterManagementSectionArgs } from './management_section'; diff --git a/x-pack/platform/plugins/shared/index_management/__jest__/client_integration/helpers/setup_environment.tsx b/x-pack/platform/plugins/shared/index_management/__jest__/client_integration/helpers/setup_environment.tsx index 9694b6c19dc50..2a903ece46cd1 100644 --- a/x-pack/platform/plugins/shared/index_management/__jest__/client_integration/helpers/setup_environment.tsx +++ b/x-pack/platform/plugins/shared/index_management/__jest__/client_integration/helpers/setup_environment.tsx @@ -114,7 +114,10 @@ const { Provider: KibanaReactContextProvider } = createKibanaReactContext({ }); export const setupEnvironment = () => { - breadcrumbService.setup(() => undefined); + breadcrumbService.setup( + () => undefined, + () => undefined + ); documentationService.setup(docLinksServiceMock.createStartContract()); notificationService.setup(notificationServiceMock.createStartContract()); diff --git a/x-pack/platform/plugins/shared/index_management/__jest__/components/index_table.test.js b/x-pack/platform/plugins/shared/index_management/__jest__/components/index_table.test.js index 72aa38b600996..fad8664e6bccf 100644 --- a/x-pack/platform/plugins/shared/index_management/__jest__/components/index_table.test.js +++ b/x-pack/platform/plugins/shared/index_management/__jest__/components/index_table.test.js @@ -155,7 +155,10 @@ describe('index table', () => { setUiMetricService(services.uiMetricService); httpService.setup(httpSetup); - breadcrumbService.setup(() => undefined); + breadcrumbService.setup( + () => undefined, + () => undefined + ); notificationService.setup(notificationServiceMock.createStartContract()); store = indexManagementStore(services); diff --git a/x-pack/platform/plugins/shared/index_management/public/application/components/component_templates/__jest__/client_integration/helpers/setup_environment.tsx b/x-pack/platform/plugins/shared/index_management/public/application/components/component_templates/__jest__/client_integration/helpers/setup_environment.tsx index 00554b9ec1a14..b3dd0b3a2dd09 100644 --- a/x-pack/platform/plugins/shared/index_management/public/application/components/component_templates/__jest__/client_integration/helpers/setup_environment.tsx +++ b/x-pack/platform/plugins/shared/index_management/public/application/components/component_templates/__jest__/client_integration/helpers/setup_environment.tsx @@ -57,7 +57,10 @@ export const componentTemplatesDependencies = (httpSetup: HttpSetup, coreStart?: }; export const setupEnvironment = () => { - breadcrumbService.setup(() => undefined); + breadcrumbService.setup( + () => undefined, + () => undefined + ); return initHttpRequests(); }; diff --git a/x-pack/platform/plugins/shared/index_management/public/application/mount_management_section.ts b/x-pack/platform/plugins/shared/index_management/public/application/mount_management_section.ts index 4cc57c2b06a07..8f8d0ae6b10cc 100644 --- a/x-pack/platform/plugins/shared/index_management/public/application/mount_management_section.ts +++ b/x-pack/platform/plugins/shared/index_management/public/application/mount_management_section.ts @@ -137,7 +137,7 @@ export async function mountManagementSection({ cloud?: CloudSetup; canUseSyntheticSource: boolean; }) { - const { element, setBreadcrumbs, history } = params; + const { element, setBreadcrumbs, history, setContentBreadcrumbs } = params; const [core, startDependencies] = await coreSetup.getStartServices(); const { docLinks, @@ -145,7 +145,7 @@ export async function mountManagementSection({ } = core; docTitle.change(PLUGIN.getI18nName(i18n)); - breadcrumbService.setup(setBreadcrumbs); + breadcrumbService.setup(setBreadcrumbs, setContentBreadcrumbs); documentationService.setup(docLinks); const { uiMetricService } = initSetup({ diff --git a/x-pack/platform/plugins/shared/index_management/public/application/sections/home/index_list/index_list.tsx b/x-pack/platform/plugins/shared/index_management/public/application/sections/home/index_list/index_list.tsx index 0ec6e08283edd..8d14a0d60e3c6 100644 --- a/x-pack/platform/plugins/shared/index_management/public/application/sections/home/index_list/index_list.tsx +++ b/x-pack/platform/plugins/shared/index_management/public/application/sections/home/index_list/index_list.tsx @@ -28,11 +28,9 @@ export const IndexList: React.FunctionComponent = ({ histor const activeSolutionId = useObservable(chrome.getActiveSolutionNavId$()); useEffect(() => { - if (!cloud?.isServerlessEnabled && activeSolutionId === 'es') { - breadcrumbService.setBreadcrumbs(IndexManagementBreadcrumb.indicesList); - } else { - breadcrumbService.setBreadcrumbs(IndexManagementBreadcrumb.indices); - } + const isActiveSolutionSearch = !cloud?.isServerlessEnabled && activeSolutionId === 'es'; + breadcrumbService.setBreadcrumbs(IndexManagementBreadcrumb.indices); + breadcrumbService.setContentBreadcrumbs(isActiveSolutionSearch); }, [activeSolutionId, cloud]); return ( diff --git a/x-pack/platform/plugins/shared/index_management/public/application/services/breadcrumbs.ts b/x-pack/platform/plugins/shared/index_management/public/application/services/breadcrumbs.ts index 6aad9f4988f66..a9b121294b427 100644 --- a/x-pack/platform/plugins/shared/index_management/public/application/services/breadcrumbs.ts +++ b/x-pack/platform/plugins/shared/index_management/public/application/services/breadcrumbs.ts @@ -10,6 +10,7 @@ import { ManagementAppMountParams } from '@kbn/management-plugin/public'; import { EuiBreadcrumb } from '@elastic/eui'; type SetBreadcrumbs = ManagementAppMountParams['setBreadcrumbs']; +type SetContentBreadcrumbs = ManagementAppMountParams['setContentBreadcrumbs']; export enum IndexManagementBreadcrumb { home = 'home', @@ -56,16 +57,14 @@ export class BreadcrumbService { home: [] as EuiBreadcrumb[], }; private setBreadcrumbsHandler?: SetBreadcrumbs; + private setContentBreadcrumbsHandler?: SetContentBreadcrumbs; - public setup(setBreadcrumbsHandler: SetBreadcrumbs): void { + public setup( + setBreadcrumbsHandler: SetBreadcrumbs, + setContentBreadcrumbsHandler: SetContentBreadcrumbs + ): void { this.setBreadcrumbsHandler = setBreadcrumbsHandler; - this.breadcrumbs.content = [ - { - text: i18n.translate('xpack.idxMgmt.breadcrumb.contentLabel', { - defaultMessage: 'Content', - }), - }, - ]; + this.setContentBreadcrumbsHandler = setContentBreadcrumbsHandler; this.breadcrumbs.home = [ { text: i18n.translate('xpack.idxMgmt.breadcrumb.homeLabel', { @@ -203,16 +202,6 @@ export class BreadcrumbService { href: `/enrich_policies/create`, }, ]; - this.breadcrumbs.indicesList = [ - ...this.breadcrumbs.content, - ...this.breadcrumbs.home, - { - text: i18n.translate('xpack.idxMgmt.breadcrumb.indicesListLabel', { - defaultMessage: 'Indices', - }), - href: `/indices`, - }, - ]; } public setBreadcrumbs( @@ -245,6 +234,12 @@ export class BreadcrumbService { this.setBreadcrumbsHandler(newBreadcrumbs); } + public setContentBreadcrumbs(showContentBreadcrumb: boolean): void { + if (!this.setContentBreadcrumbsHandler) { + throw new Error(`BreadcrumbService#setup() must be called first!`); + } + this.setContentBreadcrumbsHandler(showContentBreadcrumb); + } } export const breadcrumbService = new BreadcrumbService(); diff --git a/x-pack/platform/plugins/shared/index_management/public/application/services/routing.ts b/x-pack/platform/plugins/shared/index_management/public/application/services/routing.ts index 1ba519bba1ee7..8dd67553058e6 100644 --- a/x-pack/platform/plugins/shared/index_management/public/application/services/routing.ts +++ b/x-pack/platform/plugins/shared/index_management/public/application/services/routing.ts @@ -110,6 +110,6 @@ export const navigateToIndexDetailsPage = ( } else { const route = extensionsService.indexDetailsPageRoute.renderRoute(indexName, tabId); application.navigateToUrl(http.basePath.prepend(route)); - breadcrumbService.setBreadcrumbs(IndexManagementBreadcrumb.indicesList, { text: indexName }); + breadcrumbService.setBreadcrumbs(IndexManagementBreadcrumb.indices, { text: indexName }); } }; diff --git a/x-pack/test/functional_search/index.ts b/x-pack/test/functional_search/index.ts index 6f2eb1dccff72..ce70b80a9c2ce 100644 --- a/x-pack/test/functional_search/index.ts +++ b/x-pack/test/functional_search/index.ts @@ -10,11 +10,11 @@ import { FtrProviderContext } from './ftr_provider_context'; export default ({ loadTestFile }: FtrProviderContext): void => { describe('Search solution tests', function () { - loadTestFile(require.resolve('./tests/search_overview')); - loadTestFile(require.resolve('./tests/classic_navigation')); - loadTestFile(require.resolve('./tests/solution_navigation')); - loadTestFile(require.resolve('./tests/search_start')); + // loadTestFile(require.resolve('./tests/search_overview')); + // loadTestFile(require.resolve('./tests/classic_navigation')); + // loadTestFile(require.resolve('./tests/solution_navigation')); + // loadTestFile(require.resolve('./tests/search_start')); loadTestFile(require.resolve('./tests/search_index_details')); - loadTestFile(require.resolve('./tests/index_management')); + // loadTestFile(require.resolve('./tests/index_management')); }); }; From 50b2744c43d154508a7662982755e7dbd7a7bc55 Mon Sep 17 00:00:00 2001 From: saarikabhasi Date: Tue, 11 Feb 2025 11:18:25 -0500 Subject: [PATCH 17/38] update i18n_check --- .../plugins/shared/management/public/utils/breadcrumbs.ts | 4 ++-- .../plugins/private/translations/translations/fr-FR.json | 3 +-- .../plugins/private/translations/translations/ja-JP.json | 3 +-- .../plugins/private/translations/translations/zh-CN.json | 3 +-- 4 files changed, 5 insertions(+), 8 deletions(-) diff --git a/src/platform/plugins/shared/management/public/utils/breadcrumbs.ts b/src/platform/plugins/shared/management/public/utils/breadcrumbs.ts index 6d183c6bd146e..cbbfaf0197288 100644 --- a/src/platform/plugins/shared/management/public/utils/breadcrumbs.ts +++ b/src/platform/plugins/shared/management/public/utils/breadcrumbs.ts @@ -9,10 +9,10 @@ import { i18n } from '@kbn/i18n'; -const managementBreadcrumbText = i18n.translate('management.breadcrumb', { +const managementBreadcrumbText = i18n.translate('management.stackManagement.breadcrumb', { defaultMessage: 'Stack Management', }); -const contentBreadcrumbText = i18n.translate('content.breadcrumb', { +const contentBreadcrumbText = i18n.translate('management.content.breadcrumb', { defaultMessage: 'Content', }); diff --git a/x-pack/platform/plugins/private/translations/translations/fr-FR.json b/x-pack/platform/plugins/private/translations/translations/fr-FR.json index e80522cbb58c5..9f874f1ed4cb7 100644 --- a/x-pack/platform/plugins/private/translations/translations/fr-FR.json +++ b/x-pack/platform/plugins/private/translations/translations/fr-FR.json @@ -6034,7 +6034,6 @@ "lists.exceptions.isOperatorLabel": "est", "lists.exceptions.matchesOperatorLabel": "correspond à", "managedContentBadge.text": "Géré", - "management.breadcrumb": "Gestion de la Suite", "management.landing.header": "Bienvenue dans Gestion de la Suite {version}", "management.landing.solution.header": "Gestion de la Suite {version}", "management.landing.solution.subhead": "Gérez vos {indicesLink}, {dataViewsLink}, {ingestPipelinesLink}, {usersLink}, et plus encore.", @@ -46820,4 +46819,4 @@ "xpack.watcher.watchEdit.thresholdWatchExpression.aggType.fieldIsRequiredValidationMessage": "Ce champ est requis.", "xpack.watcher.watcherDescription": "Détectez les modifications survenant dans vos données en créant, gérant et monitorant des alertes." } -} \ No newline at end of file +} diff --git a/x-pack/platform/plugins/private/translations/translations/ja-JP.json b/x-pack/platform/plugins/private/translations/translations/ja-JP.json index 23fd2aa48ce89..f894928593bd3 100644 --- a/x-pack/platform/plugins/private/translations/translations/ja-JP.json +++ b/x-pack/platform/plugins/private/translations/translations/ja-JP.json @@ -6028,7 +6028,6 @@ "lists.exceptions.isOperatorLabel": "is", "lists.exceptions.matchesOperatorLabel": "一致", "managedContentBadge.text": "管理中", - "management.breadcrumb": "スタック管理", "management.landing.header": "Stack Management {version}へようこそ", "management.landing.solution.header": "スタック管理{version}", "management.landing.solution.subhead": "{indicesLink}、{dataViewsLink}、{ingestPipelinesLink}、{usersLink}などを管理します。", @@ -46671,4 +46670,4 @@ "xpack.watcher.watchEdit.thresholdWatchExpression.aggType.fieldIsRequiredValidationMessage": "フィールドを選択してください。", "xpack.watcher.watcherDescription": "アラートの作成、管理、監視によりデータへの変更を検知します。" } -} \ No newline at end of file +} diff --git a/x-pack/platform/plugins/private/translations/translations/zh-CN.json b/x-pack/platform/plugins/private/translations/translations/zh-CN.json index 848c1ee2dbaf1..3b8711b2f589d 100644 --- a/x-pack/platform/plugins/private/translations/translations/zh-CN.json +++ b/x-pack/platform/plugins/private/translations/translations/zh-CN.json @@ -5986,7 +5986,6 @@ "lists.exceptions.isOperatorLabel": "是", "lists.exceptions.matchesOperatorLabel": "匹配", "managedContentBadge.text": "托管", - "management.breadcrumb": "Stack Management", "management.landing.header": "欢迎使用 Stack Management {version}", "management.landing.solution.header": "Stack Management {version}", "management.landing.solution.subhead": "管理您的 {indicesLink}、{dataViewsLink}、{ingestPipelinesLink}、{usersLink} 等。", @@ -45974,4 +45973,4 @@ "xpack.watcher.watchEdit.thresholdWatchExpression.aggType.fieldIsRequiredValidationMessage": "此字段必填。", "xpack.watcher.watcherDescription": "通过创建、管理和监测警报来检测数据中的更改。" } -} \ No newline at end of file +} From 0f4ea73f0a2c7f1f56516f1264e35f1e21e0d2ee Mon Sep 17 00:00:00 2001 From: saarikabhasi Date: Tue, 11 Feb 2025 18:35:38 -0500 Subject: [PATCH 18/38] update FTR for search_sidenav --- x-pack/test/functional_solution_sidenav/tests/search_sidenav.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x-pack/test/functional_solution_sidenav/tests/search_sidenav.ts b/x-pack/test/functional_solution_sidenav/tests/search_sidenav.ts index e179045a90947..73c7edc496c19 100644 --- a/x-pack/test/functional_solution_sidenav/tests/search_sidenav.ts +++ b/x-pack/test/functional_solution_sidenav/tests/search_sidenav.ts @@ -66,7 +66,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { await solutionNavigation.sidenav.openSection('project_settings_project_nav'); await solutionNavigation.sidenav.clickLink({ navId: 'stack_management' }); await solutionNavigation.sidenav.expectLinkActive({ navId: 'stack_management' }); - await solutionNavigation.breadcrumbs.expectBreadcrumbExists({ text: 'Stack Management' }); + await solutionNavigation.breadcrumbs.expectBreadcrumbExists({ text: 'Content' }); // navigate back to the home page using header logo await solutionNavigation.clickLogo(); From e5db3a68cc777b2bbda05d14c2b18859997f551b Mon Sep 17 00:00:00 2001 From: saarikabhasi Date: Wed, 26 Feb 2025 18:10:49 -0500 Subject: [PATCH 19/38] Revert "update i18n_check" This reverts commit 50b2744c43d154508a7662982755e7dbd7a7bc55. Revert "update FTR for search_sidenav" This reverts commit 0f4ea73f0a2c7f1f56516f1264e35f1e21e0d2ee. Revert "add new variable to the setBreadcrumb" This reverts commit 7c815fc25054a272813f4b72ae271c4e71c87fb4. Revert "fix ci error" This reverts commit 2c60095cd069b12c2d6e488d7bc9c789094d76b8. Revert "clean up" This reverts commit e47735c5d3d1f1f378c938e8b298bd68bc22910c. Revert "fix serverless version breadcrumb" This reverts commit 2ce55e32cf08f75db1afae6ae23962a0f7d8a6ee. Revert "add index name for stack solution nav" This reverts commit 858d4d52cfc0f3d12270b564b670d38ab1a42f33. Revert "update index management breadcrumb" This reverts commit 60b517a6079d036be0bcdd05e9fd76920280ddc7. --- .../public/components/landing/landing.tsx | 3 --- .../management_app/management_app.tsx | 9 ++------- .../management_app/management_router.tsx | 4 ---- .../management_app_wrapper.tsx | 5 +---- .../plugins/shared/management/public/types.ts | 1 - .../management/public/utils/breadcrumbs.ts | 8 +------- .../shared/management/public/utils/index.ts | 6 +----- .../translations/translations/fr-FR.json | 3 ++- .../translations/translations/ja-JP.json | 3 ++- .../translations/translations/zh-CN.json | 3 ++- .../helpers/setup_environment.tsx | 5 +---- .../__jest__/components/index_table.test.js | 5 +---- .../helpers/setup_environment.tsx | 5 +---- .../application/mount_management_section.ts | 4 ++-- .../index_actions_context_menu.js | 4 ---- .../sections/home/index_list/index_list.tsx | 9 ++------- .../index_list/index_table/index_table.js | 4 +--- .../application/services/breadcrumbs.ts | 19 ++----------------- .../application/services/routing.test.ts | 14 +------------- .../public/application/services/routing.ts | 5 +---- x-pack/test/functional_search/index.ts | 10 +++++----- .../tests/search_sidenav.ts | 4 ++-- 22 files changed, 30 insertions(+), 103 deletions(-) diff --git a/src/platform/plugins/shared/management/public/components/landing/landing.tsx b/src/platform/plugins/shared/management/public/components/landing/landing.tsx index 6acf576cf8023..ffa5c7d0fd7e2 100644 --- a/src/platform/plugins/shared/management/public/components/landing/landing.tsx +++ b/src/platform/plugins/shared/management/public/components/landing/landing.tsx @@ -19,18 +19,15 @@ import { SolutionEmptyPrompt } from './solution_empty_prompt'; interface ManagementLandingPageProps { onAppMounted: (id: string) => void; setBreadcrumbs: () => void; - setContentBreadcrumbs?: () => void; } export const ManagementLandingPage = ({ setBreadcrumbs, onAppMounted, - setContentBreadcrumbs, }: ManagementLandingPageProps) => { const { appBasePath, sections, kibanaVersion, cardsNavigationConfig, chromeStyle, coreStart } = useAppContext(); setBreadcrumbs(); - if (setContentBreadcrumbs) setContentBreadcrumbs(); useEffect(() => { onAppMounted(''); diff --git a/src/platform/plugins/shared/management/public/components/management_app/management_app.tsx b/src/platform/plugins/shared/management/public/components/management_app/management_app.tsx index 4ae9a97ed7ef1..39e38182ddbeb 100644 --- a/src/platform/plugins/shared/management/public/components/management_app/management_app.tsx +++ b/src/platform/plugins/shared/management/public/components/management_app/management_app.tsx @@ -27,7 +27,6 @@ import { ManagementSection, MANAGEMENT_BREADCRUMB, MANAGEMENT_BREADCRUMB_NO_HREF, - CONTENT_BREADCRUMB_NO_HREF, } from '../../utils'; import { ManagementRouter } from './management_router'; import { managementSidebarNav } from '../management_sidebar_nav/management_sidebar_nav'; @@ -62,7 +61,6 @@ export const ManagementApp = ({ dependencies, history, appBasePath }: Management setSelectedId(id); window.scrollTo(0, 0); }, []); - const [showContentBreadcrumbs, setContentBreadcrumbs] = useState(undefined); const setBreadcrumbsScoped = useCallback( (crumbs: ChromeBreadcrumb[] = [], appHistory?: ScopedHistory) => { @@ -74,9 +72,7 @@ export const ManagementApp = ({ dependencies, history, appBasePath }: Management // Clicking the Management breadcrumb to navigate back to the "root" only // makes sense if there's a management app open. So when one isn't open // this breadcrumb shouldn't be a clickable link. - const managementBreadcrumb = showContentBreadcrumbs - ? CONTENT_BREADCRUMB_NO_HREF - : crumbs.length + const managementBreadcrumb = crumbs.length ? MANAGEMENT_BREADCRUMB : MANAGEMENT_BREADCRUMB_NO_HREF; setBreadcrumbs([ @@ -84,7 +80,7 @@ export const ManagementApp = ({ dependencies, history, appBasePath }: Management ...crumbs.map((item) => wrapBreadcrumb(item, appHistory || history)), ]); }, - [setBreadcrumbs, history, showContentBreadcrumbs] + [setBreadcrumbs, history] ); useEffect(() => { @@ -138,7 +134,6 @@ export const ManagementApp = ({ dependencies, history, appBasePath }: Management onAppMounted={onAppMounted} sections={sections} analytics={coreStart.analytics} - setContentBreadcrumbs={(value?: boolean) => setContentBreadcrumbs(value)} /> diff --git a/src/platform/plugins/shared/management/public/components/management_app/management_router.tsx b/src/platform/plugins/shared/management/public/components/management_app/management_router.tsx index c2c8c1edbfc8d..f10b26d1bae06 100644 --- a/src/platform/plugins/shared/management/public/components/management_app/management_router.tsx +++ b/src/platform/plugins/shared/management/public/components/management_app/management_router.tsx @@ -29,7 +29,6 @@ interface ManagementRouterProps { onAppMounted: (id: string) => void; sections: ManagementSection[]; analytics: AnalyticsServiceStart; - setContentBreadcrumbs?: (value?: boolean) => void; } export const ManagementRouter = memo( @@ -40,7 +39,6 @@ export const ManagementRouter = memo( sections, theme, analytics, - setContentBreadcrumbs, }: ManagementRouterProps) => { return ( @@ -60,7 +58,6 @@ export const ManagementRouter = memo( onAppMounted={onAppMounted} history={history} theme={theme} - setContentBreadcrumbs={setContentBreadcrumbs} /> )} /> @@ -79,7 +76,6 @@ export const ManagementRouter = memo( )} /> diff --git a/src/platform/plugins/shared/management/public/components/management_app_wrapper/management_app_wrapper.tsx b/src/platform/plugins/shared/management/public/components/management_app_wrapper/management_app_wrapper.tsx index 834bbec31fa75..2105b94739c75 100644 --- a/src/platform/plugins/shared/management/public/components/management_app_wrapper/management_app_wrapper.tsx +++ b/src/platform/plugins/shared/management/public/components/management_app_wrapper/management_app_wrapper.tsx @@ -27,7 +27,6 @@ interface ManagementSectionWrapperProps { onAppMounted: (id: string) => void; history: AppMountParameters['history']; theme: ThemeServiceStart; - setContentBreadcrumbs?: (value: boolean) => void; } interface ManagementSectionWrapperState { @@ -47,7 +46,7 @@ export class ManagementAppWrapper extends Component< } componentDidMount() { - const { setBreadcrumbs, app, onAppMounted, history, theme, setContentBreadcrumbs } = this.props; + const { setBreadcrumbs, app, onAppMounted, history, theme } = this.props; const { mount, basePath } = app; const appHistory = history.createSubHistory(app.basePath); @@ -61,8 +60,6 @@ export class ManagementAppWrapper extends Component< history: appHistory, theme, theme$, - setContentBreadcrumbs: (value) => - setContentBreadcrumbs ? setContentBreadcrumbs(value) : undefined, }); onAppMounted(app.id); diff --git a/src/platform/plugins/shared/management/public/types.ts b/src/platform/plugins/shared/management/public/types.ts index f7916c46afa5d..2e6f900de6298 100644 --- a/src/platform/plugins/shared/management/public/types.ts +++ b/src/platform/plugins/shared/management/public/types.ts @@ -81,7 +81,6 @@ export interface ManagementAppMountParams { theme: ThemeServiceStart; /** @deprecated - use `theme` **/ theme$: Observable; - setContentBreadcrumbs?: (showContentBreadcrumbs: boolean) => void; } export interface CreateManagementItemArgs { diff --git a/src/platform/plugins/shared/management/public/utils/breadcrumbs.ts b/src/platform/plugins/shared/management/public/utils/breadcrumbs.ts index cbbfaf0197288..e6467173387a9 100644 --- a/src/platform/plugins/shared/management/public/utils/breadcrumbs.ts +++ b/src/platform/plugins/shared/management/public/utils/breadcrumbs.ts @@ -9,12 +9,9 @@ import { i18n } from '@kbn/i18n'; -const managementBreadcrumbText = i18n.translate('management.stackManagement.breadcrumb', { +const managementBreadcrumbText = i18n.translate('management.breadcrumb', { defaultMessage: 'Stack Management', }); -const contentBreadcrumbText = i18n.translate('management.content.breadcrumb', { - defaultMessage: 'Content', -}); export const MANAGEMENT_BREADCRUMB_NO_HREF = { text: managementBreadcrumbText, @@ -24,6 +21,3 @@ export const MANAGEMENT_BREADCRUMB = { text: managementBreadcrumbText, href: '/', }; -export const CONTENT_BREADCRUMB_NO_HREF = { - text: contentBreadcrumbText, -}; diff --git a/src/platform/plugins/shared/management/public/utils/index.ts b/src/platform/plugins/shared/management/public/utils/index.ts index f0602ec8bc25f..6af869fe694bb 100644 --- a/src/platform/plugins/shared/management/public/utils/index.ts +++ b/src/platform/plugins/shared/management/public/utils/index.ts @@ -7,11 +7,7 @@ * License v3.0 only", or the "Server Side Public License, v 1". */ -export { - MANAGEMENT_BREADCRUMB, - MANAGEMENT_BREADCRUMB_NO_HREF, - CONTENT_BREADCRUMB_NO_HREF, -} from './breadcrumbs'; +export { MANAGEMENT_BREADCRUMB, MANAGEMENT_BREADCRUMB_NO_HREF } from './breadcrumbs'; export type { RegisterManagementAppArgs } from './management_app'; export { ManagementApp } from './management_app'; export type { RegisterManagementSectionArgs } from './management_section'; diff --git a/x-pack/platform/plugins/private/translations/translations/fr-FR.json b/x-pack/platform/plugins/private/translations/translations/fr-FR.json index eb5ad82163296..e037480b318fa 100644 --- a/x-pack/platform/plugins/private/translations/translations/fr-FR.json +++ b/x-pack/platform/plugins/private/translations/translations/fr-FR.json @@ -6034,6 +6034,7 @@ "lists.exceptions.isOperatorLabel": "est", "lists.exceptions.matchesOperatorLabel": "correspond à", "managedContentBadge.text": "Géré", + "management.breadcrumb": "Gestion de la Suite", "management.landing.header": "Bienvenue dans Gestion de la Suite {version}", "management.landing.solution.header": "Gestion de la Suite {version}", "management.landing.solution.subhead": "Gérez vos {indicesLink}, {dataViewsLink}, {ingestPipelinesLink}, {usersLink}, et plus encore.", @@ -46801,4 +46802,4 @@ "xpack.watcher.watchEdit.thresholdWatchExpression.aggType.fieldIsRequiredValidationMessage": "Ce champ est requis.", "xpack.watcher.watcherDescription": "Détectez les modifications survenant dans vos données en créant, gérant et monitorant des alertes." } -} +} \ No newline at end of file diff --git a/x-pack/platform/plugins/private/translations/translations/ja-JP.json b/x-pack/platform/plugins/private/translations/translations/ja-JP.json index 402102478c4e8..887fb3e5aa8ea 100644 --- a/x-pack/platform/plugins/private/translations/translations/ja-JP.json +++ b/x-pack/platform/plugins/private/translations/translations/ja-JP.json @@ -6028,6 +6028,7 @@ "lists.exceptions.isOperatorLabel": "is", "lists.exceptions.matchesOperatorLabel": "一致", "managedContentBadge.text": "管理中", + "management.breadcrumb": "スタック管理", "management.landing.header": "Stack Management {version}へようこそ", "management.landing.solution.header": "スタック管理{version}", "management.landing.solution.subhead": "{indicesLink}、{dataViewsLink}、{ingestPipelinesLink}、{usersLink}などを管理します。", @@ -46652,4 +46653,4 @@ "xpack.watcher.watchEdit.thresholdWatchExpression.aggType.fieldIsRequiredValidationMessage": "フィールドを選択してください。", "xpack.watcher.watcherDescription": "アラートの作成、管理、監視によりデータへの変更を検知します。" } -} +} \ No newline at end of file diff --git a/x-pack/platform/plugins/private/translations/translations/zh-CN.json b/x-pack/platform/plugins/private/translations/translations/zh-CN.json index 94752821ea535..bb61085aa8bb4 100644 --- a/x-pack/platform/plugins/private/translations/translations/zh-CN.json +++ b/x-pack/platform/plugins/private/translations/translations/zh-CN.json @@ -5986,6 +5986,7 @@ "lists.exceptions.isOperatorLabel": "是", "lists.exceptions.matchesOperatorLabel": "匹配", "managedContentBadge.text": "托管", + "management.breadcrumb": "Stack Management", "management.landing.header": "欢迎使用 Stack Management {version}", "management.landing.solution.header": "Stack Management {version}", "management.landing.solution.subhead": "管理您的 {indicesLink}、{dataViewsLink}、{ingestPipelinesLink}、{usersLink} 等。", @@ -45960,4 +45961,4 @@ "xpack.watcher.watchEdit.thresholdWatchExpression.aggType.fieldIsRequiredValidationMessage": "此字段必填。", "xpack.watcher.watcherDescription": "通过创建、管理和监测警报来检测数据中的更改。" } -} +} \ No newline at end of file diff --git a/x-pack/platform/plugins/shared/index_management/__jest__/client_integration/helpers/setup_environment.tsx b/x-pack/platform/plugins/shared/index_management/__jest__/client_integration/helpers/setup_environment.tsx index 2a903ece46cd1..9694b6c19dc50 100644 --- a/x-pack/platform/plugins/shared/index_management/__jest__/client_integration/helpers/setup_environment.tsx +++ b/x-pack/platform/plugins/shared/index_management/__jest__/client_integration/helpers/setup_environment.tsx @@ -114,10 +114,7 @@ const { Provider: KibanaReactContextProvider } = createKibanaReactContext({ }); export const setupEnvironment = () => { - breadcrumbService.setup( - () => undefined, - () => undefined - ); + breadcrumbService.setup(() => undefined); documentationService.setup(docLinksServiceMock.createStartContract()); notificationService.setup(notificationServiceMock.createStartContract()); diff --git a/x-pack/platform/plugins/shared/index_management/__jest__/components/index_table.test.js b/x-pack/platform/plugins/shared/index_management/__jest__/components/index_table.test.js index fad8664e6bccf..72aa38b600996 100644 --- a/x-pack/platform/plugins/shared/index_management/__jest__/components/index_table.test.js +++ b/x-pack/platform/plugins/shared/index_management/__jest__/components/index_table.test.js @@ -155,10 +155,7 @@ describe('index table', () => { setUiMetricService(services.uiMetricService); httpService.setup(httpSetup); - breadcrumbService.setup( - () => undefined, - () => undefined - ); + breadcrumbService.setup(() => undefined); notificationService.setup(notificationServiceMock.createStartContract()); store = indexManagementStore(services); diff --git a/x-pack/platform/plugins/shared/index_management/public/application/components/component_templates/__jest__/client_integration/helpers/setup_environment.tsx b/x-pack/platform/plugins/shared/index_management/public/application/components/component_templates/__jest__/client_integration/helpers/setup_environment.tsx index b3dd0b3a2dd09..00554b9ec1a14 100644 --- a/x-pack/platform/plugins/shared/index_management/public/application/components/component_templates/__jest__/client_integration/helpers/setup_environment.tsx +++ b/x-pack/platform/plugins/shared/index_management/public/application/components/component_templates/__jest__/client_integration/helpers/setup_environment.tsx @@ -57,10 +57,7 @@ export const componentTemplatesDependencies = (httpSetup: HttpSetup, coreStart?: }; export const setupEnvironment = () => { - breadcrumbService.setup( - () => undefined, - () => undefined - ); + breadcrumbService.setup(() => undefined); return initHttpRequests(); }; diff --git a/x-pack/platform/plugins/shared/index_management/public/application/mount_management_section.ts b/x-pack/platform/plugins/shared/index_management/public/application/mount_management_section.ts index 8f8d0ae6b10cc..4cc57c2b06a07 100644 --- a/x-pack/platform/plugins/shared/index_management/public/application/mount_management_section.ts +++ b/x-pack/platform/plugins/shared/index_management/public/application/mount_management_section.ts @@ -137,7 +137,7 @@ export async function mountManagementSection({ cloud?: CloudSetup; canUseSyntheticSource: boolean; }) { - const { element, setBreadcrumbs, history, setContentBreadcrumbs } = params; + const { element, setBreadcrumbs, history } = params; const [core, startDependencies] = await coreSetup.getStartServices(); const { docLinks, @@ -145,7 +145,7 @@ export async function mountManagementSection({ } = core; docTitle.change(PLUGIN.getI18nName(i18n)); - breadcrumbService.setup(setBreadcrumbs, setContentBreadcrumbs); + breadcrumbService.setup(setBreadcrumbs); documentationService.setup(docLinks); const { uiMetricService } = initSetup({ diff --git a/x-pack/platform/plugins/shared/index_management/public/application/sections/home/index_list/index_actions_context_menu/index_actions_context_menu.js b/x-pack/platform/plugins/shared/index_management/public/application/sections/home/index_list/index_actions_context_menu/index_actions_context_menu.js index c9e13487eb4be..21f77ae11337d 100644 --- a/x-pack/platform/plugins/shared/index_management/public/application/sections/home/index_list/index_actions_context_menu/index_actions_context_menu.js +++ b/x-pack/platform/plugins/shared/index_management/public/application/sections/home/index_list/index_actions_context_menu/index_actions_context_menu.js @@ -25,7 +25,6 @@ import { flattenPanelTree } from '../../../../lib/flatten_panel_tree'; import { INDEX_OPEN, IndexDetailsSection } from '../../../../../../common/constants'; import { getIndexDetailsLink, navigateToIndexDetailsPage } from '../../../../services/routing'; import { AppContext } from '../../../../app_context'; -import { breadcrumbService } from '../../../../services/breadcrumbs'; export class IndexActionsContextMenu extends Component { static contextType = AppContext; @@ -89,7 +88,6 @@ export class IndexActionsContextMenu extends Component { extensionsService, application, http, - breadcrumbService, IndexDetailsSection.Overview ); }, @@ -106,7 +104,6 @@ export class IndexActionsContextMenu extends Component { extensionsService, application, http, - breadcrumbService, IndexDetailsSection.Settings ); }, @@ -123,7 +120,6 @@ export class IndexActionsContextMenu extends Component { extensionsService, application, http, - breadcrumbService, IndexDetailsSection.Mappings ); }, diff --git a/x-pack/platform/plugins/shared/index_management/public/application/sections/home/index_list/index_list.tsx b/x-pack/platform/plugins/shared/index_management/public/application/sections/home/index_list/index_list.tsx index 8d14a0d60e3c6..4969a51d857a4 100644 --- a/x-pack/platform/plugins/shared/index_management/public/application/sections/home/index_list/index_list.tsx +++ b/x-pack/platform/plugins/shared/index_management/public/application/sections/home/index_list/index_list.tsx @@ -9,7 +9,6 @@ import React, { useEffect } from 'react'; import { RouteComponentProps } from 'react-router-dom'; import { ScopedHistory } from '@kbn/core/public'; -import useObservable from 'react-use/lib/useObservable'; import { APP_WRAPPER_CLASS, useExecutionContext } from '../../../../shared_imports'; import { breadcrumbService, IndexManagementBreadcrumb } from '../../../services/breadcrumbs'; import { useAppContext } from '../../../app_context'; @@ -17,21 +16,17 @@ import { IndexTable } from './index_table'; export const IndexList: React.FunctionComponent = ({ history }) => { const { - core: { executionContext, chrome }, - plugins: { cloud }, + core: { executionContext }, } = useAppContext(); useExecutionContext(executionContext, { type: 'application', page: 'indexManagementIndicesTab', }); - const activeSolutionId = useObservable(chrome.getActiveSolutionNavId$()); useEffect(() => { - const isActiveSolutionSearch = !cloud?.isServerlessEnabled && activeSolutionId === 'es'; breadcrumbService.setBreadcrumbs(IndexManagementBreadcrumb.indices); - breadcrumbService.setContentBreadcrumbs(isActiveSolutionSearch); - }, [activeSolutionId, cloud]); + }, []); return (
diff --git a/x-pack/platform/plugins/shared/index_management/public/application/sections/home/index_list/index_table/index_table.js b/x-pack/platform/plugins/shared/index_management/public/application/sections/home/index_list/index_table/index_table.js index d1e5e90662930..ee72f56d2103d 100644 --- a/x-pack/platform/plugins/shared/index_management/public/application/sections/home/index_list/index_table/index_table.js +++ b/x-pack/platform/plugins/shared/index_management/public/application/sections/home/index_list/index_table/index_table.js @@ -49,7 +49,6 @@ import { NoMatch, DataHealth } from '../../../../components'; import { IndexActionsContextMenu } from '../index_actions_context_menu'; import { CreateIndexButton } from '../create_index/create_index_button'; import { IndexTablePagination, PAGE_SIZE_OPTIONS } from './index_table_pagination'; -import { breadcrumbService } from '../../../../services/breadcrumbs'; const getColumnConfigs = ({ showIndexStats, @@ -79,8 +78,7 @@ const getColumnConfigs = ({ location.search || '', extensionsService, application, - http, - breadcrumbService + http ); }} > diff --git a/x-pack/platform/plugins/shared/index_management/public/application/services/breadcrumbs.ts b/x-pack/platform/plugins/shared/index_management/public/application/services/breadcrumbs.ts index a9b121294b427..1d4f5fba52277 100644 --- a/x-pack/platform/plugins/shared/index_management/public/application/services/breadcrumbs.ts +++ b/x-pack/platform/plugins/shared/index_management/public/application/services/breadcrumbs.ts @@ -10,7 +10,6 @@ import { ManagementAppMountParams } from '@kbn/management-plugin/public'; import { EuiBreadcrumb } from '@elastic/eui'; type SetBreadcrumbs = ManagementAppMountParams['setBreadcrumbs']; -type SetContentBreadcrumbs = ManagementAppMountParams['setContentBreadcrumbs']; export enum IndexManagementBreadcrumb { home = 'home', @@ -45,26 +44,18 @@ export enum IndexManagementBreadcrumb { */ enrichPolicies = 'enrichPolicies', enrichPoliciesCreate = 'enrichPoliciesCreate', - - content = 'content', - indicesList = 'indicesList', } -export class BreadcrumbService { +class BreadcrumbService { private breadcrumbs: { [key in IndexManagementBreadcrumb]?: EuiBreadcrumb[]; } = { home: [] as EuiBreadcrumb[], }; private setBreadcrumbsHandler?: SetBreadcrumbs; - private setContentBreadcrumbsHandler?: SetContentBreadcrumbs; - public setup( - setBreadcrumbsHandler: SetBreadcrumbs, - setContentBreadcrumbsHandler: SetContentBreadcrumbs - ): void { + public setup(setBreadcrumbsHandler: SetBreadcrumbs): void { this.setBreadcrumbsHandler = setBreadcrumbsHandler; - this.setContentBreadcrumbsHandler = setContentBreadcrumbsHandler; this.breadcrumbs.home = [ { text: i18n.translate('xpack.idxMgmt.breadcrumb.homeLabel', { @@ -234,12 +225,6 @@ export class BreadcrumbService { this.setBreadcrumbsHandler(newBreadcrumbs); } - public setContentBreadcrumbs(showContentBreadcrumb: boolean): void { - if (!this.setContentBreadcrumbsHandler) { - throw new Error(`BreadcrumbService#setup() must be called first!`); - } - this.setContentBreadcrumbsHandler(showContentBreadcrumb); - } } export const breadcrumbService = new BreadcrumbService(); diff --git a/x-pack/platform/plugins/shared/index_management/public/application/services/routing.test.ts b/x-pack/platform/plugins/shared/index_management/public/application/services/routing.test.ts index 7fb35119e355f..0b1462deab58b 100644 --- a/x-pack/platform/plugins/shared/index_management/public/application/services/routing.test.ts +++ b/x-pack/platform/plugins/shared/index_management/public/application/services/routing.test.ts @@ -9,7 +9,6 @@ import { getIndexDetailsLink, getIndexListUri, navigateToIndexDetailsPage } from import { applicationServiceMock, httpServiceMock } from '@kbn/core/public/mocks'; import { ExtensionsService } from '../../services/extensions_service'; import { IndexDetailsSection } from '../../../common/constants'; -import { BreadcrumbService } from './breadcrumbs'; describe('routing', () => { describe('index details link', () => { @@ -37,12 +36,7 @@ describe('routing', () => { const extensionService = { indexDetailsPageRoute: null, } as ExtensionsService; - - const breadcrumbs = { - setBreadcrumbs: jest.fn(), - } as unknown as BreadcrumbService; - - navigateToIndexDetailsPage('testIndex', '', extensionService, application, http, breadcrumbs); + navigateToIndexDetailsPage('testIndex', '', extensionService, application, http); expect(application.navigateToUrl).toHaveBeenCalled(); }); @@ -54,18 +48,12 @@ describe('routing', () => { }, }, } as ExtensionsService; - - const breadcrumbs = { - setBreadcrumbs: jest.fn(), - } as unknown as BreadcrumbService; - navigateToIndexDetailsPage( 'testIndex', '', extensionService, application, http, - breadcrumbs, IndexDetailsSection.Settings ); expect(application.navigateToUrl).toHaveBeenCalled(); diff --git a/x-pack/platform/plugins/shared/index_management/public/application/services/routing.ts b/x-pack/platform/plugins/shared/index_management/public/application/services/routing.ts index 8dd67553058e6..89143bbd79d02 100644 --- a/x-pack/platform/plugins/shared/index_management/public/application/services/routing.ts +++ b/x-pack/platform/plugins/shared/index_management/public/application/services/routing.ts @@ -11,8 +11,7 @@ import { Section } from '../../../common/constants'; import type { IndexDetailsTabId } from '../../../common/constants'; import { ExtensionsService } from '../../services/extensions_service'; import { IndexDetailsSection } from '../../../common/constants'; -import { IndexManagementBreadcrumb } from './breadcrumbs'; -import { BreadcrumbService } from './breadcrumbs'; + export const getTemplateListLink = () => `/templates`; export const getTemplateDetailsLink = (name: string, isLegacy?: boolean) => { @@ -94,7 +93,6 @@ export const navigateToIndexDetailsPage = ( extensionsService: ExtensionsService, application: ApplicationStart, http: HttpSetup, - breadcrumbService: BreadcrumbService, tabId?: IndexDetailsSection ) => { if (!extensionsService.indexDetailsPageRoute) { @@ -110,6 +108,5 @@ export const navigateToIndexDetailsPage = ( } else { const route = extensionsService.indexDetailsPageRoute.renderRoute(indexName, tabId); application.navigateToUrl(http.basePath.prepend(route)); - breadcrumbService.setBreadcrumbs(IndexManagementBreadcrumb.indices, { text: indexName }); } }; diff --git a/x-pack/test/functional_search/index.ts b/x-pack/test/functional_search/index.ts index ce70b80a9c2ce..6f2eb1dccff72 100644 --- a/x-pack/test/functional_search/index.ts +++ b/x-pack/test/functional_search/index.ts @@ -10,11 +10,11 @@ import { FtrProviderContext } from './ftr_provider_context'; export default ({ loadTestFile }: FtrProviderContext): void => { describe('Search solution tests', function () { - // loadTestFile(require.resolve('./tests/search_overview')); - // loadTestFile(require.resolve('./tests/classic_navigation')); - // loadTestFile(require.resolve('./tests/solution_navigation')); - // loadTestFile(require.resolve('./tests/search_start')); + loadTestFile(require.resolve('./tests/search_overview')); + loadTestFile(require.resolve('./tests/classic_navigation')); + loadTestFile(require.resolve('./tests/solution_navigation')); + loadTestFile(require.resolve('./tests/search_start')); loadTestFile(require.resolve('./tests/search_index_details')); - // loadTestFile(require.resolve('./tests/index_management')); + loadTestFile(require.resolve('./tests/index_management')); }); }; diff --git a/x-pack/test/functional_solution_sidenav/tests/search_sidenav.ts b/x-pack/test/functional_solution_sidenav/tests/search_sidenav.ts index 73c7edc496c19..811dd7bc8ca96 100644 --- a/x-pack/test/functional_solution_sidenav/tests/search_sidenav.ts +++ b/x-pack/test/functional_solution_sidenav/tests/search_sidenav.ts @@ -56,7 +56,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { deepLinkId: 'management:index_management', }); await solutionNavigation.breadcrumbs.expectBreadcrumbExists({ text: 'Deployment' }); - await solutionNavigation.breadcrumbs.expectBreadcrumbExists({ text: 'Content' }); + await solutionNavigation.breadcrumbs.expectBreadcrumbExists({ text: 'Stack Management' }); await solutionNavigation.breadcrumbs.expectBreadcrumbExists({ text: 'Index Management' }); await solutionNavigation.breadcrumbs.expectBreadcrumbExists({ text: 'Indices', @@ -66,7 +66,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { await solutionNavigation.sidenav.openSection('project_settings_project_nav'); await solutionNavigation.sidenav.clickLink({ navId: 'stack_management' }); await solutionNavigation.sidenav.expectLinkActive({ navId: 'stack_management' }); - await solutionNavigation.breadcrumbs.expectBreadcrumbExists({ text: 'Content' }); + await solutionNavigation.breadcrumbs.expectBreadcrumbExists({ text: 'Stack Management' }); // navigate back to the home page using header logo await solutionNavigation.clickLogo(); From 85a02929a2969a53346a06a5a97daf97dede9d0d Mon Sep 17 00:00:00 2001 From: saarikabhasi Date: Fri, 21 Feb 2025 17:49:14 -0500 Subject: [PATCH 20/38] initial commit use index management to search_indices --- .../shared/management/public/plugin.tsx | 1 + .../src/types.ts | 4 + .../public/application/app.tsx | 1 + .../mount_management_search_indices.ts | 183 ++++++++++++++++++ .../public/application/sections/home/home.tsx | 2 +- .../home_page_embeddable.tsx | 31 +++ .../home_page_with_context.tsx | 48 +++++ .../home_page_with_context_types.tsx | 24 +++ .../shared/index_management/public/plugin.ts | 74 +++++++ .../components/idxManagement_router.tsx | 36 ++++ .../public/components/index_mangement/app.tsx | 74 +++++++ .../public/index_management_application.tsx | 43 ++++ .../plugins/search_indices/public/plugin.ts | 18 ++ .../hooks/use_playground_breadcrumbs.ts | 4 +- .../search_navigation/public/plugin.ts | 6 +- 15 files changed, 543 insertions(+), 6 deletions(-) create mode 100644 x-pack/platform/plugins/shared/index_management/public/application/mount_management_search_indices.ts create mode 100644 x-pack/platform/plugins/shared/index_management/public/application/sections/home/index_list/details_page/with_context_components/home_page_embeddable.tsx create mode 100644 x-pack/platform/plugins/shared/index_management/public/application/sections/home/index_list/details_page/with_context_components/home_page_with_context.tsx create mode 100644 x-pack/platform/plugins/shared/index_management/public/application/sections/home/index_list/details_page/with_context_components/home_page_with_context_types.tsx create mode 100644 x-pack/solutions/search/plugins/search_indices/public/components/idxManagement_router.tsx create mode 100644 x-pack/solutions/search/plugins/search_indices/public/components/index_mangement/app.tsx create mode 100644 x-pack/solutions/search/plugins/search_indices/public/index_management_application.tsx diff --git a/src/platform/plugins/shared/management/public/plugin.tsx b/src/platform/plugins/shared/management/public/plugin.tsx index 97778792316ea..41fc8c41c856f 100644 --- a/src/platform/plugins/shared/management/public/plugin.tsx +++ b/src/platform/plugins/shared/management/public/plugin.tsx @@ -131,6 +131,7 @@ export class ManagementPlugin const [, ...trailingBreadcrumbs] = newBreadcrumbs; deps.serverless.setBreadcrumbs(trailingBreadcrumbs); } else { + console.log('here', newBreadcrumbs); coreStart.chrome.setBreadcrumbs(newBreadcrumbs, { project: { value: newBreadcrumbs, absolute: true }, }); diff --git a/x-pack/platform/packages/shared/index-management/index_management_shared_types/src/types.ts b/x-pack/platform/packages/shared/index-management/index_management_shared_types/src/types.ts index 5cf5955586910..6fc32fb2cc0db 100644 --- a/x-pack/platform/packages/shared/index-management/index_management_shared_types/src/types.ts +++ b/x-pack/platform/packages/shared/index-management/index_management_shared_types/src/types.ts @@ -39,6 +39,7 @@ export interface IndexManagementPluginSetup { apiService: PublicApiServiceSetup; extensionsService: ExtensionsSetup; locator?: IndexManagementLocator; + managementApp?: any; } export interface IndexManagementPluginStart { @@ -49,6 +50,9 @@ export interface IndexManagementPluginStart { getIndexSettingsComponent: (deps: { history: ScopedHistory; }) => React.FC; + getIndexManagementComponent:(deps: { + history: ScopedHistory; + }) => React.FC<{}>; } export interface Index { diff --git a/x-pack/platform/plugins/shared/index_management/public/application/app.tsx b/x-pack/platform/plugins/shared/index_management/public/application/app.tsx index 1fc9dd26e4cde..8902680db4ab8 100644 --- a/x-pack/platform/plugins/shared/index_management/public/application/app.tsx +++ b/x-pack/platform/plugins/shared/index_management/public/application/app.tsx @@ -31,6 +31,7 @@ export const App = ({ history }: { history: ScopedHistory }) => { () => services.uiMetricService.trackMetric(METRIC_TYPE.LOADED, UIM_APP_LOAD), [services.uiMetricService] ); + console.log("/:section(${homeSections.join('|')})", homeSections.join('|')); return ( diff --git a/x-pack/platform/plugins/shared/index_management/public/application/mount_management_search_indices.ts b/x-pack/platform/plugins/shared/index_management/public/application/mount_management_search_indices.ts new file mode 100644 index 0000000000000..bb5e547d32737 --- /dev/null +++ b/x-pack/platform/plugins/shared/index_management/public/application/mount_management_search_indices.ts @@ -0,0 +1,183 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import '../index.scss'; +import { i18n } from '@kbn/i18n'; +import SemVer from 'semver/classes/semver'; +import { ChromeBreadcrumb, CoreSetup, CoreStart, ScopedHistory } from '@kbn/core/public'; +import { ManagementAppMountParams } from '@kbn/management-plugin/public'; +import { UsageCollectionSetup } from '@kbn/usage-collection-plugin/public'; +import { CloudSetup } from '@kbn/cloud-plugin/public'; +import { UIM_APP_NAME } from '../../common/constants'; +import { PLUGIN } from '../../common/constants/plugin'; +import { AppDependencies } from './app_context'; +import { breadcrumbService } from './services/breadcrumbs'; +import { documentationService } from './services/documentation'; +import { UiMetricService } from './services'; + +import { renderApp } from '.'; +import { setUiMetricService } from './services/api'; +import { notificationService } from './services/notification'; +import { httpService } from './services/http'; +import { ExtensionsService } from '../services/extensions_service'; +import { StartDependencies } from '../types'; + +interface SearchIndicesAppMountParams { + element: HTMLElement; // element the section should render into + setBreadcrumbs: (crumbs: ChromeBreadcrumb[]) => void; + history: ScopedHistory; +} + + +function initSetup({ + usageCollection, + core, +}: { + core: CoreStart; + usageCollection: UsageCollectionSetup; +}) { + const { http, notifications } = core; + + httpService.setup(http); + notificationService.setup(notifications); + + const uiMetricService = new UiMetricService(UIM_APP_NAME); + + setUiMetricService(uiMetricService); + + uiMetricService.setup(usageCollection); + + return { uiMetricService }; +} + +export function getIndexManagementDependenciesIndices({ + core, + usageCollection, + extensionsService, + history, + isFleetEnabled, + kibanaVersion, + config, + cloud, + startDependencies, + uiMetricService, + canUseSyntheticSource, +}: { + core: CoreStart; + usageCollection: UsageCollectionSetup; + extensionsService: ExtensionsService; + history: ScopedHistory; + isFleetEnabled: boolean; + kibanaVersion: SemVer; + config: AppDependencies['config']; + cloud?: CloudSetup; + startDependencies: StartDependencies; + uiMetricService: UiMetricService; + canUseSyntheticSource: boolean; +}): AppDependencies { + const { docLinks, application, uiSettings, settings } = core; + const { url } = startDependencies.share; + const { monitor, manageEnrich, monitorEnrich, manageIndexTemplates } = + application.capabilities.index_management; + + return { + core: { + getUrlForApp: application.getUrlForApp, + ...core, + }, + plugins: { + usageCollection, + isFleetEnabled, + share: startDependencies.share, + cloud, + console: startDependencies.console, + ml: startDependencies.ml, + licensing: startDependencies.licensing, + }, + services: { + httpService, + notificationService, + uiMetricService, + extensionsService, + }, + config, + history, + setBreadcrumbs: breadcrumbService.setBreadcrumbs, + uiSettings, + settings, + url, + docLinks, + kibanaVersion, + overlays: core.overlays, + canUseSyntheticSource, + privs: { + monitor: !!monitor, + manageEnrich: !!manageEnrich, + monitorEnrich: !!monitorEnrich, + manageIndexTemplates: !!manageIndexTemplates, + }, + }; +} + +export async function mountIndexManagementSection({ + coreSetup, + usageCollection, + params, + extensionsService, + isFleetEnabled, + kibanaVersion, + config, + cloud, + canUseSyntheticSource, +}: { + coreSetup: CoreSetup; + usageCollection: UsageCollectionSetup; + params: SearchIndicesAppMountParams; + extensionsService: ExtensionsService; + isFleetEnabled: boolean; + kibanaVersion: SemVer; + config: AppDependencies['config']; + cloud?: CloudSetup; + canUseSyntheticSource: boolean; +}) { + console.log("mountIndexManagementSection") + const { element, setBreadcrumbs, history } = params; + const [core, startDependencies] = await coreSetup.getStartServices(); + const { + docLinks, + chrome: { docTitle }, + } = core; + docTitle.change(PLUGIN.getI18nName(i18n)); + + breadcrumbService.setup(setBreadcrumbs); + documentationService.setup(docLinks); + + const { uiMetricService } = initSetup({ + usageCollection, + core, + }); + const appDependencies = getIndexManagementDependenciesIndices({ + cloud, + config, + core, + extensionsService, + history, + isFleetEnabled, + kibanaVersion, + startDependencies, + uiMetricService, + usageCollection, + canUseSyntheticSource, + }); + + const unmountAppCallback = renderApp(element, { core, dependencies: appDependencies }); + + return () => { + docTitle.reset(); + unmountAppCallback(); + }; +} diff --git a/x-pack/platform/plugins/shared/index_management/public/application/sections/home/home.tsx b/x-pack/platform/plugins/shared/index_management/public/application/sections/home/home.tsx index 53ef500f597e0..5ccf22750cf98 100644 --- a/x-pack/platform/plugins/shared/index_management/public/application/sections/home/home.tsx +++ b/x-pack/platform/plugins/shared/index_management/public/application/sections/home/home.tsx @@ -29,7 +29,7 @@ export const homeSections = [ Section.EnrichPolicies, ]; -interface MatchParams { +export interface MatchParams { section: Section; } diff --git a/x-pack/platform/plugins/shared/index_management/public/application/sections/home/index_list/details_page/with_context_components/home_page_embeddable.tsx b/x-pack/platform/plugins/shared/index_management/public/application/sections/home/index_list/details_page/with_context_components/home_page_embeddable.tsx new file mode 100644 index 0000000000000..34b1db536c7e3 --- /dev/null +++ b/x-pack/platform/plugins/shared/index_management/public/application/sections/home/index_list/details_page/with_context_components/home_page_embeddable.tsx @@ -0,0 +1,31 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +/* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { EuiLoadingSpinner } from '@elastic/eui'; +import { dynamic } from '@kbn/shared-ux-utility'; +import React, { Suspense, ComponentType } from 'react'; +import { HomePageWithContext } from './home_page_with_context'; +import { IndexManagementHomeContextTypes } from './home_page_with_context_types'; +import { IndexSettingWithContextProps } from './index_settings_with_context_types'; + +const IndexManagementHomeWithContext = dynamic>(() => + import('./home_page_with_context').then((mod) => ({ default: mod.HomePageWithContext })) +); + +export const IndexManagementHomeEmbeddable: React.FC = (props) => { + return ( + }> + + + ); +}; diff --git a/x-pack/platform/plugins/shared/index_management/public/application/sections/home/index_list/details_page/with_context_components/home_page_with_context.tsx b/x-pack/platform/plugins/shared/index_management/public/application/sections/home/index_list/details_page/with_context_components/home_page_with_context.tsx new file mode 100644 index 0000000000000..9b0310ff6d9ab --- /dev/null +++ b/x-pack/platform/plugins/shared/index_management/public/application/sections/home/index_list/details_page/with_context_components/home_page_with_context.tsx @@ -0,0 +1,48 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import React from 'react'; +import { documentationService } from '../../../../../services'; +import { UIM_APP_NAME } from '../../../../../../../common/constants/ui_metric'; +import { httpService } from '../../../../../services/http'; +import { notificationService } from '../../../../../services/notification'; +import { UiMetricService } from '../../../../../services/ui_metric'; +import { AppDependencies, IndexManagementAppContext } from '../../../../..'; +import { IndexMappingWithContextProps } from './index_mapping_with_context_types'; +import { DetailsPageMappings } from '../details_page_mappings'; +import { IndexManagementHomeContextTypes } from './home_page_with_context_types'; +import { IndexManagementHome } from '../../../home'; +import { App } from '../../../../../../application/app'; +export const HomePageWithContext: React.FC = ({ + core, + dependencies, +}) => { + // this normally happens when the index management app is rendered + // but if components are embedded elsewhere that setup is skipped, so we have to do it here + // would do it in plugin.ts but that blows up the bundle size + // can't do it in an effect because then the first http call fails as the instantiation happens after first render + if (!httpService.httpClient) { + httpService.setup(core.http); + notificationService.setup(core.notifications); + } + documentationService.setup(core.docLinks); + + const newDependencies: AppDependencies = { + ...dependencies, + services: { + ...(dependencies.services || {}), + httpService, + notificationService, + uiMetricService: new UiMetricService(UIM_APP_NAME), + }, + }; + return ( + + + + ); +}; diff --git a/x-pack/platform/plugins/shared/index_management/public/application/sections/home/index_list/details_page/with_context_components/home_page_with_context_types.tsx b/x-pack/platform/plugins/shared/index_management/public/application/sections/home/index_list/details_page/with_context_components/home_page_with_context_types.tsx new file mode 100644 index 0000000000000..3a0397f9a00ab --- /dev/null +++ b/x-pack/platform/plugins/shared/index_management/public/application/sections/home/index_list/details_page/with_context_components/home_page_with_context_types.tsx @@ -0,0 +1,24 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { CoreStart } from '@kbn/core/public'; +import type { IndexSettingProps } from '@kbn/index-management-shared-types'; +import { UsageCollectionSetup } from '@kbn/usage-collection-plugin/public'; +import { AppDependencies } from '../../../../../app_context'; +import { ExtensionsService } from '../../../../../../services/extensions_service'; +import { MatchParams } from '../../../home'; + +export type IndexManagementHomeContextTypes = { + core: CoreStart; + // omitting services here to constitute them inside the component + // this helps reduce bundle size significantly + dependencies: Omit & { + services: { extensionsService: ExtensionsService }; + }; + usageCollection: UsageCollectionSetup; +}; +// & MatchParams; diff --git a/x-pack/platform/plugins/shared/index_management/public/plugin.ts b/x-pack/platform/plugins/shared/index_management/public/plugin.ts index 35996a43e2cd6..662a1b40da5f9 100644 --- a/x-pack/platform/plugins/shared/index_management/public/plugin.ts +++ b/x-pack/platform/plugins/shared/index_management/public/plugin.ts @@ -16,6 +16,7 @@ import { PluginInitializerContext, ScopedHistory, Capabilities, + ChromeBreadcrumb, } from '@kbn/core/public'; import { IndexManagementPluginSetup, @@ -34,6 +35,8 @@ import { IndexMapping } from './application/sections/home/index_list/details_pag import { PublicApiService } from './services/public_api_service'; import { IndexSettings } from './application/sections/home/index_list/details_page/with_context_components/index_settings_embeddable'; import { IndexManagementLocatorDefinition } from './locator'; +import { IndexManagementHome } from './application/sections/home'; +import { IndexManagementHomeEmbeddable } from './application/sections/home/index_list/details_page/with_context_components/home_page_embeddable'; export class IndexMgmtUIPlugin implements @@ -145,6 +148,23 @@ export class IndexMgmtUIPlugin apiService: new PublicApiService(coreSetup.http), extensionsService: this.extensionsService.setup(), locator: this.locator, + managementApp: async (element: HTMLElement, setBreadcrumbs:(newBreadCrumbs:ChromeBreadcrumb[] )=> void, history: ScopedHistory) => { + const { mountIndexManagementSection } = await import( + './application/mount_management_search_indices' + ); + return mountIndexManagementSection({ + coreSetup, + usageCollection, + params: {element, setBreadcrumbs, history}, + extensionsService: this.extensionsService, + isFleetEnabled: Boolean(fleet), + kibanaVersion: this.kibanaVersion, + config: this.config, + cloud, + canUseSyntheticSource: this.canUseSyntheticSource, + }); + } + }; } @@ -235,6 +255,60 @@ export class IndexMgmtUIPlugin return IndexSettings({ dependencies: appDependencies, core: coreStart, ...props }); }; }, + getIndexManagementComponent: (deps: { history: ScopedHistory }) =>{ + const { docLinks, fatalErrors, application, uiSettings, executionContext, settings, http } = + coreStart; + const { url } = share; + const appDependencies = { + core: { + fatalErrors, + getUrlForApp: application.getUrlForApp, + executionContext, + application, + http, + }, + plugins: { + usageCollection, + isFleetEnabled: Boolean(fleet), + share, + cloud, + console, + ml, + licensing, + }, + services: { + extensionsService: this.extensionsService, + }, + config: this.config, + history: deps.history, + setBreadcrumbs: undefined as any, // breadcrumbService.setBreadcrumbs, + uiSettings, + settings, + url, + docLinks, + kibanaVersion: this.kibanaVersion, + theme$: coreStart.theme.theme$, + }; + return (props: any) => { + return IndexManagementHomeEmbeddable({ dependencies: appDependencies, core: coreStart, ...props }); + }; + }, + // getIndexManagementComponent: async (element: HTMLElement, setBreadcrumbs:()=> void, history: ScopedHistory) => { + // const { mountIndexManagementSection } = await import( + // './application/mount_management_search_indices' + // ); + // return mountIndexManagementSection({ + // coreSetup, + // usageCollection, + // params: {element, setBreadcrumbs, history}, + // extensionsService: this.extensionsService, + // isFleetEnabled: Boolean(fleet), + // kibanaVersion: this.kibanaVersion, + // config: this.config, + // cloud, + // canUseSyntheticSource: this.canUseSyntheticSource, + // }); + // } }; } public stop() { diff --git a/x-pack/solutions/search/plugins/search_indices/public/components/idxManagement_router.tsx b/x-pack/solutions/search/plugins/search_indices/public/components/idxManagement_router.tsx new file mode 100644 index 0000000000000..0283e17ea2297 --- /dev/null +++ b/x-pack/solutions/search/plugins/search_indices/public/components/idxManagement_router.tsx @@ -0,0 +1,36 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ +import React from 'react'; +import { Route, Router, Routes } from '@kbn/shared-ux-router'; +import { Redirect } from 'react-router-dom'; + +import { useKibana } from '../hooks/use_kibana'; +import { + SearchIndexDetailsTabs, + SEARCH_INDICES_DETAILS_PATH, + SEARCH_INDICES_DETAILS_TABS_PATH, + CREATE_INDEX_PATH, +} from '../routes'; +import { SearchIndexDetailsPage } from './indices/details_page'; +import { CreateIndexPage } from './create_index/create_index_page'; + +export const IndexManagementIndicesRouter: React.FC = () => { + const { application, history } = useKibana().services; + return ( + + + + { + application.navigateToApp('elasticsearchStart'); + return null; + }} + /> + + + ); +}; diff --git a/x-pack/solutions/search/plugins/search_indices/public/components/index_mangement/app.tsx b/x-pack/solutions/search/plugins/search_indices/public/components/index_mangement/app.tsx new file mode 100644 index 0000000000000..6ac0c2a241f5a --- /dev/null +++ b/x-pack/solutions/search/plugins/search_indices/public/components/index_mangement/app.tsx @@ -0,0 +1,74 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { ChromeBreadcrumb, ScopedHistory } from '@kbn/core/public'; +import { IndexManagementPluginSetup } from '@kbn/index-management-shared-types'; +import { reactRouterNavigate } from '@kbn/kibana-react-plugin/public'; +import { KibanaPageTemplate } from '@kbn/shared-ux-page-kibana-template'; +import React, { useRef, useEffect, useCallback } from 'react'; +import { useKibana } from '../../hooks/use_kibana'; + +import { i18n } from '@kbn/i18n'; + +const breadcrumbText = i18n.translate('management.breadcrumb', { + defaultMessage: 'Content', +}); + +export const BREADCRUMB_NO_HREF = { + text: breadcrumbText, +}; + +export const BREADCRUMB = { + text: breadcrumbText, + href: '/', +}; +interface IndexManagementAppProps { + indexManagement: IndexManagementPluginSetup; +} +export const IndexManagementApp: React.FC = ({ indexManagement }) => { + const { history, searchNavigation } = useKibana().services; + const managementRef = useRef(null); + const setBreadcrumbs = useCallback( + (crumbs: ChromeBreadcrumb[] = [], appHistory?: ScopedHistory) => { + console.log('crumbs', crumbs); + const wrapBreadcrumb = (item: ChromeBreadcrumb, scopedHistory: ScopedHistory) => ({ + ...item, + ...(item.href ? reactRouterNavigate(scopedHistory, item.href) : {}), + }); + + // Clicking the Management breadcrumb to navigate back to the "root" only + // makes sense if there's a management app open. So when one isn't open + // this breadcrumb shouldn't be a clickable link. + const breadcrumb = crumbs.length ? BREADCRUMB : BREADCRUMB_NO_HREF; + const breadcrumbValue = [ + wrapBreadcrumb(breadcrumb, history), + ...crumbs.map((item) => wrapBreadcrumb(item, appHistory || history)), + ]; + + searchNavigation?.breadcrumbs.setSearchBreadCrumbs(breadcrumbValue); + }, + [searchNavigation, history] + ); + + useEffect(() => { + const unmount = indexManagement.managementApp(managementRef.current, setBreadcrumbs, history); + return unmount; + }, [indexManagement, managementRef]); + return ( + + +
+ + + ); +}; diff --git a/x-pack/solutions/search/plugins/search_indices/public/index_management_application.tsx b/x-pack/solutions/search/plugins/search_indices/public/index_management_application.tsx new file mode 100644 index 0000000000000..c61ecf79b0c64 --- /dev/null +++ b/x-pack/solutions/search/plugins/search_indices/public/index_management_application.tsx @@ -0,0 +1,43 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { CoreSetup, CoreStart, ScopedHistory } from '@kbn/core/public'; +import { I18nProvider } from '@kbn/i18n-react'; +import { IndexManagementPluginSetup } from '@kbn/index-management-shared-types'; +import { KibanaContextProvider } from '@kbn/kibana-react-plugin/public'; +import { KibanaRenderContextProvider } from '@kbn/react-kibana-context-render'; +import React from 'react'; +import ReactDOM from 'react-dom'; +import { IndexManagementApp } from './components/index_mangement/app'; + +export const renderIndexManagementApp = async ( + element: HTMLElement, + deps: { + core: CoreSetup; + history: ScopedHistory; + indexManagement: IndexManagementPluginSetup; + } +) => { + const { core, history, indexManagement } = deps; + const [coreStart, depsStart] = await core.getStartServices(); + const services = { + ...depsStart, + history, + }; + ReactDOM.render( + + + + + + + , + element + ); + + return () => ReactDOM.unmountComponentAtNode(element); +}; diff --git a/x-pack/solutions/search/plugins/search_indices/public/plugin.ts b/x-pack/solutions/search/plugins/search_indices/public/plugin.ts index 9ad42635b4ea5..640799e6aa1b8 100644 --- a/x-pack/solutions/search/plugins/search_indices/public/plugin.ts +++ b/x-pack/solutions/search/plugins/search_indices/public/plugin.ts @@ -88,6 +88,24 @@ export class SearchIndicesPlugin }, visibleIn: [], }); + core.application.register({ + id: 'searchIndexManagement', + appRoute: '/app/elasticsearch/index_management', + title: 'Search Index management', + async mount({ element, history }) { + // return plugins.indexManagement.managementApp(element, ()=>{},history); + const { renderIndexManagementApp } = await import('./index_management_application'); + // const { IndexManagementIndicesRouter } = await import('./components/idxManagement_router'); + // const [coreStart, depsStart] = await core.getStartServices(); + // const startDeps: SearchIndicesServicesContextDeps = { + // ...depsStart, + // history, + // }; + // const App = depsStart.indexManagement.getIndexManagementComponent({history: startDeps.history}) + return renderIndexManagementApp(element, {core, history, indexManagement:plugins.indexManagement }); + }, + visibleIn: [], + }); registerLocators(plugins.share); diff --git a/x-pack/solutions/search/plugins/search_playground/public/hooks/use_playground_breadcrumbs.ts b/x-pack/solutions/search/plugins/search_playground/public/hooks/use_playground_breadcrumbs.ts index 3fd64c3a7c2a7..223e1570ab775 100644 --- a/x-pack/solutions/search/plugins/search_playground/public/hooks/use_playground_breadcrumbs.ts +++ b/x-pack/solutions/search/plugins/search_playground/public/hooks/use_playground_breadcrumbs.ts @@ -27,8 +27,8 @@ export const usePlaygroundBreadcrumbs = () => { defaultMessage: 'Playground', }), }, - ], - { forClassicChromeStyle: true } + ] + ,{ forClassicChromeStyle: true } ); return () => { diff --git a/x-pack/solutions/search/plugins/search_solution/search_navigation/public/plugin.ts b/x-pack/solutions/search/plugins/search_solution/search_navigation/public/plugin.ts index d2e52e1683131..670f33bd7ca05 100644 --- a/x-pack/solutions/search/plugins/search_solution/search_navigation/public/plugin.ts +++ b/x-pack/solutions/search/plugins/search_solution/search_navigation/public/plugin.ts @@ -105,12 +105,12 @@ export class SearchNavigationPlugin { forClassicChromeStyle = false }: SearchNavigationSetBreadcrumbsOptions = {} ) { if (forClassicChromeStyle === true && this.currentChromeStyle !== 'classic') return; - + console.log("this.getSearchHomeBreadcrumb()",this.getSearchHomeBreadcrumb(),"breadcrumbs",breadcrumbs ) const searchBreadcrumbs = [this.getSearchHomeBreadcrumb(), ...breadcrumbs]; if (this.pluginsStart?.serverless) { - this.pluginsStart.serverless.setBreadcrumbs(searchBreadcrumbs); + this.pluginsStart.serverless.setBreadcrumbs(breadcrumbs); } else { - this.coreStart?.chrome.setBreadcrumbs(searchBreadcrumbs); + this.coreStart?.chrome.setBreadcrumbs(searchBreadcrumbs, {project: { value: searchBreadcrumbs, absolute: true },}); } } From 331dd2c2421023e114029b93994fdada9f66cd61 Mon Sep 17 00:00:00 2001 From: saarikabhasi Date: Sat, 22 Feb 2025 22:35:56 -0500 Subject: [PATCH 21/38] add deeplinks, update nav tree, update search_indices plugin --- .../shared/deeplinks/search/constants.ts | 1 + .../shared/deeplinks/search/deep_links.ts | 3 +++ .../packages/shared/deeplinks/search/index.ts | 1 + .../public/navigation_tree.ts | 20 +++++++++++++++---- .../plugins/search_indices/common/index.ts | 6 +++--- .../plugins/search_indices/public/plugin.ts | 11 ++++++---- .../plugins/search_indices/public/routes.ts | 1 + 7 files changed, 32 insertions(+), 11 deletions(-) diff --git a/src/platform/packages/shared/deeplinks/search/constants.ts b/src/platform/packages/shared/deeplinks/search/constants.ts index 85f8707bd968e..3f271199fea43 100644 --- a/src/platform/packages/shared/deeplinks/search/constants.ts +++ b/src/platform/packages/shared/deeplinks/search/constants.ts @@ -20,6 +20,7 @@ export const ES_SEARCH_SYNONYMS_ID = 'searchSynonyms'; export const SEARCH_HOMEPAGE = 'searchHomepage'; export const SEARCH_INDICES_START = 'elasticsearchStart'; export const SEARCH_INDICES = 'elasticsearchIndices'; +export const SEARCH_INDEX_MANAGEMENT = 'elasticsearchIndexManagement'; export const SEARCH_ELASTICSEARCH = 'enterpriseSearchElasticsearch'; export const SEARCH_VECTOR_SEARCH = 'enterpriseSearchVectorSearch'; export const SEARCH_SEMANTIC_SEARCH = 'enterpriseSearchSemanticSearch'; diff --git a/src/platform/packages/shared/deeplinks/search/deep_links.ts b/src/platform/packages/shared/deeplinks/search/deep_links.ts index 3aa024b4c9e08..9e1c7e6ab8b36 100644 --- a/src/platform/packages/shared/deeplinks/search/deep_links.ts +++ b/src/platform/packages/shared/deeplinks/search/deep_links.ts @@ -26,6 +26,7 @@ import { SEARCH_SEMANTIC_SEARCH, SEARCH_AI_SEARCH, ES_SEARCH_SYNONYMS_ID, + SEARCH_INDEX_MANAGEMENT, } from './constants'; export type EnterpriseSearchApp = typeof ENTERPRISE_SEARCH_APP_ID; @@ -41,6 +42,7 @@ export type SearchSynonymsId = typeof ES_SEARCH_SYNONYMS_ID; export type SearchHomepage = typeof SEARCH_HOMEPAGE; export type SearchStart = typeof SEARCH_INDICES_START; export type SearchIndices = typeof SEARCH_INDICES; +export type SearchIndexManagement = typeof SEARCH_INDEX_MANAGEMENT; export type SearchElasticsearch = typeof SEARCH_ELASTICSEARCH; export type SearchVectorSearch = typeof SEARCH_VECTOR_SEARCH; export type SearchSemanticSearch = typeof SEARCH_SEMANTIC_SEARCH; @@ -74,6 +76,7 @@ export type DeepLinkId = | `${SearchSynonymsId}:${SynonymsLinkId}` | SearchStart | SearchIndices + | SearchIndexManagement | SearchElasticsearch | SearchVectorSearch | SearchSemanticSearch diff --git a/src/platform/packages/shared/deeplinks/search/index.ts b/src/platform/packages/shared/deeplinks/search/index.ts index 7e2c41945dde7..c7bf21a05a12a 100644 --- a/src/platform/packages/shared/deeplinks/search/index.ts +++ b/src/platform/packages/shared/deeplinks/search/index.ts @@ -21,6 +21,7 @@ export { ES_SEARCH_PLAYGROUND_ID, SEARCH_INDICES_START, SEARCH_INDICES, + SEARCH_INDEX_MANAGEMENT } from './constants'; export type { diff --git a/x-pack/solutions/search/plugins/enterprise_search/public/navigation_tree.ts b/x-pack/solutions/search/plugins/enterprise_search/public/navigation_tree.ts index 63fc4bcc6e682..a9e525730a062 100644 --- a/x-pack/solutions/search/plugins/enterprise_search/public/navigation_tree.ts +++ b/x-pack/solutions/search/plugins/enterprise_search/public/navigation_tree.ts @@ -120,17 +120,29 @@ export const getNavigationTreeDefinition = ({ }, { children: [ + // { + // breadcrumbStatus: + // 'hidden' /* management sub-pages set their breadcrumbs themselves */, + // getIsActive: ({ pathNameSerialized, prepend }) => { + // return ( + // pathNameSerialized.startsWith( + // prepend('/app/management/data/index_management/') + // ) || pathNameSerialized.startsWith(prepend('/app/elasticsearch/indices')) + // ); + // }, + // link: 'management:index_management', + // }, { - breadcrumbStatus: - 'hidden' /* management sub-pages set their breadcrumbs themselves */, + // breadcrumbStatus: + // 'hidden' /* management sub-pages set their breadcrumbs themselves */, getIsActive: ({ pathNameSerialized, prepend }) => { return ( pathNameSerialized.startsWith( - prepend('/app/management/data/index_management/') + prepend('/app/elasticsearch/index_management/') ) || pathNameSerialized.startsWith(prepend('/app/elasticsearch/indices')) ); }, - link: 'management:index_management', + link: 'elasticsearchIndexManagement', }, { link: 'enterpriseSearchContent:connectors' }, { link: 'enterpriseSearchContent:webCrawlers' }, diff --git a/x-pack/solutions/search/plugins/search_indices/common/index.ts b/x-pack/solutions/search/plugins/search_indices/common/index.ts index a04f333fc17bc..b37736b8d7f54 100644 --- a/x-pack/solutions/search/plugins/search_indices/common/index.ts +++ b/x-pack/solutions/search/plugins/search_indices/common/index.ts @@ -5,12 +5,12 @@ * 2.0. */ -import type { SearchIndices, SearchStart } from '@kbn/deeplinks-search/deep_links'; -import { SEARCH_INDICES, SEARCH_INDICES_START } from '@kbn/deeplinks-search'; +import type { SearchIndices, SearchStart, SearchIndexManagement } from '@kbn/deeplinks-search/deep_links'; +import { SEARCH_INDICES, SEARCH_INDICES_START, SEARCH_INDEX_MANAGEMENT } from '@kbn/deeplinks-search'; export const PLUGIN_ID = 'searchIndices'; export const PLUGIN_NAME = 'searchIndices'; export const START_APP_ID: SearchStart = SEARCH_INDICES_START; export const INDICES_APP_ID: SearchIndices = SEARCH_INDICES; - +export const INDEX_MANAGEMENT_APP_ID:SearchIndexManagement = SEARCH_INDEX_MANAGEMENT; export type { IndicesStatusResponse, UserStartPrivilegesResponse } from './types'; diff --git a/x-pack/solutions/search/plugins/search_indices/public/plugin.ts b/x-pack/solutions/search/plugins/search_indices/public/plugin.ts index 640799e6aa1b8..496016a4df7b6 100644 --- a/x-pack/solutions/search/plugins/search_indices/public/plugin.ts +++ b/x-pack/solutions/search/plugins/search_indices/public/plugin.ts @@ -19,12 +19,13 @@ import type { SearchIndicesServicesContextDeps, } from './types'; import { initQueryClient } from './services/query_client'; -import { INDICES_APP_ID, START_APP_ID } from '../common'; +import { INDEX_MANAGEMENT_APP_ID, INDICES_APP_ID, START_APP_ID } from '../common'; import { CREATE_INDEX_PATH, INDICES_APP_BASE, START_APP_BASE, SearchIndexDetailsTabValues, + INDEX_MANAGEMNT_APP_BASE, } from './routes'; import { registerLocators } from './locators'; @@ -89,9 +90,11 @@ export class SearchIndicesPlugin visibleIn: [], }); core.application.register({ - id: 'searchIndexManagement', - appRoute: '/app/elasticsearch/index_management', - title: 'Search Index management', + id: INDEX_MANAGEMENT_APP_ID, + appRoute: INDEX_MANAGEMNT_APP_BASE, + title: i18n.translate('xpack.searchIndices.elasticsearchIndices.indexManagementTitle', { + defaultMessage: 'Index Management', + }), async mount({ element, history }) { // return plugins.indexManagement.managementApp(element, ()=>{},history); const { renderIndexManagementApp } = await import('./index_management_application'); diff --git a/x-pack/solutions/search/plugins/search_indices/public/routes.ts b/x-pack/solutions/search/plugins/search_indices/public/routes.ts index 86d05fb73032d..cef1fc679404f 100644 --- a/x-pack/solutions/search/plugins/search_indices/public/routes.ts +++ b/x-pack/solutions/search/plugins/search_indices/public/routes.ts @@ -18,3 +18,4 @@ export const CREATE_INDEX_PATH = `${ROOT_PATH}create`; export const SearchIndexDetailsTabValues: string[] = Object.values(SearchIndexDetailsTabs); export const START_APP_BASE = '/app/elasticsearch/start'; export const INDICES_APP_BASE = '/app/elasticsearch/indices'; +export const INDEX_MANAGEMNT_APP_BASE = '/app/elasticsearch/index_management' From 914504bd41d790663afaf2d8394059ddf943e0d8 Mon Sep 17 00:00:00 2001 From: saarikabhasi Date: Mon, 24 Feb 2025 21:06:46 -0500 Subject: [PATCH 22/38] fix breadcrumbs to work for serverless & stack --- .../create_index/create_index_page.tsx | 2 +- .../public/components/index_mangement/app.tsx | 9 +---- .../components/indices/details_page.tsx | 7 +--- .../public/components/shared/breadcrumbs.ts | 17 +++++--- .../public/components/start/start_page.tsx | 2 +- .../public/hooks/use_page_chrome.ts | 40 ++++++++++++++----- .../search_navigation/public/plugin.ts | 3 +- 7 files changed, 49 insertions(+), 31 deletions(-) diff --git a/x-pack/solutions/search/plugins/search_indices/public/components/create_index/create_index_page.tsx b/x-pack/solutions/search/plugins/search_indices/public/components/create_index/create_index_page.tsx index 904ecdb471c11..52a81698735af 100644 --- a/x-pack/solutions/search/plugins/search_indices/public/components/create_index/create_index_page.tsx +++ b/x-pack/solutions/search/plugins/search_indices/public/components/create_index/create_index_page.tsx @@ -36,7 +36,7 @@ export const CreateIndexPage = () => { () => (consolePlugin?.EmbeddableConsole ? : null), [consolePlugin] ); - usePageChrome(CreateIndexLabel, [...IndexManagementBreadcrumbs, { text: CreateIndexLabel }]); + usePageChrome(CreateIndexLabel, IndexManagementBreadcrumbs()); return ( = ({ indexMan const managementRef = useRef(null); const setBreadcrumbs = useCallback( (crumbs: ChromeBreadcrumb[] = [], appHistory?: ScopedHistory) => { - console.log('crumbs', crumbs); const wrapBreadcrumb = (item: ChromeBreadcrumb, scopedHistory: ScopedHistory) => ({ ...item, ...(item.href ? reactRouterNavigate(scopedHistory, item.href) : {}), @@ -43,7 +38,7 @@ export const IndexManagementApp: React.FC = ({ indexMan // Clicking the Management breadcrumb to navigate back to the "root" only // makes sense if there's a management app open. So when one isn't open // this breadcrumb shouldn't be a clickable link. - const breadcrumb = crumbs.length ? BREADCRUMB : BREADCRUMB_NO_HREF; + const breadcrumbValue = [ wrapBreadcrumb(breadcrumb, history), ...crumbs.map((item) => wrapBreadcrumb(item, appHistory || history)), diff --git a/x-pack/solutions/search/plugins/search_indices/public/components/indices/details_page.tsx b/x-pack/solutions/search/plugins/search_indices/public/components/indices/details_page.tsx index 9ebe524b3f903..ab0162bedad23 100644 --- a/x-pack/solutions/search/plugins/search_indices/public/components/indices/details_page.tsx +++ b/x-pack/solutions/search/plugins/search_indices/public/components/indices/details_page.tsx @@ -82,12 +82,7 @@ export const SearchIndexDetailsPage = () => { const hasDocuments = Boolean(isInitialLoading || indexDocuments?.results?.data.length); - usePageChrome(indexName, [ - ...IndexManagementBreadcrumbs, - { - text: indexName, - }, - ]); + usePageChrome(indexName, IndexManagementBreadcrumbs()); const usageTracker = useUsageTracker(); diff --git a/x-pack/solutions/search/plugins/search_indices/public/components/shared/breadcrumbs.ts b/x-pack/solutions/search/plugins/search_indices/public/components/shared/breadcrumbs.ts index 2805100d6cabb..d84880e36606d 100644 --- a/x-pack/solutions/search/plugins/search_indices/public/components/shared/breadcrumbs.ts +++ b/x-pack/solutions/search/plugins/search_indices/public/components/shared/breadcrumbs.ts @@ -7,18 +7,23 @@ import { ChromeBreadcrumb } from '@kbn/core-chrome-browser'; import { i18n } from '@kbn/i18n'; +import { useKibana } from '../../hooks/use_kibana'; -export const IndexManagementBreadcrumbs: ChromeBreadcrumb[] = [ - { +export const IndexManagementBreadcrumbs = (): ChromeBreadcrumb[] => { + const { cloud, http } = useKibana().services; + const indexManagementPath: string = cloud?.isServerlessEnabled? '/app/elasticsearch/data/index_management': '/app/elasticsearch/index_management' + return [{ text: i18n.translate('xpack.searchIndices.breadcrumbs.indexManagement.label', { defaultMessage: 'Index Management', }), - href: '/app/management/data/index_management', + href: http.basePath.prepend(indexManagementPath) + }, { text: i18n.translate('xpack.searchIndices.breadcrumbs.indexManagement.indices.label', { defaultMessage: 'Indices', }), - href: '/app/management/data/index_management/indices', - }, -]; + href: http.basePath.prepend(`${indexManagementPath}/indices`) + + }] +} diff --git a/x-pack/solutions/search/plugins/search_indices/public/components/start/start_page.tsx b/x-pack/solutions/search/plugins/search_indices/public/components/start/start_page.tsx index b4c8e44c0d401..05714f551ca2c 100644 --- a/x-pack/solutions/search/plugins/search_indices/public/components/start/start_page.tsx +++ b/x-pack/solutions/search/plugins/search_indices/public/components/start/start_page.tsx @@ -33,7 +33,7 @@ export const ElasticsearchStartPage = () => { error: indicesFetchError, } = useIndicesStatusQuery(); - usePageChrome(PageTitle, [...IndexManagementBreadcrumbs, { text: PageTitle }]); + usePageChrome(PageTitle, IndexManagementBreadcrumbs()); const embeddableConsole = useMemo( () => (consolePlugin?.EmbeddableConsole ? : null), diff --git a/x-pack/solutions/search/plugins/search_indices/public/hooks/use_page_chrome.ts b/x-pack/solutions/search/plugins/search_indices/public/hooks/use_page_chrome.ts index fae438b502a08..23038f8342768 100644 --- a/x-pack/solutions/search/plugins/search_indices/public/hooks/use_page_chrome.ts +++ b/x-pack/solutions/search/plugins/search_indices/public/hooks/use_page_chrome.ts @@ -8,22 +8,44 @@ import { useEffect } from 'react'; import type { ChromeBreadcrumb } from '@kbn/core-chrome-browser'; import { useKibana } from './use_kibana'; +import { i18n } from '@kbn/i18n'; +import { IndexManagementBreadcrumbs } from '../components/shared/breadcrumbs'; export const usePageChrome = (docTitle: string, breadcrumbs: ChromeBreadcrumb[]) => { - const { chrome, http, serverless } = useKibana().services; + const { cloud, chrome, http, serverless} = useKibana().services; + const IndexManagementBreadcrumb = IndexManagementBreadcrumbs(); + const newBreadcrumbs = [ + ...breadcrumbs, + { + text: docTitle, + }, + ] useEffect(() => { chrome.docTitle.change(docTitle); - const newBreadcrumbs = breadcrumbs.map((breadcrumb) => { - if (breadcrumb.href && http.basePath.get().length > 0) { - breadcrumb.href = http.basePath.prepend(breadcrumb.href); - } - return breadcrumb; - }); + // const newBreadcrumbs = breadcrumbs.map((breadcrumb) => { + // if (breadcrumb.href && http.basePath.get().length > 0) { + // breadcrumb.href = http.basePath.prepend(breadcrumb.href); + // } + // return breadcrumb; + // }); + if (serverless) { serverless.setBreadcrumbs(newBreadcrumbs); } else { - chrome.setBreadcrumbs(newBreadcrumbs); + // chrome.setBreadcrumbs([{ + // text: i18n.translate('xpack.searchIndices.breadcrumbs.indexManagement.label', { + // defaultMessage: 'Content', + // }), + // }], { + // project: { value: newBreadcrumbs, absolute: true }, + // }); + const breadcrumbs = [{ + text: i18n.translate('xpack.searchIndices.breadcrumbs.indexManagement.label', { + defaultMessage: 'Content', + }), + }, ...newBreadcrumbs] + chrome.setBreadcrumbs(breadcrumbs, { project: { value: breadcrumbs, absolute: true }}) } return () => { // clear manually set breadcrumbs @@ -33,5 +55,5 @@ export const usePageChrome = (docTitle: string, breadcrumbs: ChromeBreadcrumb[]) chrome.setBreadcrumbs([]); } }; - }, [breadcrumbs, chrome, docTitle, http.basePath, serverless]); + }, [chrome, docTitle, http.basePath, serverless]); }; diff --git a/x-pack/solutions/search/plugins/search_solution/search_navigation/public/plugin.ts b/x-pack/solutions/search/plugins/search_solution/search_navigation/public/plugin.ts index 670f33bd7ca05..cb23beec0c1a8 100644 --- a/x-pack/solutions/search/plugins/search_solution/search_navigation/public/plugin.ts +++ b/x-pack/solutions/search/plugins/search_solution/search_navigation/public/plugin.ts @@ -110,7 +110,8 @@ export class SearchNavigationPlugin if (this.pluginsStart?.serverless) { this.pluginsStart.serverless.setBreadcrumbs(breadcrumbs); } else { - this.coreStart?.chrome.setBreadcrumbs(searchBreadcrumbs, {project: { value: searchBreadcrumbs, absolute: true },}); + const searchBreadcrumbs = [this.getSearchHomeBreadcrumb(), ...breadcrumbs]; + this.coreStart?.chrome.setBreadcrumbs(searchBreadcrumbs, { project: { value: breadcrumbs, absolute: true },}); } } From d10e94a60cfbb5f93e17cb46153178ff7ece7f74 Mon Sep 17 00:00:00 2001 From: saarikabhasi Date: Tue, 25 Feb 2025 13:14:06 -0500 Subject: [PATCH 23/38] delete unused files, clean up types fix breadcrumbs clean up -removed console --- .../shared/management/public/plugin.tsx | 1 - .../src/types.ts | 12 +- .../public/application/app.tsx | 1 - .../mount_management_search_indices.ts | 183 ------------------ .../application/mount_management_section.ts | 3 +- .../home_page_embeddable.tsx | 31 --- .../home_page_with_context.tsx | 48 ----- .../home_page_with_context_types.tsx | 24 --- .../shared/index_management/public/plugin.ts | 71 +------ .../plugins/search_indices/common/index.ts | 14 +- .../create_index/create_index_page.tsx | 7 +- .../components/idxManagement_router.tsx | 36 ---- .../public/components/index_mangement/app.tsx | 18 +- .../components/indices/details_page.tsx | 7 +- .../public/components/shared/breadcrumbs.ts | 34 ++-- .../public/components/start/start_page.tsx | 7 +- .../public/hooks/use_page_chrome.ts | 44 ++--- .../public/index_management_application.tsx | 2 +- .../plugins/search_indices/public/plugin.ts | 14 +- .../plugins/search_indices/public/routes.ts | 2 +- .../search_navigation/public/plugin.ts | 3 +- 21 files changed, 92 insertions(+), 470 deletions(-) delete mode 100644 x-pack/platform/plugins/shared/index_management/public/application/mount_management_search_indices.ts delete mode 100644 x-pack/platform/plugins/shared/index_management/public/application/sections/home/index_list/details_page/with_context_components/home_page_embeddable.tsx delete mode 100644 x-pack/platform/plugins/shared/index_management/public/application/sections/home/index_list/details_page/with_context_components/home_page_with_context.tsx delete mode 100644 x-pack/platform/plugins/shared/index_management/public/application/sections/home/index_list/details_page/with_context_components/home_page_with_context_types.tsx delete mode 100644 x-pack/solutions/search/plugins/search_indices/public/components/idxManagement_router.tsx diff --git a/src/platform/plugins/shared/management/public/plugin.tsx b/src/platform/plugins/shared/management/public/plugin.tsx index 41fc8c41c856f..97778792316ea 100644 --- a/src/platform/plugins/shared/management/public/plugin.tsx +++ b/src/platform/plugins/shared/management/public/plugin.tsx @@ -131,7 +131,6 @@ export class ManagementPlugin const [, ...trailingBreadcrumbs] = newBreadcrumbs; deps.serverless.setBreadcrumbs(trailingBreadcrumbs); } else { - console.log('here', newBreadcrumbs); coreStart.chrome.setBreadcrumbs(newBreadcrumbs, { project: { value: newBreadcrumbs, absolute: true }, }); diff --git a/x-pack/platform/packages/shared/index-management/index_management_shared_types/src/types.ts b/x-pack/platform/packages/shared/index-management/index_management_shared_types/src/types.ts index 6fc32fb2cc0db..95d09b5c2e88e 100644 --- a/x-pack/platform/packages/shared/index-management/index_management_shared_types/src/types.ts +++ b/x-pack/platform/packages/shared/index-management/index_management_shared_types/src/types.ts @@ -16,6 +16,7 @@ import type { SerializableRecord } from '@kbn/utility-types'; import type { LocatorPublic } from '@kbn/share-plugin/public'; import { ExtensionsSetup } from './services/extensions_service'; import { PublicApiServiceSetup } from './services/public_api_service'; +import { ChromeBreadcrumb } from '@kbn/core/public'; export type IndexManagementLocatorParams = SerializableRecord & ( @@ -35,11 +36,17 @@ export type IndexManagementLocatorParams = SerializableRecord & export type IndexManagementLocator = LocatorPublic; +export interface SearchIndicesAppMountParams { + element: HTMLElement |null; + setBreadcrumbs: (crumbs: ChromeBreadcrumb[]) => void; + history: ScopedHistory; + +} export interface IndexManagementPluginSetup { apiService: PublicApiServiceSetup; extensionsService: ExtensionsSetup; locator?: IndexManagementLocator; - managementApp?: any; + managementApp:(params: SearchIndicesAppMountParams) => Promise<() => void>; } export interface IndexManagementPluginStart { @@ -50,9 +57,6 @@ export interface IndexManagementPluginStart { getIndexSettingsComponent: (deps: { history: ScopedHistory; }) => React.FC; - getIndexManagementComponent:(deps: { - history: ScopedHistory; - }) => React.FC<{}>; } export interface Index { diff --git a/x-pack/platform/plugins/shared/index_management/public/application/app.tsx b/x-pack/platform/plugins/shared/index_management/public/application/app.tsx index 8902680db4ab8..1fc9dd26e4cde 100644 --- a/x-pack/platform/plugins/shared/index_management/public/application/app.tsx +++ b/x-pack/platform/plugins/shared/index_management/public/application/app.tsx @@ -31,7 +31,6 @@ export const App = ({ history }: { history: ScopedHistory }) => { () => services.uiMetricService.trackMetric(METRIC_TYPE.LOADED, UIM_APP_LOAD), [services.uiMetricService] ); - console.log("/:section(${homeSections.join('|')})", homeSections.join('|')); return ( diff --git a/x-pack/platform/plugins/shared/index_management/public/application/mount_management_search_indices.ts b/x-pack/platform/plugins/shared/index_management/public/application/mount_management_search_indices.ts deleted file mode 100644 index bb5e547d32737..0000000000000 --- a/x-pack/platform/plugins/shared/index_management/public/application/mount_management_search_indices.ts +++ /dev/null @@ -1,183 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import '../index.scss'; -import { i18n } from '@kbn/i18n'; -import SemVer from 'semver/classes/semver'; -import { ChromeBreadcrumb, CoreSetup, CoreStart, ScopedHistory } from '@kbn/core/public'; -import { ManagementAppMountParams } from '@kbn/management-plugin/public'; -import { UsageCollectionSetup } from '@kbn/usage-collection-plugin/public'; -import { CloudSetup } from '@kbn/cloud-plugin/public'; -import { UIM_APP_NAME } from '../../common/constants'; -import { PLUGIN } from '../../common/constants/plugin'; -import { AppDependencies } from './app_context'; -import { breadcrumbService } from './services/breadcrumbs'; -import { documentationService } from './services/documentation'; -import { UiMetricService } from './services'; - -import { renderApp } from '.'; -import { setUiMetricService } from './services/api'; -import { notificationService } from './services/notification'; -import { httpService } from './services/http'; -import { ExtensionsService } from '../services/extensions_service'; -import { StartDependencies } from '../types'; - -interface SearchIndicesAppMountParams { - element: HTMLElement; // element the section should render into - setBreadcrumbs: (crumbs: ChromeBreadcrumb[]) => void; - history: ScopedHistory; -} - - -function initSetup({ - usageCollection, - core, -}: { - core: CoreStart; - usageCollection: UsageCollectionSetup; -}) { - const { http, notifications } = core; - - httpService.setup(http); - notificationService.setup(notifications); - - const uiMetricService = new UiMetricService(UIM_APP_NAME); - - setUiMetricService(uiMetricService); - - uiMetricService.setup(usageCollection); - - return { uiMetricService }; -} - -export function getIndexManagementDependenciesIndices({ - core, - usageCollection, - extensionsService, - history, - isFleetEnabled, - kibanaVersion, - config, - cloud, - startDependencies, - uiMetricService, - canUseSyntheticSource, -}: { - core: CoreStart; - usageCollection: UsageCollectionSetup; - extensionsService: ExtensionsService; - history: ScopedHistory; - isFleetEnabled: boolean; - kibanaVersion: SemVer; - config: AppDependencies['config']; - cloud?: CloudSetup; - startDependencies: StartDependencies; - uiMetricService: UiMetricService; - canUseSyntheticSource: boolean; -}): AppDependencies { - const { docLinks, application, uiSettings, settings } = core; - const { url } = startDependencies.share; - const { monitor, manageEnrich, monitorEnrich, manageIndexTemplates } = - application.capabilities.index_management; - - return { - core: { - getUrlForApp: application.getUrlForApp, - ...core, - }, - plugins: { - usageCollection, - isFleetEnabled, - share: startDependencies.share, - cloud, - console: startDependencies.console, - ml: startDependencies.ml, - licensing: startDependencies.licensing, - }, - services: { - httpService, - notificationService, - uiMetricService, - extensionsService, - }, - config, - history, - setBreadcrumbs: breadcrumbService.setBreadcrumbs, - uiSettings, - settings, - url, - docLinks, - kibanaVersion, - overlays: core.overlays, - canUseSyntheticSource, - privs: { - monitor: !!monitor, - manageEnrich: !!manageEnrich, - monitorEnrich: !!monitorEnrich, - manageIndexTemplates: !!manageIndexTemplates, - }, - }; -} - -export async function mountIndexManagementSection({ - coreSetup, - usageCollection, - params, - extensionsService, - isFleetEnabled, - kibanaVersion, - config, - cloud, - canUseSyntheticSource, -}: { - coreSetup: CoreSetup; - usageCollection: UsageCollectionSetup; - params: SearchIndicesAppMountParams; - extensionsService: ExtensionsService; - isFleetEnabled: boolean; - kibanaVersion: SemVer; - config: AppDependencies['config']; - cloud?: CloudSetup; - canUseSyntheticSource: boolean; -}) { - console.log("mountIndexManagementSection") - const { element, setBreadcrumbs, history } = params; - const [core, startDependencies] = await coreSetup.getStartServices(); - const { - docLinks, - chrome: { docTitle }, - } = core; - docTitle.change(PLUGIN.getI18nName(i18n)); - - breadcrumbService.setup(setBreadcrumbs); - documentationService.setup(docLinks); - - const { uiMetricService } = initSetup({ - usageCollection, - core, - }); - const appDependencies = getIndexManagementDependenciesIndices({ - cloud, - config, - core, - extensionsService, - history, - isFleetEnabled, - kibanaVersion, - startDependencies, - uiMetricService, - usageCollection, - canUseSyntheticSource, - }); - - const unmountAppCallback = renderApp(element, { core, dependencies: appDependencies }); - - return () => { - docTitle.reset(); - unmountAppCallback(); - }; -} diff --git a/x-pack/platform/plugins/shared/index_management/public/application/mount_management_section.ts b/x-pack/platform/plugins/shared/index_management/public/application/mount_management_section.ts index 4cc57c2b06a07..8a0139248df0f 100644 --- a/x-pack/platform/plugins/shared/index_management/public/application/mount_management_section.ts +++ b/x-pack/platform/plugins/shared/index_management/public/application/mount_management_section.ts @@ -12,6 +12,7 @@ import { CoreSetup, CoreStart, ScopedHistory } from '@kbn/core/public'; import { ManagementAppMountParams } from '@kbn/management-plugin/public'; import { UsageCollectionSetup } from '@kbn/usage-collection-plugin/public'; import { CloudSetup } from '@kbn/cloud-plugin/public'; +import { SearchIndicesAppMountParams } from '@kbn/index-management-shared-types'; import { UIM_APP_NAME } from '../../common/constants'; import { PLUGIN } from '../../common/constants/plugin'; import { AppDependencies } from './app_context'; @@ -129,7 +130,7 @@ export async function mountManagementSection({ }: { coreSetup: CoreSetup; usageCollection: UsageCollectionSetup; - params: ManagementAppMountParams; + params: ManagementAppMountParams | SearchIndicesAppMountParams; extensionsService: ExtensionsService; isFleetEnabled: boolean; kibanaVersion: SemVer; diff --git a/x-pack/platform/plugins/shared/index_management/public/application/sections/home/index_list/details_page/with_context_components/home_page_embeddable.tsx b/x-pack/platform/plugins/shared/index_management/public/application/sections/home/index_list/details_page/with_context_components/home_page_embeddable.tsx deleted file mode 100644 index 34b1db536c7e3..0000000000000 --- a/x-pack/platform/plugins/shared/index_management/public/application/sections/home/index_list/details_page/with_context_components/home_page_embeddable.tsx +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -/* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import { EuiLoadingSpinner } from '@elastic/eui'; -import { dynamic } from '@kbn/shared-ux-utility'; -import React, { Suspense, ComponentType } from 'react'; -import { HomePageWithContext } from './home_page_with_context'; -import { IndexManagementHomeContextTypes } from './home_page_with_context_types'; -import { IndexSettingWithContextProps } from './index_settings_with_context_types'; - -const IndexManagementHomeWithContext = dynamic>(() => - import('./home_page_with_context').then((mod) => ({ default: mod.HomePageWithContext })) -); - -export const IndexManagementHomeEmbeddable: React.FC = (props) => { - return ( - }> - - - ); -}; diff --git a/x-pack/platform/plugins/shared/index_management/public/application/sections/home/index_list/details_page/with_context_components/home_page_with_context.tsx b/x-pack/platform/plugins/shared/index_management/public/application/sections/home/index_list/details_page/with_context_components/home_page_with_context.tsx deleted file mode 100644 index 9b0310ff6d9ab..0000000000000 --- a/x-pack/platform/plugins/shared/index_management/public/application/sections/home/index_list/details_page/with_context_components/home_page_with_context.tsx +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import React from 'react'; -import { documentationService } from '../../../../../services'; -import { UIM_APP_NAME } from '../../../../../../../common/constants/ui_metric'; -import { httpService } from '../../../../../services/http'; -import { notificationService } from '../../../../../services/notification'; -import { UiMetricService } from '../../../../../services/ui_metric'; -import { AppDependencies, IndexManagementAppContext } from '../../../../..'; -import { IndexMappingWithContextProps } from './index_mapping_with_context_types'; -import { DetailsPageMappings } from '../details_page_mappings'; -import { IndexManagementHomeContextTypes } from './home_page_with_context_types'; -import { IndexManagementHome } from '../../../home'; -import { App } from '../../../../../../application/app'; -export const HomePageWithContext: React.FC = ({ - core, - dependencies, -}) => { - // this normally happens when the index management app is rendered - // but if components are embedded elsewhere that setup is skipped, so we have to do it here - // would do it in plugin.ts but that blows up the bundle size - // can't do it in an effect because then the first http call fails as the instantiation happens after first render - if (!httpService.httpClient) { - httpService.setup(core.http); - notificationService.setup(core.notifications); - } - documentationService.setup(core.docLinks); - - const newDependencies: AppDependencies = { - ...dependencies, - services: { - ...(dependencies.services || {}), - httpService, - notificationService, - uiMetricService: new UiMetricService(UIM_APP_NAME), - }, - }; - return ( - - - - ); -}; diff --git a/x-pack/platform/plugins/shared/index_management/public/application/sections/home/index_list/details_page/with_context_components/home_page_with_context_types.tsx b/x-pack/platform/plugins/shared/index_management/public/application/sections/home/index_list/details_page/with_context_components/home_page_with_context_types.tsx deleted file mode 100644 index 3a0397f9a00ab..0000000000000 --- a/x-pack/platform/plugins/shared/index_management/public/application/sections/home/index_list/details_page/with_context_components/home_page_with_context_types.tsx +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import { CoreStart } from '@kbn/core/public'; -import type { IndexSettingProps } from '@kbn/index-management-shared-types'; -import { UsageCollectionSetup } from '@kbn/usage-collection-plugin/public'; -import { AppDependencies } from '../../../../../app_context'; -import { ExtensionsService } from '../../../../../../services/extensions_service'; -import { MatchParams } from '../../../home'; - -export type IndexManagementHomeContextTypes = { - core: CoreStart; - // omitting services here to constitute them inside the component - // this helps reduce bundle size significantly - dependencies: Omit & { - services: { extensionsService: ExtensionsService }; - }; - usageCollection: UsageCollectionSetup; -}; -// & MatchParams; diff --git a/x-pack/platform/plugins/shared/index_management/public/plugin.ts b/x-pack/platform/plugins/shared/index_management/public/plugin.ts index 662a1b40da5f9..0673c30eb15e9 100644 --- a/x-pack/platform/plugins/shared/index_management/public/plugin.ts +++ b/x-pack/platform/plugins/shared/index_management/public/plugin.ts @@ -16,11 +16,11 @@ import { PluginInitializerContext, ScopedHistory, Capabilities, - ChromeBreadcrumb, } from '@kbn/core/public'; import { IndexManagementPluginSetup, IndexManagementPluginStart, + SearchIndicesAppMountParams, } from '@kbn/index-management-shared-types'; import { IndexManagementLocator } from '@kbn/index-management-shared-types'; import { Subscription } from 'rxjs'; @@ -35,8 +35,6 @@ import { IndexMapping } from './application/sections/home/index_list/details_pag import { PublicApiService } from './services/public_api_service'; import { IndexSettings } from './application/sections/home/index_list/details_page/with_context_components/index_settings_embeddable'; import { IndexManagementLocatorDefinition } from './locator'; -import { IndexManagementHome } from './application/sections/home'; -import { IndexManagementHomeEmbeddable } from './application/sections/home/index_list/details_page/with_context_components/home_page_embeddable'; export class IndexMgmtUIPlugin implements @@ -148,14 +146,12 @@ export class IndexMgmtUIPlugin apiService: new PublicApiService(coreSetup.http), extensionsService: this.extensionsService.setup(), locator: this.locator, - managementApp: async (element: HTMLElement, setBreadcrumbs:(newBreadCrumbs:ChromeBreadcrumb[] )=> void, history: ScopedHistory) => { - const { mountIndexManagementSection } = await import( - './application/mount_management_search_indices' - ); - return mountIndexManagementSection({ + managementApp: async (params: SearchIndicesAppMountParams) => { + const { mountManagementSection } = await import('./application/mount_management_section'); + return mountManagementSection({ coreSetup, usageCollection, - params: {element, setBreadcrumbs, history}, + params, extensionsService: this.extensionsService, isFleetEnabled: Boolean(fleet), kibanaVersion: this.kibanaVersion, @@ -163,8 +159,7 @@ export class IndexMgmtUIPlugin cloud, canUseSyntheticSource: this.canUseSyntheticSource, }); - } - + }, }; } @@ -255,60 +250,6 @@ export class IndexMgmtUIPlugin return IndexSettings({ dependencies: appDependencies, core: coreStart, ...props }); }; }, - getIndexManagementComponent: (deps: { history: ScopedHistory }) =>{ - const { docLinks, fatalErrors, application, uiSettings, executionContext, settings, http } = - coreStart; - const { url } = share; - const appDependencies = { - core: { - fatalErrors, - getUrlForApp: application.getUrlForApp, - executionContext, - application, - http, - }, - plugins: { - usageCollection, - isFleetEnabled: Boolean(fleet), - share, - cloud, - console, - ml, - licensing, - }, - services: { - extensionsService: this.extensionsService, - }, - config: this.config, - history: deps.history, - setBreadcrumbs: undefined as any, // breadcrumbService.setBreadcrumbs, - uiSettings, - settings, - url, - docLinks, - kibanaVersion: this.kibanaVersion, - theme$: coreStart.theme.theme$, - }; - return (props: any) => { - return IndexManagementHomeEmbeddable({ dependencies: appDependencies, core: coreStart, ...props }); - }; - }, - // getIndexManagementComponent: async (element: HTMLElement, setBreadcrumbs:()=> void, history: ScopedHistory) => { - // const { mountIndexManagementSection } = await import( - // './application/mount_management_search_indices' - // ); - // return mountIndexManagementSection({ - // coreSetup, - // usageCollection, - // params: {element, setBreadcrumbs, history}, - // extensionsService: this.extensionsService, - // isFleetEnabled: Boolean(fleet), - // kibanaVersion: this.kibanaVersion, - // config: this.config, - // cloud, - // canUseSyntheticSource: this.canUseSyntheticSource, - // }); - // } }; } public stop() { diff --git a/x-pack/solutions/search/plugins/search_indices/common/index.ts b/x-pack/solutions/search/plugins/search_indices/common/index.ts index b37736b8d7f54..8a8dbaa166b59 100644 --- a/x-pack/solutions/search/plugins/search_indices/common/index.ts +++ b/x-pack/solutions/search/plugins/search_indices/common/index.ts @@ -5,12 +5,20 @@ * 2.0. */ -import type { SearchIndices, SearchStart, SearchIndexManagement } from '@kbn/deeplinks-search/deep_links'; -import { SEARCH_INDICES, SEARCH_INDICES_START, SEARCH_INDEX_MANAGEMENT } from '@kbn/deeplinks-search'; +import type { + SearchIndices, + SearchStart, + SearchIndexManagement, +} from '@kbn/deeplinks-search/deep_links'; +import { + SEARCH_INDICES, + SEARCH_INDICES_START, + SEARCH_INDEX_MANAGEMENT, +} from '@kbn/deeplinks-search'; export const PLUGIN_ID = 'searchIndices'; export const PLUGIN_NAME = 'searchIndices'; export const START_APP_ID: SearchStart = SEARCH_INDICES_START; export const INDICES_APP_ID: SearchIndices = SEARCH_INDICES; -export const INDEX_MANAGEMENT_APP_ID:SearchIndexManagement = SEARCH_INDEX_MANAGEMENT; +export const INDEX_MANAGEMENT_APP_ID: SearchIndexManagement = SEARCH_INDEX_MANAGEMENT; export type { IndicesStatusResponse, UserStartPrivilegesResponse } from './types'; diff --git a/x-pack/solutions/search/plugins/search_indices/public/components/create_index/create_index_page.tsx b/x-pack/solutions/search/plugins/search_indices/public/components/create_index/create_index_page.tsx index 52a81698735af..557e14de64d94 100644 --- a/x-pack/solutions/search/plugins/search_indices/public/components/create_index/create_index_page.tsx +++ b/x-pack/solutions/search/plugins/search_indices/public/components/create_index/create_index_page.tsx @@ -36,7 +36,12 @@ export const CreateIndexPage = () => { () => (consolePlugin?.EmbeddableConsole ? : null), [consolePlugin] ); - usePageChrome(CreateIndexLabel, IndexManagementBreadcrumbs()); + usePageChrome(CreateIndexLabel, [ + ...IndexManagementBreadcrumbs(), + { + text: CreateIndexLabel, + }, + ]); return ( { - const { application, history } = useKibana().services; - return ( - - - - { - application.navigateToApp('elasticsearchStart'); - return null; - }} - /> - - - ); -}; diff --git a/x-pack/solutions/search/plugins/search_indices/public/components/index_mangement/app.tsx b/x-pack/solutions/search/plugins/search_indices/public/components/index_mangement/app.tsx index 35fac41c6ec3c..76b3f3144648f 100644 --- a/x-pack/solutions/search/plugins/search_indices/public/components/index_mangement/app.tsx +++ b/x-pack/solutions/search/plugins/search_indices/public/components/index_mangement/app.tsx @@ -10,11 +10,10 @@ import { IndexManagementPluginSetup } from '@kbn/index-management-shared-types'; import { reactRouterNavigate } from '@kbn/kibana-react-plugin/public'; import { KibanaPageTemplate } from '@kbn/shared-ux-page-kibana-template'; import React, { useRef, useEffect, useCallback } from 'react'; -import { useKibana } from '../../hooks/use_kibana'; - import { i18n } from '@kbn/i18n'; +import { useKibana } from '../../hooks/use_kibana'; -const breadcrumbText = i18n.translate('management.breadcrumb', { +const breadcrumbText = i18n.translate('xpack.searchIndices.breadcrumb', { defaultMessage: 'Content', }); @@ -35,10 +34,6 @@ export const IndexManagementApp: React.FC = ({ indexMan ...(item.href ? reactRouterNavigate(scopedHistory, item.href) : {}), }); - // Clicking the Management breadcrumb to navigate back to the "root" only - // makes sense if there's a management app open. So when one isn't open - // this breadcrumb shouldn't be a clickable link. - const breadcrumbValue = [ wrapBreadcrumb(breadcrumb, history), ...crumbs.map((item) => wrapBreadcrumb(item, appHistory || history)), @@ -50,9 +45,12 @@ export const IndexManagementApp: React.FC = ({ indexMan ); useEffect(() => { - const unmount = indexManagement.managementApp(managementRef.current, setBreadcrumbs, history); - return unmount; - }, [indexManagement, managementRef]); + const unmount = () => { + indexManagement.managementApp({ element: managementRef.current, setBreadcrumbs, history }); + }; + + return unmount(); + }, [indexManagement, managementRef, setBreadcrumbs, history]); return ( { const hasDocuments = Boolean(isInitialLoading || indexDocuments?.results?.data.length); - usePageChrome(indexName, IndexManagementBreadcrumbs()); + usePageChrome(indexName, [ + ...IndexManagementBreadcrumbs(), + { + text: indexName, + }, + ]); const usageTracker = useUsageTracker(); diff --git a/x-pack/solutions/search/plugins/search_indices/public/components/shared/breadcrumbs.ts b/x-pack/solutions/search/plugins/search_indices/public/components/shared/breadcrumbs.ts index d84880e36606d..b12a8115e6b3a 100644 --- a/x-pack/solutions/search/plugins/search_indices/public/components/shared/breadcrumbs.ts +++ b/x-pack/solutions/search/plugins/search_indices/public/components/shared/breadcrumbs.ts @@ -11,19 +11,21 @@ import { useKibana } from '../../hooks/use_kibana'; export const IndexManagementBreadcrumbs = (): ChromeBreadcrumb[] => { const { cloud, http } = useKibana().services; - const indexManagementPath: string = cloud?.isServerlessEnabled? '/app/elasticsearch/data/index_management': '/app/elasticsearch/index_management' - return [{ - text: i18n.translate('xpack.searchIndices.breadcrumbs.indexManagement.label', { - defaultMessage: 'Index Management', - }), - href: http.basePath.prepend(indexManagementPath) - - }, - { - text: i18n.translate('xpack.searchIndices.breadcrumbs.indexManagement.indices.label', { - defaultMessage: 'Indices', - }), - href: http.basePath.prepend(`${indexManagementPath}/indices`) - - }] -} + const indexManagementPath: string = cloud?.isServerlessEnabled + ? '/app/elasticsearch/data/index_management' + : '/app/elasticsearch/index_management'; + return [ + { + text: i18n.translate('xpack.searchIndices.breadcrumbs.indexManagement.label', { + defaultMessage: 'Index Management', + }), + href: http.basePath.prepend(indexManagementPath), + }, + { + text: i18n.translate('xpack.searchIndices.breadcrumbs.indexManagement.indices.label', { + defaultMessage: 'Indices', + }), + href: http.basePath.prepend(`${indexManagementPath}/indices`), + }, + ]; +}; diff --git a/x-pack/solutions/search/plugins/search_indices/public/components/start/start_page.tsx b/x-pack/solutions/search/plugins/search_indices/public/components/start/start_page.tsx index 05714f551ca2c..81e635c21b29b 100644 --- a/x-pack/solutions/search/plugins/search_indices/public/components/start/start_page.tsx +++ b/x-pack/solutions/search/plugins/search_indices/public/components/start/start_page.tsx @@ -33,7 +33,12 @@ export const ElasticsearchStartPage = () => { error: indicesFetchError, } = useIndicesStatusQuery(); - usePageChrome(PageTitle, IndexManagementBreadcrumbs()); + usePageChrome(PageTitle, [ + ...IndexManagementBreadcrumbs(), + { + text: PageTitle, + }, + ]); const embeddableConsole = useMemo( () => (consolePlugin?.EmbeddableConsole ? : null), diff --git a/x-pack/solutions/search/plugins/search_indices/public/hooks/use_page_chrome.ts b/x-pack/solutions/search/plugins/search_indices/public/hooks/use_page_chrome.ts index 23038f8342768..fd245d25acb53 100644 --- a/x-pack/solutions/search/plugins/search_indices/public/hooks/use_page_chrome.ts +++ b/x-pack/solutions/search/plugins/search_indices/public/hooks/use_page_chrome.ts @@ -7,45 +7,27 @@ import { useEffect } from 'react'; import type { ChromeBreadcrumb } from '@kbn/core-chrome-browser'; -import { useKibana } from './use_kibana'; import { i18n } from '@kbn/i18n'; -import { IndexManagementBreadcrumbs } from '../components/shared/breadcrumbs'; +import { useKibana } from './use_kibana'; export const usePageChrome = (docTitle: string, breadcrumbs: ChromeBreadcrumb[]) => { - const { cloud, chrome, http, serverless} = useKibana().services; - const IndexManagementBreadcrumb = IndexManagementBreadcrumbs(); - const newBreadcrumbs = [ - ...breadcrumbs, - { - text: docTitle, - }, - ] + const { chrome, serverless } = useKibana().services; useEffect(() => { chrome.docTitle.change(docTitle); - // const newBreadcrumbs = breadcrumbs.map((breadcrumb) => { - // if (breadcrumb.href && http.basePath.get().length > 0) { - // breadcrumb.href = http.basePath.prepend(breadcrumb.href); - // } - // return breadcrumb; - // }); if (serverless) { - serverless.setBreadcrumbs(newBreadcrumbs); + serverless.setBreadcrumbs(breadcrumbs); } else { - // chrome.setBreadcrumbs([{ - // text: i18n.translate('xpack.searchIndices.breadcrumbs.indexManagement.label', { - // defaultMessage: 'Content', - // }), - // }], { - // project: { value: newBreadcrumbs, absolute: true }, - // }); - const breadcrumbs = [{ - text: i18n.translate('xpack.searchIndices.breadcrumbs.indexManagement.label', { - defaultMessage: 'Content', - }), - }, ...newBreadcrumbs] - chrome.setBreadcrumbs(breadcrumbs, { project: { value: breadcrumbs, absolute: true }}) + const newBreadcrumbs = [ + { + text: i18n.translate('xpack.searchIndices.breadcrumbs.content.label', { + defaultMessage: 'Content', + }), + }, + ...breadcrumbs, + ]; + chrome.setBreadcrumbs(newBreadcrumbs, { project: { value: newBreadcrumbs, absolute: true } }); } return () => { // clear manually set breadcrumbs @@ -55,5 +37,5 @@ export const usePageChrome = (docTitle: string, breadcrumbs: ChromeBreadcrumb[]) chrome.setBreadcrumbs([]); } }; - }, [chrome, docTitle, http.basePath, serverless]); + }, [chrome, docTitle, serverless, breadcrumbs]); }; diff --git a/x-pack/solutions/search/plugins/search_indices/public/index_management_application.tsx b/x-pack/solutions/search/plugins/search_indices/public/index_management_application.tsx index c61ecf79b0c64..a5eae2540336f 100644 --- a/x-pack/solutions/search/plugins/search_indices/public/index_management_application.tsx +++ b/x-pack/solutions/search/plugins/search_indices/public/index_management_application.tsx @@ -5,7 +5,7 @@ * 2.0. */ -import { CoreSetup, CoreStart, ScopedHistory } from '@kbn/core/public'; +import { CoreSetup, ScopedHistory } from '@kbn/core/public'; import { I18nProvider } from '@kbn/i18n-react'; import { IndexManagementPluginSetup } from '@kbn/index-management-shared-types'; import { KibanaContextProvider } from '@kbn/kibana-react-plugin/public'; diff --git a/x-pack/solutions/search/plugins/search_indices/public/plugin.ts b/x-pack/solutions/search/plugins/search_indices/public/plugin.ts index 496016a4df7b6..65508200e8e42 100644 --- a/x-pack/solutions/search/plugins/search_indices/public/plugin.ts +++ b/x-pack/solutions/search/plugins/search_indices/public/plugin.ts @@ -96,16 +96,12 @@ export class SearchIndicesPlugin defaultMessage: 'Index Management', }), async mount({ element, history }) { - // return plugins.indexManagement.managementApp(element, ()=>{},history); const { renderIndexManagementApp } = await import('./index_management_application'); - // const { IndexManagementIndicesRouter } = await import('./components/idxManagement_router'); - // const [coreStart, depsStart] = await core.getStartServices(); - // const startDeps: SearchIndicesServicesContextDeps = { - // ...depsStart, - // history, - // }; - // const App = depsStart.indexManagement.getIndexManagementComponent({history: startDeps.history}) - return renderIndexManagementApp(element, {core, history, indexManagement:plugins.indexManagement }); + return renderIndexManagementApp(element, { + core, + history, + indexManagement: plugins.indexManagement, + }); }, visibleIn: [], }); diff --git a/x-pack/solutions/search/plugins/search_indices/public/routes.ts b/x-pack/solutions/search/plugins/search_indices/public/routes.ts index cef1fc679404f..7f87c88f57574 100644 --- a/x-pack/solutions/search/plugins/search_indices/public/routes.ts +++ b/x-pack/solutions/search/plugins/search_indices/public/routes.ts @@ -18,4 +18,4 @@ export const CREATE_INDEX_PATH = `${ROOT_PATH}create`; export const SearchIndexDetailsTabValues: string[] = Object.values(SearchIndexDetailsTabs); export const START_APP_BASE = '/app/elasticsearch/start'; export const INDICES_APP_BASE = '/app/elasticsearch/indices'; -export const INDEX_MANAGEMNT_APP_BASE = '/app/elasticsearch/index_management' +export const INDEX_MANAGEMNT_APP_BASE = '/app/elasticsearch/index_management'; diff --git a/x-pack/solutions/search/plugins/search_solution/search_navigation/public/plugin.ts b/x-pack/solutions/search/plugins/search_solution/search_navigation/public/plugin.ts index cb23beec0c1a8..13819b9894cc7 100644 --- a/x-pack/solutions/search/plugins/search_solution/search_navigation/public/plugin.ts +++ b/x-pack/solutions/search/plugins/search_solution/search_navigation/public/plugin.ts @@ -105,8 +105,7 @@ export class SearchNavigationPlugin { forClassicChromeStyle = false }: SearchNavigationSetBreadcrumbsOptions = {} ) { if (forClassicChromeStyle === true && this.currentChromeStyle !== 'classic') return; - console.log("this.getSearchHomeBreadcrumb()",this.getSearchHomeBreadcrumb(),"breadcrumbs",breadcrumbs ) - const searchBreadcrumbs = [this.getSearchHomeBreadcrumb(), ...breadcrumbs]; + if (this.pluginsStart?.serverless) { this.pluginsStart.serverless.setBreadcrumbs(breadcrumbs); } else { From 4b38e69e98431e9b4e211f037f8e8acf7816deb5 Mon Sep 17 00:00:00 2001 From: saarikabhasi Date: Tue, 25 Feb 2025 17:20:46 -0500 Subject: [PATCH 24/38] fix breadcrumbs for serverless search --- .../enterprise_search/public/navigation_tree.ts | 16 +--------------- .../components/create_index/create_index.tsx | 2 +- .../public/components/index_mangement/app.tsx | 12 ++++++++---- .../public/components/shared/breadcrumbs.ts | 10 ++++------ .../start/hooks/use_indices_redirect.tsx | 2 +- .../serverless_search/public/navigation_tree.ts | 4 ++-- 6 files changed, 17 insertions(+), 29 deletions(-) diff --git a/x-pack/solutions/search/plugins/enterprise_search/public/navigation_tree.ts b/x-pack/solutions/search/plugins/enterprise_search/public/navigation_tree.ts index a9e525730a062..524baa1ff8698 100644 --- a/x-pack/solutions/search/plugins/enterprise_search/public/navigation_tree.ts +++ b/x-pack/solutions/search/plugins/enterprise_search/public/navigation_tree.ts @@ -120,25 +120,11 @@ export const getNavigationTreeDefinition = ({ }, { children: [ - // { - // breadcrumbStatus: - // 'hidden' /* management sub-pages set their breadcrumbs themselves */, - // getIsActive: ({ pathNameSerialized, prepend }) => { - // return ( - // pathNameSerialized.startsWith( - // prepend('/app/management/data/index_management/') - // ) || pathNameSerialized.startsWith(prepend('/app/elasticsearch/indices')) - // ); - // }, - // link: 'management:index_management', - // }, { - // breadcrumbStatus: - // 'hidden' /* management sub-pages set their breadcrumbs themselves */, getIsActive: ({ pathNameSerialized, prepend }) => { return ( pathNameSerialized.startsWith( - prepend('/app/elasticsearch/index_management/') + prepend('/app/elasticsearch/index_management/indices') ) || pathNameSerialized.startsWith(prepend('/app/elasticsearch/indices')) ); }, diff --git a/x-pack/solutions/search/plugins/search_indices/public/components/create_index/create_index.tsx b/x-pack/solutions/search/plugins/search_indices/public/components/create_index/create_index.tsx index 13223e2621d39..2c764ff82168a 100644 --- a/x-pack/solutions/search/plugins/search_indices/public/components/create_index/create_index.tsx +++ b/x-pack/solutions/search/plugins/search_indices/public/components/create_index/create_index.tsx @@ -87,7 +87,7 @@ export const CreateIndex = ({ indicesData }: CreateIndexProps) => { [usageTracker, formState, setFormState] ); const onClose = useCallback(() => { - application.navigateToApp('management', { deepLinkId: 'index_management' }); + application.navigateToApp('elasticsearchIndexManagement'); }, [application]); return ( diff --git a/x-pack/solutions/search/plugins/search_indices/public/components/index_mangement/app.tsx b/x-pack/solutions/search/plugins/search_indices/public/components/index_mangement/app.tsx index 76b3f3144648f..c0ae3fa190aec 100644 --- a/x-pack/solutions/search/plugins/search_indices/public/components/index_mangement/app.tsx +++ b/x-pack/solutions/search/plugins/search_indices/public/components/index_mangement/app.tsx @@ -25,7 +25,7 @@ interface IndexManagementAppProps { indexManagement: IndexManagementPluginSetup; } export const IndexManagementApp: React.FC = ({ indexManagement }) => { - const { history, searchNavigation } = useKibana().services; + const { history, searchNavigation, cloud } = useKibana().services; const managementRef = useRef(null); const setBreadcrumbs = useCallback( (crumbs: ChromeBreadcrumb[] = [], appHistory?: ScopedHistory) => { @@ -34,14 +34,18 @@ export const IndexManagementApp: React.FC = ({ indexMan ...(item.href ? reactRouterNavigate(scopedHistory, item.href) : {}), }); + const wrapBreadcrumbValue = !cloud?.isServerlessEnabled + ? [wrapBreadcrumb(breadcrumb, history)] + : []; + const breadcrumbValue = [ - wrapBreadcrumb(breadcrumb, history), + ...wrapBreadcrumbValue, ...crumbs.map((item) => wrapBreadcrumb(item, appHistory || history)), ]; searchNavigation?.breadcrumbs.setSearchBreadCrumbs(breadcrumbValue); }, - [searchNavigation, history] + [searchNavigation, history, cloud] ); useEffect(() => { @@ -50,7 +54,7 @@ export const IndexManagementApp: React.FC = ({ indexMan }; return unmount(); - }, [indexManagement, managementRef, setBreadcrumbs, history]); + }, [indexManagement, managementRef, setBreadcrumbs, history, cloud]); return ( { - const { cloud, http } = useKibana().services; - const indexManagementPath: string = cloud?.isServerlessEnabled - ? '/app/elasticsearch/data/index_management' - : '/app/elasticsearch/index_management'; + const { http } = useKibana().services; + return [ { text: i18n.translate('xpack.searchIndices.breadcrumbs.indexManagement.label', { defaultMessage: 'Index Management', }), - href: http.basePath.prepend(indexManagementPath), + href: http.basePath.prepend('/app/elasticsearch/index_management'), }, { text: i18n.translate('xpack.searchIndices.breadcrumbs.indexManagement.indices.label', { defaultMessage: 'Indices', }), - href: http.basePath.prepend(`${indexManagementPath}/indices`), + href: http.basePath.prepend(`/app/elasticsearch/index_management/indices`), }, ]; }; diff --git a/x-pack/solutions/search/plugins/search_indices/public/components/start/hooks/use_indices_redirect.tsx b/x-pack/solutions/search/plugins/search_indices/public/components/start/hooks/use_indices_redirect.tsx index 6909b1117e327..5d214603a44a8 100644 --- a/x-pack/solutions/search/plugins/search_indices/public/components/start/hooks/use_indices_redirect.tsx +++ b/x-pack/solutions/search/plugins/search_indices/public/components/start/hooks/use_indices_redirect.tsx @@ -32,7 +32,7 @@ export const useIndicesRedirect = (indicesStatus?: IndicesStatusResponse) => { return; } if (lastStatus === undefined && indicesStatus.indexNames.length > 0) { - application.navigateToApp('management', { deepLinkId: 'index_management' }); + application.navigateToApp('elasticsearchIndexManagement'); setHasDoneRedirect(true); return; } diff --git a/x-pack/solutions/search/plugins/serverless_search/public/navigation_tree.ts b/x-pack/solutions/search/plugins/serverless_search/public/navigation_tree.ts index f70106175ede5..a1030eabf4561 100644 --- a/x-pack/solutions/search/plugins/serverless_search/public/navigation_tree.ts +++ b/x-pack/solutions/search/plugins/serverless_search/public/navigation_tree.ts @@ -37,13 +37,13 @@ export const navigationTree = ({ isAppRegistered }: ApplicationStart): Navigatio title: i18n.translate('xpack.serverlessSearch.nav.content.indices', { defaultMessage: 'Index Management', }), - link: 'management:index_management', + link: 'elasticsearchIndexManagement', breadcrumbStatus: 'hidden' /* management sub-pages set their breadcrumbs themselves */, getIsActive: ({ pathNameSerialized, prepend }) => { return ( pathNameSerialized.startsWith( - prepend('/app/management/data/index_management/') + prepend('/app/elasticsearch/index_management/indices') ) || pathNameSerialized.startsWith(prepend('/app/elasticsearch/indices')) || pathNameSerialized.startsWith(prepend('/app/elasticsearch/start')) From c07063d6131fd374371f13c3b02af51729f729cb Mon Sep 17 00:00:00 2001 From: saarikabhasi Date: Wed, 26 Feb 2025 15:50:01 -0500 Subject: [PATCH 25/38] fix tests Ftr tests fix search_sidenav_ftr --- .../page_objects/solution_navigation.ts | 3 ++- .../components/start/elasticsearch_start.tsx | 2 +- .../start/hooks/use_indices_redirect.tsx | 2 +- .../functional/page_objects/search_start.ts | 2 +- .../tests/solution_navigation.ts | 20 ++++++++++++++----- .../tests/search_sidenav.ts | 8 ++++---- 6 files changed, 24 insertions(+), 13 deletions(-) diff --git a/test/functional/page_objects/solution_navigation.ts b/test/functional/page_objects/solution_navigation.ts index 4fa56fce007ef..695b2a4dc16d3 100644 --- a/test/functional/page_objects/solution_navigation.ts +++ b/test/functional/page_objects/solution_navigation.ts @@ -113,6 +113,7 @@ export function SolutionNavigationProvider(ctx: Pick { diff --git a/x-pack/solutions/search/plugins/search_indices/public/components/start/elasticsearch_start.tsx b/x-pack/solutions/search/plugins/search_indices/public/components/start/elasticsearch_start.tsx index a211951d441d4..364669e28c047 100644 --- a/x-pack/solutions/search/plugins/search_indices/public/components/start/elasticsearch_start.tsx +++ b/x-pack/solutions/search/plugins/search_indices/public/components/start/elasticsearch_start.tsx @@ -95,7 +95,7 @@ export const ElasticsearchStart: React.FC = () => { [usageTracker, formState, setFormState] ); const onClose = useCallback(() => { - application.navigateToApp('management', { deepLinkId: 'index_management' }); + application.navigateToApp('elasticsearchIndexManagement'); }, [application]); return ( diff --git a/x-pack/solutions/search/plugins/search_indices/public/components/start/hooks/use_indices_redirect.tsx b/x-pack/solutions/search/plugins/search_indices/public/components/start/hooks/use_indices_redirect.tsx index 5d214603a44a8..9faaf42309453 100644 --- a/x-pack/solutions/search/plugins/search_indices/public/components/start/hooks/use_indices_redirect.tsx +++ b/x-pack/solutions/search/plugins/search_indices/public/components/start/hooks/use_indices_redirect.tsx @@ -42,7 +42,7 @@ export const useIndicesRedirect = (indicesStatus?: IndicesStatusResponse) => { usageTracker.click(AnalyticsEvents.startCreateIndexCreatedRedirect); return; } - application.navigateToApp('management', { deepLinkId: 'index_management' }); + application.navigateToApp('elasticsearchIndexManagement'); setHasDoneRedirect(true); }, [ application, diff --git a/x-pack/test/functional/page_objects/search_start.ts b/x-pack/test/functional/page_objects/search_start.ts index e2e40f9c10ace..eada328f8e509 100644 --- a/x-pack/test/functional/page_objects/search_start.ts +++ b/x-pack/test/functional/page_objects/search_start.ts @@ -26,7 +26,7 @@ export function SearchStartProvider({ getService }: FtrProviderContext) { async expectToBeOnIndexListPage() { await retry.tryForTime(60 * 1000, async () => { expect(await browser.getCurrentUrl()).contain( - '/app/management/data/index_management/indices' + '/app/elasticsearch/index_management/indices' ); }); }, diff --git a/x-pack/test/functional_search/tests/solution_navigation.ts b/x-pack/test/functional_search/tests/solution_navigation.ts index 612f16a0010d6..e4f40335f65ed 100644 --- a/x-pack/test/functional_search/tests/solution_navigation.ts +++ b/x-pack/test/functional_search/tests/solution_navigation.ts @@ -65,8 +65,17 @@ export default function searchSolutionNavigation({ await solutionNavigation.sidenav.expectLinkActive({ deepLinkId: 'enterpriseSearch', }); + // await solutionNavigation.breadcrumbs.expectBreadcrumbExists({ + // deepLinkId: 'enterpriseSearch', + // }); + await solutionNavigation.breadcrumbs.expectBreadcrumbExists({ text: 'Deployment' }); + await solutionNavigation.breadcrumbs.expectBreadcrumbExists({ text: 'Content' }); + await solutionNavigation.breadcrumbs.expectBreadcrumbExists({ text: 'Index Management' }); await solutionNavigation.breadcrumbs.expectBreadcrumbExists({ - deepLinkId: 'enterpriseSearch', + text: 'Indices', + }); + await solutionNavigation.breadcrumbs.expectBreadcrumbExists({ + text: 'Create your first index', }); // check Dev tools @@ -110,10 +119,10 @@ export default function searchSolutionNavigation({ // check the Content // > Indices section await solutionNavigation.sidenav.clickLink({ - deepLinkId: 'management:index_management', + deepLinkId: 'elasticsearchIndexManagement', }); await solutionNavigation.sidenav.expectLinkActive({ - deepLinkId: 'management:index_management', + deepLinkId: 'elasticsearchIndexManagement', }); await solutionNavigation.breadcrumbs.expectBreadcrumbExists({ text: 'Deployment' }); await solutionNavigation.breadcrumbs.expectBreadcrumbExists({ text: 'Content' }); @@ -228,7 +237,7 @@ export default function searchSolutionNavigation({ it("should redirect to index management when clicking on 'Indices'", async () => { await solutionNavigation.sidenav.clickLink({ - deepLinkId: 'management:index_management', + deepLinkId: 'elasticsearchIndexManagement', }); await indexManagement.expectToBeOnIndicesManagement(); }); @@ -247,7 +256,7 @@ export default function searchSolutionNavigation({ 'discover', 'dashboards', 'content', - 'management:index_management', + 'elasticsearchIndexManagement', 'enterpriseSearchContent:connectors', 'enterpriseSearchContent:webCrawlers', 'build', @@ -264,5 +273,6 @@ export default function searchSolutionNavigation({ 'monitoring', ]); }); + }); } diff --git a/x-pack/test/functional_solution_sidenav/tests/search_sidenav.ts b/x-pack/test/functional_solution_sidenav/tests/search_sidenav.ts index 811dd7bc8ca96..3f46ac70294b5 100644 --- a/x-pack/test/functional_solution_sidenav/tests/search_sidenav.ts +++ b/x-pack/test/functional_solution_sidenav/tests/search_sidenav.ts @@ -50,13 +50,13 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { // check the Content > Indices section await solutionNavigation.sidenav.clickLink({ - deepLinkId: 'management:index_management', + deepLinkId: 'elasticsearchIndexManagement', }); await solutionNavigation.sidenav.expectLinkActive({ - deepLinkId: 'management:index_management', + deepLinkId: 'elasticsearchIndexManagement', }); await solutionNavigation.breadcrumbs.expectBreadcrumbExists({ text: 'Deployment' }); - await solutionNavigation.breadcrumbs.expectBreadcrumbExists({ text: 'Stack Management' }); + await solutionNavigation.breadcrumbs.expectBreadcrumbExists({ text: 'Content' }); await solutionNavigation.breadcrumbs.expectBreadcrumbExists({ text: 'Index Management' }); await solutionNavigation.breadcrumbs.expectBreadcrumbExists({ text: 'Indices', @@ -66,7 +66,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { await solutionNavigation.sidenav.openSection('project_settings_project_nav'); await solutionNavigation.sidenav.clickLink({ navId: 'stack_management' }); await solutionNavigation.sidenav.expectLinkActive({ navId: 'stack_management' }); - await solutionNavigation.breadcrumbs.expectBreadcrumbExists({ text: 'Stack Management' }); + await solutionNavigation.breadcrumbs.expectBreadcrumbExists({ text: 'Content' }); // navigate back to the home page using header logo await solutionNavigation.clickLogo(); From e8cfe174c54100fb0bee36e78be0f04ad3403901 Mon Sep 17 00:00:00 2001 From: saarikabhasi Date: Wed, 26 Feb 2025 20:41:43 -0500 Subject: [PATCH 26/38] fix types & eslint --- src/platform/packages/shared/deeplinks/search/index.ts | 2 +- .../index_management_shared_types/src/types.ts | 9 ++++----- .../plugins/private/translations/translations/fr-FR.json | 2 +- .../plugins/private/translations/translations/ja-JP.json | 2 +- .../plugins/private/translations/translations/zh-CN.json | 2 +- .../search_solution/search_navigation/public/plugin.ts | 4 +++- .../test/functional_search/tests/solution_navigation.ts | 1 - 7 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/platform/packages/shared/deeplinks/search/index.ts b/src/platform/packages/shared/deeplinks/search/index.ts index c7bf21a05a12a..7d42acb273239 100644 --- a/src/platform/packages/shared/deeplinks/search/index.ts +++ b/src/platform/packages/shared/deeplinks/search/index.ts @@ -21,7 +21,7 @@ export { ES_SEARCH_PLAYGROUND_ID, SEARCH_INDICES_START, SEARCH_INDICES, - SEARCH_INDEX_MANAGEMENT + SEARCH_INDEX_MANAGEMENT, } from './constants'; export type { diff --git a/x-pack/platform/packages/shared/index-management/index_management_shared_types/src/types.ts b/x-pack/platform/packages/shared/index-management/index_management_shared_types/src/types.ts index 95d09b5c2e88e..8859775d9eb66 100644 --- a/x-pack/platform/packages/shared/index-management/index_management_shared_types/src/types.ts +++ b/x-pack/platform/packages/shared/index-management/index_management_shared_types/src/types.ts @@ -14,9 +14,9 @@ import { import type { ScopedHistory } from '@kbn/core-application-browser'; import type { SerializableRecord } from '@kbn/utility-types'; import type { LocatorPublic } from '@kbn/share-plugin/public'; +import { ChromeBreadcrumb } from '@kbn/core/public'; import { ExtensionsSetup } from './services/extensions_service'; import { PublicApiServiceSetup } from './services/public_api_service'; -import { ChromeBreadcrumb } from '@kbn/core/public'; export type IndexManagementLocatorParams = SerializableRecord & ( @@ -36,17 +36,16 @@ export type IndexManagementLocatorParams = SerializableRecord & export type IndexManagementLocator = LocatorPublic; -export interface SearchIndicesAppMountParams { - element: HTMLElement |null; +export interface SearchIndicesAppMountParams { + element: HTMLElement | null; setBreadcrumbs: (crumbs: ChromeBreadcrumb[]) => void; history: ScopedHistory; - } export interface IndexManagementPluginSetup { apiService: PublicApiServiceSetup; extensionsService: ExtensionsSetup; locator?: IndexManagementLocator; - managementApp:(params: SearchIndicesAppMountParams) => Promise<() => void>; + managementApp: (params: SearchIndicesAppMountParams) => Promise<() => void>; } export interface IndexManagementPluginStart { diff --git a/x-pack/platform/plugins/private/translations/translations/fr-FR.json b/x-pack/platform/plugins/private/translations/translations/fr-FR.json index fc2ff3b8166a5..a632a3516ad74 100644 --- a/x-pack/platform/plugins/private/translations/translations/fr-FR.json +++ b/x-pack/platform/plugins/private/translations/translations/fr-FR.json @@ -46588,4 +46588,4 @@ "xpack.watcher.watchEdit.thresholdWatchExpression.aggType.fieldIsRequiredValidationMessage": "Ce champ est requis.", "xpack.watcher.watcherDescription": "Détectez les modifications survenant dans vos données en créant, gérant et monitorant des alertes." } -} \ No newline at end of file +} diff --git a/x-pack/platform/plugins/private/translations/translations/ja-JP.json b/x-pack/platform/plugins/private/translations/translations/ja-JP.json index 33d6891cf64fb..7e892bce959ad 100644 --- a/x-pack/platform/plugins/private/translations/translations/ja-JP.json +++ b/x-pack/platform/plugins/private/translations/translations/ja-JP.json @@ -46439,4 +46439,4 @@ "xpack.watcher.watchEdit.thresholdWatchExpression.aggType.fieldIsRequiredValidationMessage": "フィールドを選択してください。", "xpack.watcher.watcherDescription": "アラートの作成、管理、監視によりデータへの変更を検知します。" } -} \ No newline at end of file +} diff --git a/x-pack/platform/plugins/private/translations/translations/zh-CN.json b/x-pack/platform/plugins/private/translations/translations/zh-CN.json index 945d946cc2f66..4f6a59fe990e6 100644 --- a/x-pack/platform/plugins/private/translations/translations/zh-CN.json +++ b/x-pack/platform/plugins/private/translations/translations/zh-CN.json @@ -45758,4 +45758,4 @@ "xpack.watcher.watchEdit.thresholdWatchExpression.aggType.fieldIsRequiredValidationMessage": "此字段必填。", "xpack.watcher.watcherDescription": "通过创建、管理和监测警报来检测数据中的更改。" } -} \ No newline at end of file +} diff --git a/x-pack/solutions/search/plugins/search_solution/search_navigation/public/plugin.ts b/x-pack/solutions/search/plugins/search_solution/search_navigation/public/plugin.ts index 13819b9894cc7..01783ffa219a0 100644 --- a/x-pack/solutions/search/plugins/search_solution/search_navigation/public/plugin.ts +++ b/x-pack/solutions/search/plugins/search_solution/search_navigation/public/plugin.ts @@ -110,7 +110,9 @@ export class SearchNavigationPlugin this.pluginsStart.serverless.setBreadcrumbs(breadcrumbs); } else { const searchBreadcrumbs = [this.getSearchHomeBreadcrumb(), ...breadcrumbs]; - this.coreStart?.chrome.setBreadcrumbs(searchBreadcrumbs, { project: { value: breadcrumbs, absolute: true },}); + this.coreStart?.chrome.setBreadcrumbs(searchBreadcrumbs, { + project: { value: breadcrumbs, absolute: true }, + }); } } diff --git a/x-pack/test/functional_search/tests/solution_navigation.ts b/x-pack/test/functional_search/tests/solution_navigation.ts index e4f40335f65ed..f059db7d4532a 100644 --- a/x-pack/test/functional_search/tests/solution_navigation.ts +++ b/x-pack/test/functional_search/tests/solution_navigation.ts @@ -273,6 +273,5 @@ export default function searchSolutionNavigation({ 'monitoring', ]); }); - }); } From d8b1abb6613cb562df699e7dbec332dcfc414637 Mon Sep 17 00:00:00 2001 From: saarikabhasi Date: Wed, 26 Feb 2025 20:51:10 -0500 Subject: [PATCH 27/38] remove unrelated changes fix ci: use ChromeBreadcrumb from core-chrome-browser rename manamementApp to indexManagementApp --- .../page_objects/solution_navigation.ts | 3 +-- .../src/types.ts | 4 ++-- .../public/application/sections/home/home.tsx | 2 +- .../application/services/breadcrumbs.ts | 1 + .../shared/index_management/public/plugin.ts | 2 +- .../public/components/index_mangement/app.tsx | 19 +++++++++++-------- .../hooks/use_playground_breadcrumbs.ts | 4 ++-- 7 files changed, 19 insertions(+), 16 deletions(-) diff --git a/test/functional/page_objects/solution_navigation.ts b/test/functional/page_objects/solution_navigation.ts index 695b2a4dc16d3..4fa56fce007ef 100644 --- a/test/functional/page_objects/solution_navigation.ts +++ b/test/functional/page_objects/solution_navigation.ts @@ -113,7 +113,6 @@ export function SolutionNavigationProvider(ctx: Pick { diff --git a/x-pack/platform/packages/shared/index-management/index_management_shared_types/src/types.ts b/x-pack/platform/packages/shared/index-management/index_management_shared_types/src/types.ts index 8859775d9eb66..43aac85b876bb 100644 --- a/x-pack/platform/packages/shared/index-management/index_management_shared_types/src/types.ts +++ b/x-pack/platform/packages/shared/index-management/index_management_shared_types/src/types.ts @@ -14,7 +14,7 @@ import { import type { ScopedHistory } from '@kbn/core-application-browser'; import type { SerializableRecord } from '@kbn/utility-types'; import type { LocatorPublic } from '@kbn/share-plugin/public'; -import { ChromeBreadcrumb } from '@kbn/core/public'; +import type { ChromeBreadcrumb } from '@kbn/core-chrome-browser'; import { ExtensionsSetup } from './services/extensions_service'; import { PublicApiServiceSetup } from './services/public_api_service'; @@ -45,7 +45,7 @@ export interface IndexManagementPluginSetup { apiService: PublicApiServiceSetup; extensionsService: ExtensionsSetup; locator?: IndexManagementLocator; - managementApp: (params: SearchIndicesAppMountParams) => Promise<() => void>; + indexManagementApp: (params: SearchIndicesAppMountParams) => Promise<() => void>; } export interface IndexManagementPluginStart { diff --git a/x-pack/platform/plugins/shared/index_management/public/application/sections/home/home.tsx b/x-pack/platform/plugins/shared/index_management/public/application/sections/home/home.tsx index 5ccf22750cf98..53ef500f597e0 100644 --- a/x-pack/platform/plugins/shared/index_management/public/application/sections/home/home.tsx +++ b/x-pack/platform/plugins/shared/index_management/public/application/sections/home/home.tsx @@ -29,7 +29,7 @@ export const homeSections = [ Section.EnrichPolicies, ]; -export interface MatchParams { +interface MatchParams { section: Section; } diff --git a/x-pack/platform/plugins/shared/index_management/public/application/services/breadcrumbs.ts b/x-pack/platform/plugins/shared/index_management/public/application/services/breadcrumbs.ts index 1d4f5fba52277..3b91a447f89da 100644 --- a/x-pack/platform/plugins/shared/index_management/public/application/services/breadcrumbs.ts +++ b/x-pack/platform/plugins/shared/index_management/public/application/services/breadcrumbs.ts @@ -56,6 +56,7 @@ class BreadcrumbService { public setup(setBreadcrumbsHandler: SetBreadcrumbs): void { this.setBreadcrumbsHandler = setBreadcrumbsHandler; + this.breadcrumbs.home = [ { text: i18n.translate('xpack.idxMgmt.breadcrumb.homeLabel', { diff --git a/x-pack/platform/plugins/shared/index_management/public/plugin.ts b/x-pack/platform/plugins/shared/index_management/public/plugin.ts index 0673c30eb15e9..644caa3781b02 100644 --- a/x-pack/platform/plugins/shared/index_management/public/plugin.ts +++ b/x-pack/platform/plugins/shared/index_management/public/plugin.ts @@ -146,7 +146,7 @@ export class IndexMgmtUIPlugin apiService: new PublicApiService(coreSetup.http), extensionsService: this.extensionsService.setup(), locator: this.locator, - managementApp: async (params: SearchIndicesAppMountParams) => { + indexManagementApp: async (params: SearchIndicesAppMountParams) => { const { mountManagementSection } = await import('./application/mount_management_section'); return mountManagementSection({ coreSetup, diff --git a/x-pack/solutions/search/plugins/search_indices/public/components/index_mangement/app.tsx b/x-pack/solutions/search/plugins/search_indices/public/components/index_mangement/app.tsx index c0ae3fa190aec..bbeaa97bc29d4 100644 --- a/x-pack/solutions/search/plugins/search_indices/public/components/index_mangement/app.tsx +++ b/x-pack/solutions/search/plugins/search_indices/public/components/index_mangement/app.tsx @@ -21,12 +21,11 @@ const breadcrumb = { text: breadcrumbText, }; -interface IndexManagementAppProps { - indexManagement: IndexManagementPluginSetup; -} -export const IndexManagementApp: React.FC = ({ indexManagement }) => { +export const IndexManagementApp: React.FC<{ indexManagement: IndexManagementPluginSetup }> = ({ + indexManagement, +}) => { const { history, searchNavigation, cloud } = useKibana().services; - const managementRef = useRef(null); + const indexManagementRef = useRef(null); const setBreadcrumbs = useCallback( (crumbs: ChromeBreadcrumb[] = [], appHistory?: ScopedHistory) => { const wrapBreadcrumb = (item: ChromeBreadcrumb, scopedHistory: ScopedHistory) => ({ @@ -50,11 +49,15 @@ export const IndexManagementApp: React.FC = ({ indexMan useEffect(() => { const unmount = () => { - indexManagement.managementApp({ element: managementRef.current, setBreadcrumbs, history }); + indexManagement.indexManagementApp({ + element: indexManagementRef.current, + setBreadcrumbs, + history, + }); }; return unmount(); - }, [indexManagement, managementRef, setBreadcrumbs, history, cloud]); + }, [indexManagement, indexManagementRef, setBreadcrumbs, history, cloud]); return ( = ({ indexMan solutionNav={searchNavigation?.useClassicNavigation(history)} > -
+
); diff --git a/x-pack/solutions/search/plugins/search_playground/public/hooks/use_playground_breadcrumbs.ts b/x-pack/solutions/search/plugins/search_playground/public/hooks/use_playground_breadcrumbs.ts index 223e1570ab775..3fd64c3a7c2a7 100644 --- a/x-pack/solutions/search/plugins/search_playground/public/hooks/use_playground_breadcrumbs.ts +++ b/x-pack/solutions/search/plugins/search_playground/public/hooks/use_playground_breadcrumbs.ts @@ -27,8 +27,8 @@ export const usePlaygroundBreadcrumbs = () => { defaultMessage: 'Playground', }), }, - ] - ,{ forClassicChromeStyle: true } + ], + { forClassicChromeStyle: true } ); return () => { From 0a84fed0da9820d292d3403b53e4b66e8e4db66c Mon Sep 17 00:00:00 2001 From: kibanamachine <42973632+kibanamachine@users.noreply.github.com> Date: Thu, 27 Feb 2025 03:12:21 +0000 Subject: [PATCH 28/38] [CI] Auto-commit changed files from 'node scripts/notice' --- .../index-management/index_management_shared_types/tsconfig.json | 1 + 1 file changed, 1 insertion(+) diff --git a/x-pack/platform/packages/shared/index-management/index_management_shared_types/tsconfig.json b/x-pack/platform/packages/shared/index-management/index_management_shared_types/tsconfig.json index b23a97fd4c854..dd09649a64f7b 100644 --- a/x-pack/platform/packages/shared/index-management/index_management_shared_types/tsconfig.json +++ b/x-pack/platform/packages/shared/index-management/index_management_shared_types/tsconfig.json @@ -19,5 +19,6 @@ "@kbn/core-application-browser", "@kbn/utility-types", "@kbn/share-plugin", + "@kbn/core-chrome-browser", ] } From 1d428ca6478eaca19b9eea03a59cdc6dc6fe3fe5 Mon Sep 17 00:00:00 2001 From: saarikabhasi Date: Wed, 26 Feb 2025 22:12:13 -0500 Subject: [PATCH 29/38] remove commented lines from solution_nav ftr --- x-pack/test/functional_search/tests/solution_navigation.ts | 3 --- 1 file changed, 3 deletions(-) diff --git a/x-pack/test/functional_search/tests/solution_navigation.ts b/x-pack/test/functional_search/tests/solution_navigation.ts index f059db7d4532a..b93c991b736dc 100644 --- a/x-pack/test/functional_search/tests/solution_navigation.ts +++ b/x-pack/test/functional_search/tests/solution_navigation.ts @@ -65,9 +65,6 @@ export default function searchSolutionNavigation({ await solutionNavigation.sidenav.expectLinkActive({ deepLinkId: 'enterpriseSearch', }); - // await solutionNavigation.breadcrumbs.expectBreadcrumbExists({ - // deepLinkId: 'enterpriseSearch', - // }); await solutionNavigation.breadcrumbs.expectBreadcrumbExists({ text: 'Deployment' }); await solutionNavigation.breadcrumbs.expectBreadcrumbExists({ text: 'Content' }); await solutionNavigation.breadcrumbs.expectBreadcrumbExists({ text: 'Index Management' }); From b5ed0525b483af41363a27c4c37002e85d870f28 Mon Sep 17 00:00:00 2001 From: saarikabhasi Date: Thu, 27 Feb 2025 11:49:13 -0500 Subject: [PATCH 30/38] fix ftrs for failing kibana CI fix ci --- .../server/collectors/application_usage/schema.ts | 1 + .../functional/page_objects/search_navigation.ts | 2 +- .../tests/search_sidenav.ts | 3 --- .../page_objects/svl_search_create_index_page.ts | 2 +- .../svl_search_elasticsearch_start_page.ts | 2 +- .../functional/test_suites/search/navigation.ts | 12 ++++++------ 6 files changed, 10 insertions(+), 12 deletions(-) diff --git a/src/platform/plugins/private/kibana_usage_collection/server/collectors/application_usage/schema.ts b/src/platform/plugins/private/kibana_usage_collection/server/collectors/application_usage/schema.ts index 5f605af64b665..24a01e7109dc8 100644 --- a/src/platform/plugins/private/kibana_usage_collection/server/collectors/application_usage/schema.ts +++ b/src/platform/plugins/private/kibana_usage_collection/server/collectors/application_usage/schema.ts @@ -140,6 +140,7 @@ export const applicationUsageSchema = { searchPlayground: commonSchema, elasticsearchIndices: commonSchema, elasticsearchStart: commonSchema, + elasticsearchIndexManagement: commonSchema, enterpriseSearchAnalytics: commonSchema, enterpriseSearchApplications: commonSchema, enterpriseSearchAISearch: commonSchema, diff --git a/x-pack/test/functional/page_objects/search_navigation.ts b/x-pack/test/functional/page_objects/search_navigation.ts index e6ff887b13ea5..b1d6d4c103afc 100644 --- a/x-pack/test/functional/page_objects/search_navigation.ts +++ b/x-pack/test/functional/page_objects/search_navigation.ts @@ -39,7 +39,7 @@ export function SearchNavigationProvider({ getService, getPageObjects }: FtrProv async navigateToIndexDetailPage(indexName: string) { await solutionNavigation.sidenav.expectLinkExists({ text: 'Index Management' }); await solutionNavigation.sidenav.clickLink({ - deepLinkId: 'management:index_management', + deepLinkId: 'elasticsearchIndexManagement', }); const indexNamesList = await testSubjects.findAll('indexTableIndexNameLink'); for (const indexNameLink of indexNamesList) { diff --git a/x-pack/test/functional_solution_sidenav/tests/search_sidenav.ts b/x-pack/test/functional_solution_sidenav/tests/search_sidenav.ts index 3f46ac70294b5..728a7dba7cc7d 100644 --- a/x-pack/test/functional_solution_sidenav/tests/search_sidenav.ts +++ b/x-pack/test/functional_solution_sidenav/tests/search_sidenav.ts @@ -44,9 +44,6 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { await solutionNavigation.sidenav.expectLinkActive({ deepLinkId: 'enterpriseSearch', }); - await solutionNavigation.breadcrumbs.expectBreadcrumbExists({ - deepLinkId: 'enterpriseSearch', - }); // check the Content > Indices section await solutionNavigation.sidenav.clickLink({ diff --git a/x-pack/test_serverless/functional/page_objects/svl_search_create_index_page.ts b/x-pack/test_serverless/functional/page_objects/svl_search_create_index_page.ts index 3d0d48f98a6a5..ac52f076f09b5 100644 --- a/x-pack/test_serverless/functional/page_objects/svl_search_create_index_page.ts +++ b/x-pack/test_serverless/functional/page_objects/svl_search_create_index_page.ts @@ -26,7 +26,7 @@ export function SvlSearchCreateIndexPageProvider({ getService }: FtrProviderCont async expectToBeOnIndexListPage() { await retry.tryForTime(60 * 1000, async () => { expect(await browser.getCurrentUrl()).contain( - '/app/management/data/index_management/indices' + '/app/elasticsearch/index_management/indices' ); }); }, diff --git a/x-pack/test_serverless/functional/page_objects/svl_search_elasticsearch_start_page.ts b/x-pack/test_serverless/functional/page_objects/svl_search_elasticsearch_start_page.ts index c0fcf55a97abb..bf92cded2e5de 100644 --- a/x-pack/test_serverless/functional/page_objects/svl_search_elasticsearch_start_page.ts +++ b/x-pack/test_serverless/functional/page_objects/svl_search_elasticsearch_start_page.ts @@ -26,7 +26,7 @@ export function SvlSearchElasticsearchStartPageProvider({ getService }: FtrProvi async expectToBeOnIndexListPage() { await retry.tryForTime(60 * 1000, async () => { expect(await browser.getCurrentUrl()).contain( - '/app/management/data/index_management/indices' + '/app/elasticsearch/index_management/indices' ); }); }, diff --git a/x-pack/test_serverless/functional/test_suites/search/navigation.ts b/x-pack/test_serverless/functional/test_suites/search/navigation.ts index cd0df5d4866bb..c543e7e9a53bc 100644 --- a/x-pack/test_serverless/functional/test_suites/search/navigation.ts +++ b/x-pack/test_serverless/functional/test_suites/search/navigation.ts @@ -36,7 +36,7 @@ export default function ({ getPageObject, getService }: FtrProviderContext) { // check side nav links await solutionNavigation.sidenav.expectSectionExists('search_project_nav'); await solutionNavigation.sidenav.expectLinkActive({ - deepLinkId: 'management:index_management', + deepLinkId: 'elasticsearchIndexManagement', }); await solutionNavigation.breadcrumbs.expectBreadcrumbExists({ text: 'Indices' }); await solutionNavigation.breadcrumbs.expectBreadcrumbExists({ @@ -47,10 +47,10 @@ export default function ({ getPageObject, getService }: FtrProviderContext) { // check Data // > Index Management await solutionNavigation.sidenav.clickLink({ - deepLinkId: 'management:index_management', + deepLinkId: 'elasticsearchIndexManagement', }); await solutionNavigation.sidenav.expectLinkActive({ - deepLinkId: 'management:index_management', + deepLinkId: 'elasticsearchIndexManagement', }); await solutionNavigation.breadcrumbs.expectBreadcrumbExists({ text: 'Data' }); await solutionNavigation.breadcrumbs.expectBreadcrumbExists({ text: 'Index Management' }); @@ -172,7 +172,7 @@ export default function ({ getPageObject, getService }: FtrProviderContext) { // navigate back to serverless search overview await svlCommonNavigation.clickLogo(); await svlCommonNavigation.sidenav.expectLinkActive({ - deepLinkId: 'management:index_management', + deepLinkId: 'elasticsearchIndexManagement', }); await svlCommonNavigation.breadcrumbs.expectBreadcrumbExists({ text: `Indices` }); await testSubjects.existOrFail(`elasticsearchStartPage`); @@ -190,7 +190,7 @@ export default function ({ getPageObject, getService }: FtrProviderContext) { }); it("management apps from the sidenav hide the 'stack management' root from the breadcrumbs", async () => { - await svlCommonNavigation.sidenav.clickLink({ deepLinkId: 'management:index_management' }); + await svlCommonNavigation.sidenav.clickLink({ deepLinkId: 'elasticsearchIndexManagement' }); await svlCommonNavigation.breadcrumbs.expectBreadcrumbTexts([ 'Data', 'Index Management', @@ -260,7 +260,7 @@ export default function ({ getPageObject, getService }: FtrProviderContext) { await solutionNavigation.sidenav.expectOnlyDefinedLinks([ 'search_project_nav', 'data', - 'management:index_management', + 'elasticsearchIndexManagement', 'serverlessConnectors', 'serverlessWebCrawlers', 'build', From 3c08dc037dc15c5cf0baebf7f3d67eec97ce8a65 Mon Sep 17 00:00:00 2001 From: kibanamachine <42973632+kibanamachine@users.noreply.github.com> Date: Thu, 27 Feb 2025 20:45:41 +0000 Subject: [PATCH 31/38] [CI] Auto-commit changed files from 'node scripts/telemetry_check' --- .../shared/telemetry/schema/oss_platform.json | 131 ++++++++++++++++++ 1 file changed, 131 insertions(+) diff --git a/src/platform/plugins/shared/telemetry/schema/oss_platform.json b/src/platform/plugins/shared/telemetry/schema/oss_platform.json index 487f404ab135f..9b55761381de7 100644 --- a/src/platform/plugins/shared/telemetry/schema/oss_platform.json +++ b/src/platform/plugins/shared/telemetry/schema/oss_platform.json @@ -2622,6 +2622,137 @@ } } }, + "elasticsearchIndexManagement": { + "properties": { + "appId": { + "type": "keyword", + "_meta": { + "description": "The application being tracked" + } + }, + "viewId": { + "type": "keyword", + "_meta": { + "description": "Always `main`" + } + }, + "clicks_total": { + "type": "long", + "_meta": { + "description": "General number of clicks in the application since we started counting them" + } + }, + "clicks_7_days": { + "type": "long", + "_meta": { + "description": "General number of clicks in the application over the last 7 days" + } + }, + "clicks_30_days": { + "type": "long", + "_meta": { + "description": "General number of clicks in the application over the last 30 days" + } + }, + "clicks_90_days": { + "type": "long", + "_meta": { + "description": "General number of clicks in the application over the last 90 days" + } + }, + "minutes_on_screen_total": { + "type": "float", + "_meta": { + "description": "Minutes the application is active and on-screen since we started counting them." + } + }, + "minutes_on_screen_7_days": { + "type": "float", + "_meta": { + "description": "Minutes the application is active and on-screen over the last 7 days" + } + }, + "minutes_on_screen_30_days": { + "type": "float", + "_meta": { + "description": "Minutes the application is active and on-screen over the last 30 days" + } + }, + "minutes_on_screen_90_days": { + "type": "float", + "_meta": { + "description": "Minutes the application is active and on-screen over the last 90 days" + } + }, + "views": { + "type": "array", + "items": { + "properties": { + "appId": { + "type": "keyword", + "_meta": { + "description": "The application being tracked" + } + }, + "viewId": { + "type": "keyword", + "_meta": { + "description": "The application view being tracked" + } + }, + "clicks_total": { + "type": "long", + "_meta": { + "description": "General number of clicks in the application sub view since we started counting them" + } + }, + "clicks_7_days": { + "type": "long", + "_meta": { + "description": "General number of clicks in the active application sub view over the last 7 days" + } + }, + "clicks_30_days": { + "type": "long", + "_meta": { + "description": "General number of clicks in the active application sub view over the last 30 days" + } + }, + "clicks_90_days": { + "type": "long", + "_meta": { + "description": "General number of clicks in the active application sub view over the last 90 days" + } + }, + "minutes_on_screen_total": { + "type": "float", + "_meta": { + "description": "Minutes the application sub view is active and on-screen since we started counting them." + } + }, + "minutes_on_screen_7_days": { + "type": "float", + "_meta": { + "description": "Minutes the application is active and on-screen active application sub view over the last 7 days" + } + }, + "minutes_on_screen_30_days": { + "type": "float", + "_meta": { + "description": "Minutes the application is active and on-screen active application sub view over the last 30 days" + } + }, + "minutes_on_screen_90_days": { + "type": "float", + "_meta": { + "description": "Minutes the application is active and on-screen active application sub view over the last 90 days" + } + } + } + } + } + } + }, "enterpriseSearchAnalytics": { "properties": { "appId": { From 27e157e8b0c98c30cb8452779c3affcd82db257e Mon Sep 17 00:00:00 2001 From: saarikabhasi Date: Thu, 27 Feb 2025 20:58:55 -0500 Subject: [PATCH 32/38] fix FTR search side nav --- x-pack/test/functional_solution_sidenav/tests/search_sidenav.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x-pack/test/functional_solution_sidenav/tests/search_sidenav.ts b/x-pack/test/functional_solution_sidenav/tests/search_sidenav.ts index 728a7dba7cc7d..84af17b4de0ca 100644 --- a/x-pack/test/functional_solution_sidenav/tests/search_sidenav.ts +++ b/x-pack/test/functional_solution_sidenav/tests/search_sidenav.ts @@ -71,7 +71,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { deepLinkId: 'enterpriseSearch', }); await solutionNavigation.breadcrumbs.expectBreadcrumbExists({ - deepLinkId: 'enterpriseSearch', + text: 'Content', }); await expectNoPageReload(); From 8c53c2e3bd6f3c5cdf95111852fa52ecbf79e209 Mon Sep 17 00:00:00 2001 From: saarikabhasi Date: Mon, 3 Mar 2025 13:03:37 -0500 Subject: [PATCH 33/38] fix unmount index management app --- .../src/types.ts | 2 +- .../public/components/index_mangement/app.tsx | 20 +++++++++++++------ 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/x-pack/platform/packages/shared/index-management/index_management_shared_types/src/types.ts b/x-pack/platform/packages/shared/index-management/index_management_shared_types/src/types.ts index 43aac85b876bb..1c35123821eb1 100644 --- a/x-pack/platform/packages/shared/index-management/index_management_shared_types/src/types.ts +++ b/x-pack/platform/packages/shared/index-management/index_management_shared_types/src/types.ts @@ -37,7 +37,7 @@ export type IndexManagementLocatorParams = SerializableRecord & export type IndexManagementLocator = LocatorPublic; export interface SearchIndicesAppMountParams { - element: HTMLElement | null; + element: HTMLElement; setBreadcrumbs: (crumbs: ChromeBreadcrumb[]) => void; history: ScopedHistory; } diff --git a/x-pack/solutions/search/plugins/search_indices/public/components/index_mangement/app.tsx b/x-pack/solutions/search/plugins/search_indices/public/components/index_mangement/app.tsx index bbeaa97bc29d4..1c3129f15cb81 100644 --- a/x-pack/solutions/search/plugins/search_indices/public/components/index_mangement/app.tsx +++ b/x-pack/solutions/search/plugins/search_indices/public/components/index_mangement/app.tsx @@ -48,16 +48,24 @@ export const IndexManagementApp: React.FC<{ indexManagement: IndexManagementPlug ); useEffect(() => { - const unmount = () => { - indexManagement.indexManagementApp({ - element: indexManagementRef.current, + // mount + let indexManagementUnmount: () => void | undefined; + indexManagement + .indexManagementApp({ + element: indexManagementRef.current!, setBreadcrumbs, history, + }) + .then((unmount) => { + indexManagementUnmount = unmount; }); + + return () => { + // unmount + indexManagementUnmount?.(); }; + }, [indexManagement, indexManagementRef, setBreadcrumbs, history]); - return unmount(); - }, [indexManagement, indexManagementRef, setBreadcrumbs, history, cloud]); return ( -
+
); From 511b5de95fe4dd0354776991496560d9a42a8605 Mon Sep 17 00:00:00 2001 From: saarikabhasi Date: Mon, 3 Mar 2025 17:35:27 -0500 Subject: [PATCH 34/38] clean up --- .../index_management_shared_types/src/types.ts | 2 +- .../plugins/shared/index_management/public/plugin.ts | 2 +- .../search/plugins/search_indices/common/index.ts | 2 +- .../search/plugins/search_indices/public/plugin.ts | 8 ++++---- .../search/plugins/search_indices/public/routes.ts | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/x-pack/platform/packages/shared/index-management/index_management_shared_types/src/types.ts b/x-pack/platform/packages/shared/index-management/index_management_shared_types/src/types.ts index 1c35123821eb1..c248077eea133 100644 --- a/x-pack/platform/packages/shared/index-management/index_management_shared_types/src/types.ts +++ b/x-pack/platform/packages/shared/index-management/index_management_shared_types/src/types.ts @@ -44,8 +44,8 @@ export interface SearchIndicesAppMountParams { export interface IndexManagementPluginSetup { apiService: PublicApiServiceSetup; extensionsService: ExtensionsSetup; - locator?: IndexManagementLocator; indexManagementApp: (params: SearchIndicesAppMountParams) => Promise<() => void>; + locator?: IndexManagementLocator; } export interface IndexManagementPluginStart { diff --git a/x-pack/platform/plugins/shared/index_management/public/plugin.ts b/x-pack/platform/plugins/shared/index_management/public/plugin.ts index 644caa3781b02..29397ce83eda0 100644 --- a/x-pack/platform/plugins/shared/index_management/public/plugin.ts +++ b/x-pack/platform/plugins/shared/index_management/public/plugin.ts @@ -145,7 +145,6 @@ export class IndexMgmtUIPlugin return { apiService: new PublicApiService(coreSetup.http), extensionsService: this.extensionsService.setup(), - locator: this.locator, indexManagementApp: async (params: SearchIndicesAppMountParams) => { const { mountManagementSection } = await import('./application/mount_management_section'); return mountManagementSection({ @@ -160,6 +159,7 @@ export class IndexMgmtUIPlugin canUseSyntheticSource: this.canUseSyntheticSource, }); }, + locator: this.locator, }; } diff --git a/x-pack/solutions/search/plugins/search_indices/common/index.ts b/x-pack/solutions/search/plugins/search_indices/common/index.ts index 8a8dbaa166b59..7fe6f8c7b87bb 100644 --- a/x-pack/solutions/search/plugins/search_indices/common/index.ts +++ b/x-pack/solutions/search/plugins/search_indices/common/index.ts @@ -20,5 +20,5 @@ export const PLUGIN_ID = 'searchIndices'; export const PLUGIN_NAME = 'searchIndices'; export const START_APP_ID: SearchStart = SEARCH_INDICES_START; export const INDICES_APP_ID: SearchIndices = SEARCH_INDICES; -export const INDEX_MANAGEMENT_APP_ID: SearchIndexManagement = SEARCH_INDEX_MANAGEMENT; +export const SEARCH_INDEX_MANAGEMENT_APP_ID: SearchIndexManagement = SEARCH_INDEX_MANAGEMENT; export type { IndicesStatusResponse, UserStartPrivilegesResponse } from './types'; diff --git a/x-pack/solutions/search/plugins/search_indices/public/plugin.ts b/x-pack/solutions/search/plugins/search_indices/public/plugin.ts index 65508200e8e42..1f0039eec916b 100644 --- a/x-pack/solutions/search/plugins/search_indices/public/plugin.ts +++ b/x-pack/solutions/search/plugins/search_indices/public/plugin.ts @@ -19,13 +19,13 @@ import type { SearchIndicesServicesContextDeps, } from './types'; import { initQueryClient } from './services/query_client'; -import { INDEX_MANAGEMENT_APP_ID, INDICES_APP_ID, START_APP_ID } from '../common'; +import { SEARCH_INDEX_MANAGEMENT_APP_ID, INDICES_APP_ID, START_APP_ID } from '../common'; import { CREATE_INDEX_PATH, INDICES_APP_BASE, START_APP_BASE, SearchIndexDetailsTabValues, - INDEX_MANAGEMNT_APP_BASE, + SEARCH_INDEX_MANAGEMENT_APP_BASE, } from './routes'; import { registerLocators } from './locators'; @@ -90,8 +90,8 @@ export class SearchIndicesPlugin visibleIn: [], }); core.application.register({ - id: INDEX_MANAGEMENT_APP_ID, - appRoute: INDEX_MANAGEMNT_APP_BASE, + id: SEARCH_INDEX_MANAGEMENT_APP_ID, + appRoute: SEARCH_INDEX_MANAGEMENT_APP_BASE, title: i18n.translate('xpack.searchIndices.elasticsearchIndices.indexManagementTitle', { defaultMessage: 'Index Management', }), diff --git a/x-pack/solutions/search/plugins/search_indices/public/routes.ts b/x-pack/solutions/search/plugins/search_indices/public/routes.ts index 7f87c88f57574..afcc0af6d22d2 100644 --- a/x-pack/solutions/search/plugins/search_indices/public/routes.ts +++ b/x-pack/solutions/search/plugins/search_indices/public/routes.ts @@ -18,4 +18,4 @@ export const CREATE_INDEX_PATH = `${ROOT_PATH}create`; export const SearchIndexDetailsTabValues: string[] = Object.values(SearchIndexDetailsTabs); export const START_APP_BASE = '/app/elasticsearch/start'; export const INDICES_APP_BASE = '/app/elasticsearch/indices'; -export const INDEX_MANAGEMNT_APP_BASE = '/app/elasticsearch/index_management'; +export const SEARCH_INDEX_MANAGEMENT_APP_BASE = '/app/elasticsearch/index_management'; From b799e107f80546412ced3259953800d3d3b7afc5 Mon Sep 17 00:00:00 2001 From: saarikabhasi Date: Mon, 3 Mar 2025 17:38:27 -0500 Subject: [PATCH 35/38] FTR: add breadcrumbs check for stack --- .../page_objects/index_management_page.ts | 2 +- .../page_objects/search_index_details_page.ts | 14 +++++++++++-- .../page_objects/search_navigation.ts | 2 +- .../tests/classic_navigation.ts | 2 +- .../tests/search_index_details.ts | 21 +++++++++++++++---- .../tests/solution_navigation.ts | 2 +- .../test_suites/search/search_index_detail.ts | 2 +- 7 files changed, 34 insertions(+), 11 deletions(-) diff --git a/x-pack/test/functional/page_objects/index_management_page.ts b/x-pack/test/functional/page_objects/index_management_page.ts index 14396aa99821f..213ec2b104fe9 100644 --- a/x-pack/test/functional/page_objects/index_management_page.ts +++ b/x-pack/test/functional/page_objects/index_management_page.ts @@ -18,7 +18,7 @@ export function IndexManagementPageProvider({ getService }: FtrProviderContext) return await testSubjects.getVisibleText('appTitle'); }, - async expectToBeOnIndicesManagement() { + async expectToBeOnIndexManagement() { const headingText = await testSubjects.getVisibleText('appTitle'); expect(headingText).to.be('Index Management'); }, diff --git a/x-pack/test/functional/page_objects/search_index_details_page.ts b/x-pack/test/functional/page_objects/search_index_details_page.ts index 21376b80ec38d..029a1d9a65e1b 100644 --- a/x-pack/test/functional/page_objects/search_index_details_page.ts +++ b/x-pack/test/functional/page_objects/search_index_details_page.ts @@ -288,11 +288,21 @@ export function SearchIndexDetailPageProvider({ getService }: FtrProviderContext await testSubjects.existOrFail('euiBreadcrumb'); expect(await testSubjects.getVisibleText('breadcrumb last')).to.contain(indexName); }, + async expectBreadcrumbsToBeAvailable(breadcrumbsName: string) { + const breadcrumbs = await testSubjects.findAll('breadcrumb'); + let isBreadcrumbShown: boolean = false; + for (const breadcrumb of breadcrumbs) { + if ((await breadcrumb.getVisibleText()) === breadcrumbsName) { + isBreadcrumbShown = true; + } + } + expect(isBreadcrumbShown).to.be(true); + }, - async clickOnIndexManagementBreadcrumb() { + async clickOnBreadcrumb(breadcrumbsName: string) { const breadcrumbs = await testSubjects.findAll('breadcrumb'); for (const breadcrumb of breadcrumbs) { - if ((await breadcrumb.getVisibleText()) === 'Index Management') { + if ((await breadcrumb.getVisibleText()) === breadcrumbsName) { await breadcrumb.click(); return; } diff --git a/x-pack/test/functional/page_objects/search_navigation.ts b/x-pack/test/functional/page_objects/search_navigation.ts index b1d6d4c103afc..d4c53bf7fc3d9 100644 --- a/x-pack/test/functional/page_objects/search_navigation.ts +++ b/x-pack/test/functional/page_objects/search_navigation.ts @@ -61,7 +61,7 @@ export function SearchNavigationProvider({ getService, getPageObjects }: FtrProv await common.navigateToApp(`indexManagement`); await indexManagement.changeTabs('indicesTab'); await header.waitUntilLoadingHasFinished(); - await indexManagement.expectToBeOnIndicesManagement(); + await indexManagement.expectToBeOnIndexManagement(); }); }, }; diff --git a/x-pack/test/functional_search/tests/classic_navigation.ts b/x-pack/test/functional_search/tests/classic_navigation.ts index 24aefceb6920b..149856a6add66 100644 --- a/x-pack/test/functional_search/tests/classic_navigation.ts +++ b/x-pack/test/functional_search/tests/classic_navigation.ts @@ -125,7 +125,7 @@ export default function searchSolutionNavigation({ it("should redirect to index management when clicking on 'Indices'", async () => { await searchClassicNavigation.clickNavItem('Indices'); - await indexManagement.expectToBeOnIndicesManagement(); + await indexManagement.expectToBeOnIndexManagement(); }); }); } diff --git a/x-pack/test/functional_search/tests/search_index_details.ts b/x-pack/test/functional_search/tests/search_index_details.ts index 607e96a352ec2..883df8a76fe9a 100644 --- a/x-pack/test/functional_search/tests/search_index_details.ts +++ b/x-pack/test/functional_search/tests/search_index_details.ts @@ -68,6 +68,23 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { it('should have embedded dev console', async () => { await testHasEmbeddedConsole(pageObjects); }); + it('should have breadcrumbs', async () => { + await pageObjects.searchIndexDetailsPage.expectIndexNametoBeInBreadcrumbs(indexName); + await pageObjects.searchIndexDetailsPage.expectBreadcrumbsToBeAvailable('Content'); + await pageObjects.searchIndexDetailsPage.expectBreadcrumbsToBeAvailable( + 'Index Management' + ); + await pageObjects.searchIndexDetailsPage.expectBreadcrumbsToBeAvailable('Indices'); + + await pageObjects.searchIndexDetailsPage.clickOnBreadcrumb('Indices'); + await pageObjects.indexManagement.expectToBeOnIndexManagement(); + + await pageObjects.searchIndexDetailsPage.clickOnBreadcrumb('Index Management'); + await pageObjects.indexManagement.expectToBeOnIndexManagement(); + + await pageObjects.searchNavigation.navigateToIndexDetailPage(indexName); + }); + it('should have connection details', async () => { await pageObjects.searchIndexDetailsPage.expectConnectionDetails(); }); @@ -127,10 +144,6 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { await pageObjects.searchIndexDetailsPage.expectQuickStatsAIMappingsToHaveVectorFields(); }); - it('should have breadcrumb navigation', async () => { - await pageObjects.searchIndexDetailsPage.expectIndexNametoBeInBreadcrumbs(indexName); - }); - it('should show code examples for adding documents', async () => { await pageObjects.searchIndexDetailsPage.expectAddDocumentCodeExamples(); await pageObjects.searchIndexDetailsPage.expectSelectedLanguage('python'); diff --git a/x-pack/test/functional_search/tests/solution_navigation.ts b/x-pack/test/functional_search/tests/solution_navigation.ts index b93c991b736dc..d94f7e4867d09 100644 --- a/x-pack/test/functional_search/tests/solution_navigation.ts +++ b/x-pack/test/functional_search/tests/solution_navigation.ts @@ -236,7 +236,7 @@ export default function searchSolutionNavigation({ await solutionNavigation.sidenav.clickLink({ deepLinkId: 'elasticsearchIndexManagement', }); - await indexManagement.expectToBeOnIndicesManagement(); + await indexManagement.expectToBeOnIndexManagement(); }); it('renders only expected items', async () => { diff --git a/x-pack/test_serverless/functional/test_suites/search/search_index_detail.ts b/x-pack/test_serverless/functional/test_suites/search/search_index_detail.ts index be78fa5889cd0..6c4f07d9f75de 100644 --- a/x-pack/test_serverless/functional/test_suites/search/search_index_detail.ts +++ b/x-pack/test_serverless/functional/test_suites/search/search_index_detail.ts @@ -118,7 +118,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { indexName ); await pageObjects.svlSearchIndexDetailPage.clickOnIndexManagementBreadcrumb(); - await pageObjects.indexManagement.expectToBeOnIndicesManagement(); + await pageObjects.indexManagement.expectToBeOnIndexManagement(); await svlSearchNavigation.navigateToIndexDetailPage(indexName); }); From 8dd3104ca0ccb2e3556165b53c880f7244cff45b Mon Sep 17 00:00:00 2001 From: saarikabhasi Date: Wed, 5 Mar 2025 12:30:48 -0500 Subject: [PATCH 36/38] create subset type of ManagementAppMountParams --- .../index_management_shared_types/src/types.ts | 13 ++++++------- .../index_management_shared_types/tsconfig.json | 1 + .../public/application/mount_management_section.ts | 4 ++-- .../shared/index_management/public/plugin.ts | 6 +++--- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/x-pack/platform/packages/shared/index-management/index_management_shared_types/src/types.ts b/x-pack/platform/packages/shared/index-management/index_management_shared_types/src/types.ts index c248077eea133..55092c4c643a6 100644 --- a/x-pack/platform/packages/shared/index-management/index_management_shared_types/src/types.ts +++ b/x-pack/platform/packages/shared/index-management/index_management_shared_types/src/types.ts @@ -14,7 +14,7 @@ import { import type { ScopedHistory } from '@kbn/core-application-browser'; import type { SerializableRecord } from '@kbn/utility-types'; import type { LocatorPublic } from '@kbn/share-plugin/public'; -import type { ChromeBreadcrumb } from '@kbn/core-chrome-browser'; +import type { ManagementAppMountParams } from '@kbn/management-plugin/public'; import { ExtensionsSetup } from './services/extensions_service'; import { PublicApiServiceSetup } from './services/public_api_service'; @@ -36,15 +36,14 @@ export type IndexManagementLocatorParams = SerializableRecord & export type IndexManagementLocator = LocatorPublic; -export interface SearchIndicesAppMountParams { - element: HTMLElement; - setBreadcrumbs: (crumbs: ChromeBreadcrumb[]) => void; - history: ScopedHistory; -} +export type IndexManagementAppMountParams = Pick< + ManagementAppMountParams, + 'element' | 'setBreadcrumbs' | 'history' +>; export interface IndexManagementPluginSetup { apiService: PublicApiServiceSetup; extensionsService: ExtensionsSetup; - indexManagementApp: (params: SearchIndicesAppMountParams) => Promise<() => void>; + indexManagementApp: (params: IndexManagementAppMountParams) => Promise<() => void>; locator?: IndexManagementLocator; } diff --git a/x-pack/platform/packages/shared/index-management/index_management_shared_types/tsconfig.json b/x-pack/platform/packages/shared/index-management/index_management_shared_types/tsconfig.json index dd09649a64f7b..b4312e417bf7c 100644 --- a/x-pack/platform/packages/shared/index-management/index_management_shared_types/tsconfig.json +++ b/x-pack/platform/packages/shared/index-management/index_management_shared_types/tsconfig.json @@ -20,5 +20,6 @@ "@kbn/utility-types", "@kbn/share-plugin", "@kbn/core-chrome-browser", + "@kbn/management-plugin" ] } diff --git a/x-pack/platform/plugins/shared/index_management/public/application/mount_management_section.ts b/x-pack/platform/plugins/shared/index_management/public/application/mount_management_section.ts index 8a0139248df0f..0f774950051f8 100644 --- a/x-pack/platform/plugins/shared/index_management/public/application/mount_management_section.ts +++ b/x-pack/platform/plugins/shared/index_management/public/application/mount_management_section.ts @@ -12,7 +12,7 @@ import { CoreSetup, CoreStart, ScopedHistory } from '@kbn/core/public'; import { ManagementAppMountParams } from '@kbn/management-plugin/public'; import { UsageCollectionSetup } from '@kbn/usage-collection-plugin/public'; import { CloudSetup } from '@kbn/cloud-plugin/public'; -import { SearchIndicesAppMountParams } from '@kbn/index-management-shared-types'; +import { IndexManagementAppMountParams } from '@kbn/index-management-shared-types'; import { UIM_APP_NAME } from '../../common/constants'; import { PLUGIN } from '../../common/constants/plugin'; import { AppDependencies } from './app_context'; @@ -130,7 +130,7 @@ export async function mountManagementSection({ }: { coreSetup: CoreSetup; usageCollection: UsageCollectionSetup; - params: ManagementAppMountParams | SearchIndicesAppMountParams; + params: IndexManagementAppMountParams; extensionsService: ExtensionsService; isFleetEnabled: boolean; kibanaVersion: SemVer; diff --git a/x-pack/platform/plugins/shared/index_management/public/plugin.ts b/x-pack/platform/plugins/shared/index_management/public/plugin.ts index 29397ce83eda0..2fb53cc0f8202 100644 --- a/x-pack/platform/plugins/shared/index_management/public/plugin.ts +++ b/x-pack/platform/plugins/shared/index_management/public/plugin.ts @@ -20,9 +20,8 @@ import { import { IndexManagementPluginSetup, IndexManagementPluginStart, - SearchIndicesAppMountParams, } from '@kbn/index-management-shared-types'; -import { IndexManagementLocator } from '@kbn/index-management-shared-types'; +import { IndexManagementLocator, IndexManagementAppMountParams } from '@kbn/index-management-shared-types'; import { Subscription } from 'rxjs'; import { setExtensionsService } from './application/store/selectors/extension_service'; import { ExtensionsService } from './services/extensions_service'; @@ -35,6 +34,7 @@ import { IndexMapping } from './application/sections/home/index_list/details_pag import { PublicApiService } from './services/public_api_service'; import { IndexSettings } from './application/sections/home/index_list/details_page/with_context_components/index_settings_embeddable'; import { IndexManagementLocatorDefinition } from './locator'; +import { ManagementAppMountParams } from '@kbn/management-plugin/public'; export class IndexMgmtUIPlugin implements @@ -145,7 +145,7 @@ export class IndexMgmtUIPlugin return { apiService: new PublicApiService(coreSetup.http), extensionsService: this.extensionsService.setup(), - indexManagementApp: async (params: SearchIndicesAppMountParams) => { + indexManagementApp: async (params: IndexManagementAppMountParams) => { const { mountManagementSection } = await import('./application/mount_management_section'); return mountManagementSection({ coreSetup, From 0c798952b0d7376db3f706ef0f22945a6eb656f7 Mon Sep 17 00:00:00 2001 From: kibanamachine <42973632+kibanamachine@users.noreply.github.com> Date: Wed, 5 Mar 2025 18:26:44 +0000 Subject: [PATCH 37/38] [CI] Auto-commit changed files from 'node scripts/notice' --- .../index-management/index_management_shared_types/tsconfig.json | 1 - 1 file changed, 1 deletion(-) diff --git a/x-pack/platform/packages/shared/index-management/index_management_shared_types/tsconfig.json b/x-pack/platform/packages/shared/index-management/index_management_shared_types/tsconfig.json index b4312e417bf7c..9fe34652edb51 100644 --- a/x-pack/platform/packages/shared/index-management/index_management_shared_types/tsconfig.json +++ b/x-pack/platform/packages/shared/index-management/index_management_shared_types/tsconfig.json @@ -19,7 +19,6 @@ "@kbn/core-application-browser", "@kbn/utility-types", "@kbn/share-plugin", - "@kbn/core-chrome-browser", "@kbn/management-plugin" ] } From 069e3811278f0cf8a44125ef7d74b0da6f594bf1 Mon Sep 17 00:00:00 2001 From: kibanamachine <42973632+kibanamachine@users.noreply.github.com> Date: Wed, 5 Mar 2025 18:52:09 +0000 Subject: [PATCH 38/38] [CI] Auto-commit changed files from 'node scripts/eslint --no-cache --fix' --- .../public/application/mount_management_section.ts | 1 - .../plugins/shared/index_management/public/plugin.ts | 6 ++++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/x-pack/platform/plugins/shared/index_management/public/application/mount_management_section.ts b/x-pack/platform/plugins/shared/index_management/public/application/mount_management_section.ts index 0f774950051f8..75b46e5e8c3a5 100644 --- a/x-pack/platform/plugins/shared/index_management/public/application/mount_management_section.ts +++ b/x-pack/platform/plugins/shared/index_management/public/application/mount_management_section.ts @@ -9,7 +9,6 @@ import '../index.scss'; import { i18n } from '@kbn/i18n'; import SemVer from 'semver/classes/semver'; import { CoreSetup, CoreStart, ScopedHistory } from '@kbn/core/public'; -import { ManagementAppMountParams } from '@kbn/management-plugin/public'; import { UsageCollectionSetup } from '@kbn/usage-collection-plugin/public'; import { CloudSetup } from '@kbn/cloud-plugin/public'; import { IndexManagementAppMountParams } from '@kbn/index-management-shared-types'; diff --git a/x-pack/platform/plugins/shared/index_management/public/plugin.ts b/x-pack/platform/plugins/shared/index_management/public/plugin.ts index 2fb53cc0f8202..4c0a990931a57 100644 --- a/x-pack/platform/plugins/shared/index_management/public/plugin.ts +++ b/x-pack/platform/plugins/shared/index_management/public/plugin.ts @@ -21,7 +21,10 @@ import { IndexManagementPluginSetup, IndexManagementPluginStart, } from '@kbn/index-management-shared-types'; -import { IndexManagementLocator, IndexManagementAppMountParams } from '@kbn/index-management-shared-types'; +import { + IndexManagementLocator, + IndexManagementAppMountParams, +} from '@kbn/index-management-shared-types'; import { Subscription } from 'rxjs'; import { setExtensionsService } from './application/store/selectors/extension_service'; import { ExtensionsService } from './services/extensions_service'; @@ -34,7 +37,6 @@ import { IndexMapping } from './application/sections/home/index_list/details_pag import { PublicApiService } from './services/public_api_service'; import { IndexSettings } from './application/sections/home/index_list/details_page/with_context_components/index_settings_embeddable'; import { IndexManagementLocatorDefinition } from './locator'; -import { ManagementAppMountParams } from '@kbn/management-plugin/public'; export class IndexMgmtUIPlugin implements