Skip to content

Commit

Permalink
[Security Solution][Detection Engine] fixes preview logs issue when s…
Browse files Browse the repository at this point in the history
…witching between rules (#197098)

## Summary

 - addresses #196616
  • Loading branch information
vitaliidm authored Oct 28, 2024
1 parent 1066064 commit 6a6d1f3
Showing 1 changed file with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,8 @@ const RulePreviewComponent: React.FC<RulePreviewProps> = ({

const [isDateRangeInvalid, setIsDateRangeInvalid] = useState(false);

const isLoggedRequestsSupported = RULE_TYPES_SUPPORTING_LOGGED_REQUESTS.includes(ruleType);

useEffect(() => {
const { start, end } = refreshedTimeframe(startDate, endDate);
setTimeframeStart(start);
Expand Down Expand Up @@ -194,7 +196,7 @@ const RulePreviewComponent: React.FC<RulePreviewProps> = ({
interval: scheduleRuleData.interval,
lookback: scheduleRuleData.from,
},
enableLoggedRequests: showElasticsearchRequests,
enableLoggedRequests: showElasticsearchRequests && isLoggedRequestsSupported,
});
setIsRefreshing(true);
}, [
Expand All @@ -205,6 +207,7 @@ const RulePreviewComponent: React.FC<RulePreviewProps> = ({
startDate,
startTransaction,
showElasticsearchRequests,
isLoggedRequestsSupported,
]);

const isDirty = useMemo(
Expand Down Expand Up @@ -279,7 +282,7 @@ const RulePreviewComponent: React.FC<RulePreviewProps> = ({
</EuiFlexItem>
</EuiFlexGroup>
</EuiFormRow>
{RULE_TYPES_SUPPORTING_LOGGED_REQUESTS.includes(ruleType) ? (
{isLoggedRequestsSupported ? (
<EuiFormRow>
<EuiFlexGroup alignItems="center" gutterSize="s" responsive>
<EuiFlexItem grow>
Expand Down Expand Up @@ -312,7 +315,7 @@ const RulePreviewComponent: React.FC<RulePreviewProps> = ({
logs={logs}
hasNoiseWarning={hasNoiseWarning}
isAborted={isAborted}
showElasticsearchRequests={showElasticsearchRequests}
showElasticsearchRequests={showElasticsearchRequests && isLoggedRequestsSupported}
/>
</div>
);
Expand Down

0 comments on commit 6a6d1f3

Please sign in to comment.