Skip to content

Commit

Permalink
[Security Solution] Preview button is disable when create a rule by a…
Browse files Browse the repository at this point in the history
…dding only a filter without adding any query (#139179) (#139226)
  • Loading branch information
e40pud authored Aug 23, 2022
1 parent 1ae09bc commit 0212338
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
* 2.0.
*/

import { isEmpty } from 'lodash';
import { Position, ScaleType } from '@elastic/charts';
import type { EuiSelectOption } from '@elastic/eui';
import type { Type, Language, ThreatMapping } from '@kbn/securitysolution-io-ts-alerting-types';
Expand Down Expand Up @@ -207,7 +208,7 @@ export const getIsRulePreviewDisabled = ({
return machineLearningJobId.length === 0;
}
if (ruleType === 'eql' || ruleType === 'query' || ruleType === 'threshold') {
return queryBar.query.query.length === 0;
return isEmpty(queryBar.query.query) && isEmpty(queryBar.filters);
}
if (ruleType === 'new_terms') {
return newTermsFields.length === 0;
Expand Down

0 comments on commit 0212338

Please sign in to comment.