Skip to content

Commit

Permalink
ids missing
Browse files Browse the repository at this point in the history
  • Loading branch information
semd committed Oct 18, 2023
1 parent 1e2fd5f commit 8b88fb8
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import { SolutionSideNavPanelContent } from '@kbn/security-solution-side-nav/pan
import useObservable from 'react-use/lib/useObservable';
import { useKibana } from '../common/services';
import type { ProjectNavigationLink, ProjectPageName } from './links/types';
// import { processCloudLinks } from './links/nav_links';
import { useFormattedSideNavItems } from './side_navigation/use_side_nav_items';
import { CATEGORIES, FOOTER_CATEGORIES } from './categories';
import { formatNavigationTree } from './navigation_tree/navigation_tree';
Expand All @@ -23,12 +22,10 @@ const getPanelContentProvider = (
projectNavLinks: ProjectNavigationLink[]
): React.FC<PanelComponentProps> =>
React.memo(function PanelContentProvider({ selectedNode: { path }, closePanel }) {
// const { cloud } = useKibana().services;
const linkId = path[path.length - 1] as ProjectPageName;
const currentPanelItem = projectNavLinks.find((item) => item.id === linkId);

const { title = '', links = [], categories } = currentPanelItem ?? {};
// const panelLinks = processCloudLinks(links, cloud);
const items = useFormattedSideNavItems(links);

if (items.length === 0) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ describe('formatNavigationTree', () => {

expect(securityNode?.children).toEqual([
{
id: link1.id,
link: chromeNavLink1.id,
title: link1.title,
},
Expand All @@ -75,6 +76,7 @@ describe('formatNavigationTree', () => {
breadcrumbStatus: 'hidden',
children: [
{
id: link1.id,
link: chromeNavLink1.id,
title: link1.title,
},
Expand All @@ -97,10 +99,12 @@ describe('formatNavigationTree', () => {
breadcrumbStatus: 'hidden',
children: [
{
id: link1.id,
link: chromeNavLink1.id,
title: link1.title,
},
{
id: link2.id,
link: chromeNavLink2.id,
title: link2.title,
},
Expand All @@ -125,6 +129,7 @@ describe('formatNavigationTree', () => {
breadcrumbStatus: 'hidden',
children: [
{
id: link1.id,
link: chromeNavLink1.id,
title: link1.title,
},
Expand All @@ -149,6 +154,7 @@ describe('formatNavigationTree', () => {
breadcrumbStatus: 'hidden',
children: [
{
id: link1.id,
link: chromeNavLink1.id,
title: link1.title,
},
Expand All @@ -163,6 +169,7 @@ describe('formatNavigationTree', () => {

expect(securityNode?.children).toEqual([
{
id: link3.id,
link: chromeNavLink3.id,
title: link3.title,
},
Expand All @@ -179,13 +186,15 @@ describe('formatNavigationTree', () => {

expect(securityNode?.children).toEqual([
{
id: link1.id,
link: chromeNavLink1.id,
title: link1.title,
children: [
{
id: link2.id,
link: chromeNavLink2.id,
title: link2.title,
children: [{ link: chromeNavLink3.id, title: link3.title }],
children: [{ id: link3.id, link: chromeNavLink3.id, title: link3.title }],
renderAs: 'panelOpener',
},
],
Expand All @@ -208,11 +217,13 @@ describe('formatNavigationTree', () => {

expect(securityNode?.children).toEqual([
{
id: SecurityPageName.usersEvents,
link: chromeNavLinkTest.id,
title: link1.title,
breadcrumbStatus: 'hidden',
},
{
id: link2.id,
link: chromeNavLink2.id,
title: link2.title,
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ const createNodeFromProjectNavLink = (projectNavLink: ProjectNavigationLink): No
const { id, title, links, categories, disabled } = projectNavLink;
const link = getNavLinkIdFromProjectPageName(id);
const node: NodeDefinition = {
id,
link: link as AppDeepLinkId,
title,
...(isBreadcrumbHidden(id) && { breadcrumbStatus: 'hidden' }),
Expand Down Expand Up @@ -171,6 +172,7 @@ const formatFooterNodesFromLinks = (
...(isCloudLink(projectNavLink.id)
? {
cloudLink: getCloudLink(projectNavLink.id),
openInNewTab: true,
}
: {
link: getNavLinkIdFromProjectPageName(projectNavLink.id) as AppDeepLinkId,
Expand Down

0 comments on commit 8b88fb8

Please sign in to comment.