Skip to content

Commit

Permalink
[TIP] Use experimentalKey feature instead of filtering out entry manu…
Browse files Browse the repository at this point in the history
…ally
  • Loading branch information
PhilippeOberti committed Aug 4, 2022
1 parent 5bfd9bc commit 346e397
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 16 deletions.
18 changes: 3 additions & 15 deletions x-pack/plugins/security_solution/public/common/links/app_links.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@
* 2.0.
*/
import type { CoreStart } from '@kbn/core/public';
import { links as threatIntelligenceLinks } from '../../threat_intelligence/links';
import type { ExperimentalFeatures } from '../../../common/experimental_features';
import type { AppLinkItems, LinkItem } from './types';
import type { AppLinkItems } from './types';
import { links as detectionLinks } from '../../detections/links';
import { links as timelinesLinks } from '../../timelines/links';
import { getCasesLinkItems } from '../../cases/links';
Expand All @@ -32,27 +30,17 @@ export const links = Object.freeze([

export const getFilteredLinks = async (
core: CoreStart,
plugins: StartPlugins,
experimentalFeatures: Readonly<ExperimentalFeatures>
plugins: StartPlugins
): Promise<AppLinkItems> => {
const managementFilteredLinks = await getManagementFilteredLinks(core, plugins);

const threatHuntingFilteredLinks = {
...threatHuntingLandingLinks,
links: !experimentalFeatures.threatIntelligenceEnabled
? threatHuntingLandingLinks.links?.filter(
(p: LinkItem) => p.id !== threatIntelligenceLinks.id
)
: threatHuntingLandingLinks.links,
};

return Object.freeze([
dashboardsLandingLinks,
detectionLinks,
cloudSecurityPostureRootLinks,
timelinesLinks,
casesLinks,
threatHuntingFilteredLinks,
threatHuntingLandingLinks,
gettingStartedLinks,
managementFilteredLinks,
]);
Expand Down
2 changes: 1 addition & 1 deletion x-pack/plugins/security_solution/public/plugin.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -525,7 +525,7 @@ export class Plugin implements IPlugin<PluginSetup, PluginStart, SetupPlugins, S
updateAppLinks(links, linksPermissions);

// set filtered links asynchronously
const filteredLinks = await getFilteredLinks(core, plugins, this.experimentalFeatures);
const filteredLinks = await getFilteredLinks(core, plugins);
updateAppLinks(filteredLinks, linksPermissions);
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export const links: LinkItem = {
id: SecurityPageName.threatIntelligence,
title: THREAT_INTELLIGENCE,
path: THREAT_INTELLIGENCE_PATH,
experimentalKey: 'threatIntelligenceEnabled',
landingImage: threatIntelligencePageImg,
description: i18n.translate('xpack.securitySolution.appLinks.threatIntelligence.description', {
defaultMessage:
Expand Down

0 comments on commit 346e397

Please sign in to comment.