Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[8.x] [Search] [Onboarding] Update Breadcrumbs and title for search detail page (#196538) #196701

Merged
merged 1 commit into from
Oct 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions x-pack/plugins/search_indices/kibana.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
"cloud",
"console",
"usageCollection",
"serverless"
],
"requiredBundles": [
"kibanaReact",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,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,
Expand Down Expand Up @@ -70,6 +78,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: '/app/management/data/index_management/indices',
},
{
text: indexName,
},
]);
}
}, [chrome, indexName, serverless]);

const usageTracker = useUsageTracker();

const detailsPageTabs: EuiTabbedContentTab[] = useMemo(() => {
Expand Down
2 changes: 2 additions & 0 deletions x-pack/plugins/search_indices/public/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -50,6 +51,7 @@ export type SearchIndicesServicesContext = CoreStart &
SearchIndicesAppPluginStartDependencies & {
history: AppMountParameters['history'];
indexManagement: IndexManagementPluginStart;
serverless: ServerlessPluginStart;
};

export interface AppUsageTracker {
Expand Down
3 changes: 2 additions & 1 deletion x-pack/plugins/search_indices/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -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/**/*",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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');
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
},
};
}
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,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.expectToBeOnIndicesManagement();
await svlSearchNavigation.navigateToIndexDetailPage(indexName);
});

it('should show code examples for adding documents', async () => {
await pageObjects.svlSearchIndexDetailPage.expectAddDocumentCodeExamples();
await pageObjects.svlSearchIndexDetailPage.expectSelectedLanguage('python');
Expand Down