kibana/x-pack/solutions/security/plugins/security_solution/public/mocks.ts
Tim Sullivan ef907a32f2
[Security Solution] Use static declaration for navigation hierarchy (#215969)
## Summary

Part of Epic: https://github.com/elastic/kibana-team/issues/1439
Addresses https://github.com/elastic/kibana/issues/212903, but does not
remove the landing page access. The landing page access will be removed
in https://github.com/elastic/kibana/pull/210893

**Changes**
1. Converts the declaration of the Security Solution side navigation for
serverless and stateful projects into a static declaration, rather than
algorithmically parsing registered links to dynamically build the
declaration.
2. Updates the contents of the "Assets" panel to prepare for removal of
that landing page.
3. Eliminates the top-level nesting of the nav items, which removes the
extra space between the project title and the first nav items. See
45454bdc4d

**Known issue**: Clicking the "Browse integrations" button does not
close the secondary nav panel. Doing that will be a relatively simple
chore, but will require some changes in the SharedUX chrome-navigation
package, as well as the `LinkButton` component in the Security Solution
navigation-links package.

### Screenshots
Serverless

![static-nav-declaration-security-serverless-3iorteikghiskhgkseh](https://github.com/user-attachments/assets/47bcbea9-7e3c-481e-b1b8-4b13bb5d63b1)

Stateful/ECH

![static-nav-declaration-security-stateful-3iorteikghiskhgkseh](https://github.com/user-attachments/assets/3d3c8a0e-95d1-4da7-a657-c824577b6ec1)

### Checklist

Check the PR satisfies following conditions. 

Reviewers should verify this PR satisfies this list as well.

- [x] Any text added follows [EUI's writing
guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses
sentence case text and includes [i18n
support](https://github.com/elastic/kibana/blob/main/src/platform/packages/shared/kbn-i18n/README.md)
- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2025-04-03 08:38:04 -07:00

45 lines
1.6 KiB
TypeScript

/*
* 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 { BehaviorSubject, of } from 'rxjs';
import { UpsellingService } from '@kbn/security-solution-upselling/service';
import type { BreadcrumbsNav } from './common/breadcrumbs';
import type { NavigationLink } from './common/links/types';
import { allowedExperimentalValues } from '../common/experimental_features';
import type { PluginStart, PluginSetup, ContractStartServices } from './types';
import { OnboardingService } from './onboarding/service';
const upselling = new UpsellingService();
const onboardingService = new OnboardingService();
export const contractStartServicesMock: ContractStartServices = {
getComponents$: jest.fn(() => of({})),
upselling,
onboarding: onboardingService,
};
const setupMock = (): PluginSetup => ({
resolver: jest.fn(),
experimentalFeatures: allowedExperimentalValues, // default values,
setProductFeatureKeys: jest.fn(),
});
const startMock = (): PluginStart => ({
getNavLinks$: jest.fn(() => new BehaviorSubject<NavigationLink[]>([])),
setComponents: jest.fn(),
getBreadcrumbsNav$: jest.fn(
() => new BehaviorSubject<BreadcrumbsNav>({ leading: [], trailing: [] })
),
getUpselling: () => upselling,
setOnboardingSettings: onboardingService.setSettings.bind(onboardingService),
setIsSolutionNavigationEnabled: jest.fn(),
});
export const securitySolutionMock = {
createSetup: setupMock,
createStart: startMock,
};