diff --git a/x-pack/plugins/security_solution/public/overview/components/overview_cti_links/index.test.tsx b/x-pack/plugins/security_solution/public/overview/components/overview_cti_links/index.test.tsx index ca3d0ddde401dd..56bd7c0c0dd0cc 100644 --- a/x-pack/plugins/security_solution/public/overview/components/overview_cti_links/index.test.tsx +++ b/x-pack/plugins/security_solution/public/overview/components/overview_cti_links/index.test.tsx @@ -20,14 +20,9 @@ import { SUB_PLUGINS_REDUCER, } from '../../../common/mock'; import { mockTheme, mockProps } from './mock'; -import { useIsThreatIntelModuleEnabled } from '../../containers/overview_cti_links/use_is_threat_intel_module_enabled'; jest.mock('../../../common/lib/kibana'); -jest.mock('../../containers/overview_cti_links/use_is_threat_intel_module_enabled'); -const useIsThreatIntelModuleEnabledMock = useIsThreatIntelModuleEnabled as jest.Mock; -useIsThreatIntelModuleEnabledMock.mockReturnValue(true); - describe('ThreatIntelLinkPanel', () => { const state: State = mockGlobalState; @@ -44,7 +39,7 @@ describe('ThreatIntelLinkPanel', () => { - + @@ -54,12 +49,11 @@ describe('ThreatIntelLinkPanel', () => { }); it('renders CtiDisabledModule when Threat Intel module is disabled', () => { - useIsThreatIntelModuleEnabledMock.mockReturnValueOnce(false); const wrapper = mount( - + @@ -69,12 +63,11 @@ describe('ThreatIntelLinkPanel', () => { }); it('renders null while Threat Intel module state is loading', () => { - useIsThreatIntelModuleEnabledMock.mockReturnValueOnce(undefined); const wrapper = mount( - + diff --git a/x-pack/plugins/security_solution/public/overview/components/overview_cti_links/index.tsx b/x-pack/plugins/security_solution/public/overview/components/overview_cti_links/index.tsx index 1ae00face7c8e0..0c50bbf145b173 100644 --- a/x-pack/plugins/security_solution/public/overview/components/overview_cti_links/index.tsx +++ b/x-pack/plugins/security_solution/public/overview/components/overview_cti_links/index.tsx @@ -8,19 +8,18 @@ import React from 'react'; import { GlobalTimeArgs } from '../../../common/containers/use_global_time'; -import { useIsThreatIntelModuleEnabled } from '../../containers/overview_cti_links/use_is_threat_intel_module_enabled'; import { CtiEnabledModule } from './cti_enabled_module'; import { CtiDisabledModule } from './cti_disabled_module'; export type ThreatIntelLinkPanelProps = Pick< GlobalTimeArgs, 'from' | 'to' | 'deleteQuery' | 'setQuery' ->; +> & { + isThreatIntelModuleEnabled: boolean | undefined; +}; const ThreatIntelLinkPanelComponent: React.FC = (props) => { - const isThreatIntelModuleEnabled = useIsThreatIntelModuleEnabled(); - - switch (isThreatIntelModuleEnabled) { + switch (props.isThreatIntelModuleEnabled) { case true: return ; case false: diff --git a/x-pack/plugins/security_solution/public/overview/pages/overview.tsx b/x-pack/plugins/security_solution/public/overview/pages/overview.tsx index 3c8612ed6cd95c..baccef68a18a53 100644 --- a/x-pack/plugins/security_solution/public/overview/pages/overview.tsx +++ b/x-pack/plugins/security_solution/public/overview/pages/overview.tsx @@ -33,6 +33,7 @@ import { Sourcerer } from '../../common/components/sourcerer'; import { SourcererScopeName } from '../../common/store/sourcerer/model'; import { useDeepEqualSelector } from '../../common/hooks/use_selector'; import { ThreatIntelLinkPanel } from '../components/overview_cti_links'; +import { useIsThreatIntelModuleEnabled } from '../containers/overview_cti_links/use_is_threat_intel_module_enabled'; const SidebarFlexItem = styled(EuiFlexItem)` margin-right: 24px; @@ -70,6 +71,7 @@ const OverviewComponent = () => { addMessage('management', 'dismissEndpointNotice'); }, [addMessage]); const { allEnabled: isIngestEnabled } = useIngestEnabledCheck(); + const isThreatIntelModuleEnabled = useIsThreatIntelModuleEnabled(); return ( <> {indicesExist ? ( @@ -143,6 +145,7 @@ const OverviewComponent = () => {