From a116b1ba3e2fed25bd15085c7d54376f49d8bf0f Mon Sep 17 00:00:00 2001 From: Joseph McElroy Date: Tue, 15 Oct 2024 14:00:15 +0100 Subject: [PATCH 1/6] added serverless breadcrumbs --- x-pack/plugins/search_indices/kibana.jsonc | 1 + .../components/indices/details_page.tsx | 29 ++++++++++++++++++- x-pack/plugins/search_indices/public/types.ts | 2 ++ 3 files changed, 31 insertions(+), 1 deletion(-) diff --git a/x-pack/plugins/search_indices/kibana.jsonc b/x-pack/plugins/search_indices/kibana.jsonc index 13abaf63cbbe3..dee69b2b4e109 100644 --- a/x-pack/plugins/search_indices/kibana.jsonc +++ b/x-pack/plugins/search_indices/kibana.jsonc @@ -18,6 +18,7 @@ "cloud", "console", "usageCollection", + "serverless" ], "requiredBundles": [ "kibanaReact", diff --git a/x-pack/plugins/search_indices/public/components/indices/details_page.tsx b/x-pack/plugins/search_indices/public/components/indices/details_page.tsx index 8cc673d073101..35bcf61979f9d 100644 --- a/x-pack/plugins/search_indices/public/components/indices/details_page.tsx +++ b/x-pack/plugins/search_indices/public/components/indices/details_page.tsx @@ -41,7 +41,15 @@ export const SearchIndexDetailsPage = () => { const indexName = decodeURIComponent(useParams<{ indexName: string }>().indexName); const tabId = decodeURIComponent(useParams<{ tabId: string }>().tabId); - const { console: consolePlugin, docLinks, application, history, share } = useKibana().services; + const { + console: consolePlugin, + docLinks, + application, + history, + share, + chrome, + serverless, + } = useKibana().services; const { data: index, refetch, @@ -71,6 +79,25 @@ export const SearchIndexDetailsPage = () => { setDocumentsLoading(isInitialLoading); setDocumentsExists(!(!isInitialLoading && indexDocuments?.results?.data.length === 0)); }, [indexDocuments, isInitialLoading, setDocumentsExists, setDocumentsLoading]); + + useEffect(() => { + chrome.docTitle.change(indexName); + + if (serverless) { + serverless.setBreadcrumbs([ + { + text: i18n.translate('xpack.searchIndices.indexBreadcrumbLabel', { + defaultMessage: 'Index Management', + }), + href: '#/management/elasticsearch/index_management', + }, + { + text: indexName, + }, + ]); + } + }, [chrome, indexName, serverless]); + const usageTracker = useUsageTracker(); const detailsPageTabs: EuiTabbedContentTab[] = useMemo(() => { diff --git a/x-pack/plugins/search_indices/public/types.ts b/x-pack/plugins/search_indices/public/types.ts index 0030b222f6bc1..51c05687f9dc6 100644 --- a/x-pack/plugins/search_indices/public/types.ts +++ b/x-pack/plugins/search_indices/public/types.ts @@ -17,6 +17,7 @@ import type { } from '@elastic/elasticsearch/lib/api/typesWithBodyKey'; import type { IndexManagementPluginStart } from '@kbn/index-management-shared-types'; import type { AppDeepLinkId } from '@kbn/core-chrome-browser'; +import { ServerlessPluginStart } from '@kbn/serverless/public'; export interface SearchIndicesPluginSetup { enabled: boolean; @@ -50,6 +51,7 @@ export type SearchIndicesServicesContext = CoreStart & SearchIndicesAppPluginStartDependencies & { history: AppMountParameters['history']; indexManagement: IndexManagementPluginStart; + serverless: ServerlessPluginStart; }; export interface AppUsageTracker { From 48958a23c21bacef59765da410762e05b88522c2 Mon Sep 17 00:00:00 2001 From: Joseph McElroy Date: Wed, 16 Oct 2024 11:52:51 +0100 Subject: [PATCH 2/6] add breadcrumbs to index details --- .../public/components/indices/details_page.tsx | 2 +- .../page_objects/svl_search_index_detail_page.ts | 15 +++++++++++++++ .../test_suites/search/search_index_detail.ts | 9 +++++++++ 3 files changed, 25 insertions(+), 1 deletion(-) diff --git a/x-pack/plugins/search_indices/public/components/indices/details_page.tsx b/x-pack/plugins/search_indices/public/components/indices/details_page.tsx index 31f5f71fcc54a..ff62233e52e70 100644 --- a/x-pack/plugins/search_indices/public/components/indices/details_page.tsx +++ b/x-pack/plugins/search_indices/public/components/indices/details_page.tsx @@ -88,7 +88,7 @@ export const SearchIndexDetailsPage = () => { text: i18n.translate('xpack.searchIndices.indexBreadcrumbLabel', { defaultMessage: 'Index Management', }), - href: '#/management/elasticsearch/index_management', + href: '/app/management/data/index_management/indices', }, { text: indexName, diff --git a/x-pack/test_serverless/functional/page_objects/svl_search_index_detail_page.ts b/x-pack/test_serverless/functional/page_objects/svl_search_index_detail_page.ts index ed11a09c26b66..df14d39118de7 100644 --- a/x-pack/test_serverless/functional/page_objects/svl_search_index_detail_page.ts +++ b/x-pack/test_serverless/functional/page_objects/svl_search_index_detail_page.ts @@ -197,5 +197,20 @@ export function SvlSearchIndexDetailPageProvider({ getService }: FtrProviderCont await testSubjects.existOrFail('mappingsTab'); await testSubjects.existOrFail('settingsTab'); }, + + async expectBreadcrumbNavigationWithIndexName(indexName: string) { + await testSubjects.existOrFail('euiBreadcrumb'); + expect(await testSubjects.getVisibleText('breadcrumb last')).to.contain(indexName); + }, + + async clickOnIndexManagementBreadcrumb() { + const breadcrumbs = await testSubjects.findAll('breadcrumb'); + for (const breadcrumb of breadcrumbs) { + if ((await breadcrumb.getVisibleText()) === 'Index Management') { + await breadcrumb.click(); + return; + } + } + }, }; } 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 aea757f7edea1..048754c97923c 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 @@ -71,6 +71,15 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { await pageObjects.svlSearchIndexDetailPage.expectQuickStatsAIMappingsToHaveVectorFields(); }); + it('should have breadcrumb navigation', async () => { + await pageObjects.svlSearchIndexDetailPage.expectBreadcrumbNavigationWithIndexName( + indexName + ); + await pageObjects.svlSearchIndexDetailPage.clickOnIndexManagementBreadcrumb(); + await pageObjects.indexManagement.sectionHeadingText('Indices'); + await svlSearchNavigation.navigateToIndexDetailPage(indexName); + }); + it('should show code examples for adding documents', async () => { await pageObjects.svlSearchIndexDetailPage.expectAddDocumentCodeExamples(); await pageObjects.svlSearchIndexDetailPage.expectSelectedLanguage('python'); From 82e0ec3bb34d5d49b06036ec63e166dc210d160c Mon Sep 17 00:00:00 2001 From: kibanamachine <42973632+kibanamachine@users.noreply.github.com> Date: Wed, 16 Oct 2024 12:02:59 +0000 Subject: [PATCH 3/6] [CI] Auto-commit changed files from 'node scripts/lint_ts_projects --fix' --- x-pack/plugins/search_indices/tsconfig.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/x-pack/plugins/search_indices/tsconfig.json b/x-pack/plugins/search_indices/tsconfig.json index dfd73633b3c3b..61b82f4485492 100644 --- a/x-pack/plugins/search_indices/tsconfig.json +++ b/x-pack/plugins/search_indices/tsconfig.json @@ -38,7 +38,8 @@ "@kbn/search-api-keys-components", "@kbn/search-shared-ui", "@kbn/deeplinks-search", - "@kbn/core-chrome-browser" + "@kbn/core-chrome-browser", + "@kbn/serverless" ], "exclude": [ "target/**/*", From eb2e85b1a9c2d30415e95ddf56326281e2527f0f Mon Sep 17 00:00:00 2001 From: Joseph McElroy Date: Wed, 16 Oct 2024 20:59:54 +0100 Subject: [PATCH 4/6] fix test --- .../functional/test_suites/search/search_index_detail.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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 048754c97923c..b231cc8ee9549 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 @@ -76,7 +76,8 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { indexName ); await pageObjects.svlSearchIndexDetailPage.clickOnIndexManagementBreadcrumb(); - await pageObjects.indexManagement.sectionHeadingText('Indices'); + const headingText = await pageObjects.indexManagement.sectionHeadingText(); + expect(headingText).to.be('Index Management'); await svlSearchNavigation.navigateToIndexDetailPage(indexName); }); From b40238f8fb960d922a8b61eb8c05f5cf42f392d3 Mon Sep 17 00:00:00 2001 From: Joseph McElroy Date: Thu, 17 Oct 2024 09:16:37 +0100 Subject: [PATCH 5/6] update ftr --- .../test/functional/page_objects/index_management_page.ts | 6 ++++++ .../functional/test_suites/search/search_index_detail.ts | 3 +-- 2 files changed, 7 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 8077581bbbb48..848c7c9e5b0e3 100644 --- a/x-pack/test/functional/page_objects/index_management_page.ts +++ b/x-pack/test/functional/page_objects/index_management_page.ts @@ -16,6 +16,12 @@ export function IndexManagementPageProvider({ getService }: FtrProviderContext) async sectionHeadingText() { return await testSubjects.getVisibleText('appTitle'); }, + + async expectToBeOnIndicesManagement() { + const headingText = await testSubjects.getVisibleText('appTitle'); + expect(headingText).to.be('Index Management'); + }, + async reloadIndices() { await testSubjects.click('reloadIndicesButton'); }, 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 209b9681a351b..cbdf99ab99e58 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 @@ -85,8 +85,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { indexName ); await pageObjects.svlSearchIndexDetailPage.clickOnIndexManagementBreadcrumb(); - const headingText = await pageObjects.indexManagement.sectionHeadingText(); - expect(headingText).to.be('Index Management'); + await pageObjects.indexManagement.expectToBeOnIndicesManagement(); await svlSearchNavigation.navigateToIndexDetailPage(indexName); }); From 48dd9089b79f81bc3fe7f2fe0eb443213af09e47 Mon Sep 17 00:00:00 2001 From: Joseph McElroy Date: Thu, 17 Oct 2024 09:25:45 +0100 Subject: [PATCH 6/6] update test --- .../functional/test_suites/search/search_index_detail.ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) 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 cbdf99ab99e58..63f524edef035 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 @@ -33,8 +33,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { await esDeleteAllIndices(indexName); }); - // FLAKY: https://github.com/elastic/kibana/issues/194704 - describe.skip('index details page overview', () => { + describe('index details page overview', () => { before(async () => { await es.indices.create({ index: indexName }); await svlSearchNavigation.navigateToIndexDetailPage(indexName); @@ -54,7 +53,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { await pageObjects.svlSearchIndexDetailPage.expectConnectionDetails(); }); - it('should show api key', async () => { + it.skip('should show api key', async () => { await pageObjects.svlApiKeys.deleteAPIKeys(); await svlSearchNavigation.navigateToIndexDetailPage(indexName); await pageObjects.svlApiKeys.expectAPIKeyAvailable();