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

[Search] [Onboarding] Update Breadcrumbs and title for search detail page #196538

Merged
merged 10 commits into from
Oct 17, 2024
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) {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We decided for now to do this route until the search_navigation plugin comes in where it will handle for the differences between stack and serverless.

joemcelroy marked this conversation as resolved.
Show resolved Hide resolved
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 @@ -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);
Expand All @@ -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();
Expand All @@ -80,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