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

Add side navigation component for serverless search #156465

Merged
merged 18 commits into from
May 5, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
0493ffb
Add side navigation component for serverless search
tsullivan May 3, 2023
5da6e09
[CI] Auto-commit changed files from 'node scripts/lint_ts_projects --…
kibanamachine May 3, 2023
5b8f09d
simplify per code review
tsullivan May 3, 2023
2fef742
Merge branch 'main' into serverless/nav-component/search
tsullivan May 3, 2023
cd1cad8
rename create component function
tsullivan May 3, 2023
4199a7a
Re-introduce hardcoded activeNavItemId + comment
tsullivan May 3, 2023
90c150a
Merge branch 'serverless/nav-component/search' of github.com:tsulliva…
tsullivan May 3, 2023
12a8673
bump serverlessSearch bundle size limit
tsullivan May 3, 2023
897ffcf
re-bump the optimizer limit for serverless search plugin
tsullivan May 3, 2023
dcba408
Merge branch 'main' into serverless/nav-component/search
tsullivan May 3, 2023
1980903
Refactor shared-ux chrome nav package to work with ChromeNavigationNode
sebelga May 3, 2023
00a3b5e
Fix jest test
sebelga May 3, 2023
4945a14
[ChromeNavPackage] Refactor to work with ChromeNavigationNode #156526
tsullivan May 3, 2023
ad537f1
Merge branch 'chrome-nav/set-navigation-api' into serverless/nav-comp…
tsullivan May 3, 2023
15be9ad
api changes for navigation component refactor
tsullivan May 3, 2023
f11f607
Merge remote-tracking branch 'elastic/main' into serverless/nav-compo…
tsullivan May 4, 2023
e7bc9ba
re-bump the optimizer limit for serverless search plugin
tsullivan May 5, 2023
c309b1c
Merge branch 'main' into serverless/nav-component/search
tsullivan May 5, 2023
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
52 changes: 52 additions & 0 deletions x-pack/plugins/serverless_search/public/layout/nav.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
/*
* 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 {
Navigation,
NavigationKibanaProvider,
NavItemProps,
} from '@kbn/shared-ux-chrome-navigation';
import React from 'react';

const navItems: NavItemProps[] = [
{
name: '',
id: 'root',
items: [
{ id: 'overview', name: 'Overview', href: '/app/enterprise_search/overview' },
Copy link
Member Author

@tsullivan tsullivan May 3, 2023

Choose a reason for hiding this comment

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

NOTE: These links were copied from the serverless Search nav from an earlier POC: 89bd09c#diff-a3106909413d188596dc1162e4fc5d4f884f4fd9b3a4eca6c03666bb5d35dbb9R24-R45

{ id: 'indices', name: 'Indices', href: '/app/enterprise_search/content/search_indices' },
{ id: 'engines', name: 'Engines', href: '/app/enterprise_search/content/engines' },
{ id: 'api_keys', name: 'API keys', href: '/app/management/security/api_keys' },
{
id: 'ingest_pipelines',
name: 'Ingest pipelines',
href: '/app/management/ingest/ingest_pipelines',
},
],
},
];

export const serverlessSearchSideNavComponentProvider = (core: CoreStart) => () =>
(
<NavigationKibanaProvider core={core}>
<Navigation
solutions={[
{
id: 'search_project_nav',
items: navItems,
name: 'Search',
icon: 'logoEnterpriseSearch',
},
]}
activeNavItemId="search_project_nav.root.overview"
Copy link
Contributor

Choose a reason for hiding this comment

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

Question: is this hardcoded string needed for now? Shouldn't we leave it empty until we receive this state from the Chrome service?

Copy link
Member Author

Choose a reason for hiding this comment

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

I left code in to set the activeNavItemId to search_project_nav.root. This allows the main "Search" bucket to be pre-expanded when the page is first loaded. Also, I added a comment stating how it's a temporary set-up.

platformConfig={{}}
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: Shouldn't we set platformConfig as optional if it requires an empty object?

homeHref="/app/enterprise_search/content/setup_guide"
linkToCloud="projects"
/>
</NavigationKibanaProvider>
);
4 changes: 3 additions & 1 deletion x-pack/plugins/serverless_search/public/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
*/

import { CoreSetup, CoreStart, Plugin } from '@kbn/core/public';
import { serverlessSearchSideNavComponentProvider as componentProvider } from './layout/nav';
import {
ServerlessSearchPluginSetup,
ServerlessSearchPluginSetupDependencies,
Expand All @@ -24,9 +25,10 @@ export class ServerlessSearchPlugin
}

public start(
_core: CoreStart,
core: CoreStart,
_startDeps: ServerlessSearchPluginStartDependencies
): ServerlessSearchPluginStart {
core.chrome.project.setSideNavComponent(componentProvider(core));
return {};
}

Expand Down
3 changes: 0 additions & 3 deletions x-pack/plugins/serverless_search/public/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
* 2.0.
*/

import { ServerlessPluginSetup, ServerlessPluginStart } from '@kbn/serverless/public';
import { ManagementSetup, ManagementStart } from '@kbn/management-plugin/public';
import {
EnterpriseSearchPublicSetup,
Expand All @@ -21,11 +20,9 @@ export interface ServerlessSearchPluginStart {}
export interface ServerlessSearchPluginSetupDependencies {
enterpriseSearch: EnterpriseSearchPublicSetup;
management: ManagementSetup;
serverless: ServerlessPluginSetup;
}

export interface ServerlessSearchPluginStartDependencies {
enterpriseSearch: EnterpriseSearchPublicStart;
management: ManagementStart;
serverless: ServerlessPluginStart;
}
1 change: 1 addition & 0 deletions x-pack/plugins/serverless_search/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,6 @@
"@kbn/enterprise-search-plugin",
"@kbn/management-plugin",
"@kbn/serverless",
"@kbn/shared-ux-chrome-navigation",
]
}