[Security Solution] - Fix boolean check for threat intel summary view (#143534) (#143597)

* update boolean to show threat intel data

* pr review

(cherry picked from commit 2b11ca723e)

Co-authored-by: Michael Olorunnisola <michael.olorunnisola@elastic.co>
This commit is contained in:
Kibana Machine 2022-10-18 16:19:22 -06:00 committed by GitHub
parent 8b24cd7d87
commit d4118a4ae0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -179,6 +179,12 @@ const EventDetailsComponent: React.FC<Props> = ({
[detailsEcsData]
);
const showThreatSummary = useMemo(() => {
const hasEnrichments = enrichmentCount > 0;
const hasRiskInfoWithLicense = isLicenseValid && (hostRisk || userRisk);
return hasEnrichments || hasRiskInfoWithLicense;
}, [enrichmentCount, hostRisk, isLicenseValid, userRisk]);
const summaryTab: EventViewTab | undefined = useMemo(
() =>
isAlert
@ -237,20 +243,19 @@ const EventDetailsComponent: React.FC<Props> = ({
isReadOnly={isReadOnly}
/>
{enrichmentCount > 0 ||
(isLicenseValid && (hostRisk || userRisk) && (
<ThreatSummaryView
isDraggable={isDraggable}
hostRisk={hostRisk}
userRisk={userRisk}
browserFields={browserFields}
data={data}
eventId={id}
timelineId={timelineId}
enrichments={allEnrichments}
isReadOnly={isReadOnly}
/>
))}
{showThreatSummary && (
<ThreatSummaryView
isDraggable={isDraggable}
hostRisk={hostRisk}
userRisk={userRisk}
browserFields={browserFields}
data={data}
eventId={id}
timelineId={timelineId}
enrichments={allEnrichments}
isReadOnly={isReadOnly}
/>
)}
{isEnrichmentsLoading && (
<>
@ -268,7 +273,6 @@ const EventDetailsComponent: React.FC<Props> = ({
browserFields,
data,
detailsEcsData,
enrichmentCount,
goToTableTab,
handleOnEventClosed,
hostRisk,
@ -277,7 +281,7 @@ const EventDetailsComponent: React.FC<Props> = ({
isAlert,
isDraggable,
isEnrichmentsLoading,
isLicenseValid,
showThreatSummary,
isReadOnly,
renderer,
timelineId,