diff --git a/x-pack/plugins/security_solution/public/detections/components/rules/rule_preview/index.tsx b/x-pack/plugins/security_solution/public/detections/components/rules/rule_preview/index.tsx index 087dadec1ea0608..dc2fe9420cbbdce 100644 --- a/x-pack/plugins/security_solution/public/detections/components/rules/rule_preview/index.tsx +++ b/x-pack/plugins/security_solution/public/detections/components/rules/rule_preview/index.tsx @@ -5,7 +5,7 @@ * 2.0. */ -import React, { useState, useEffect, useMemo } from 'react'; +import React, { useState, useEffect } from 'react'; import { Unit } from '@elastic/datemath'; import { ThreatMapping, Type } from '@kbn/securitysolution-io-ts-alerting-types'; import styled from 'styled-components'; diff --git a/x-pack/plugins/security_solution/public/detections/components/rules/rule_preview/preview_histogram.tsx b/x-pack/plugins/security_solution/public/detections/components/rules/rule_preview/preview_histogram.tsx index 60d1864e58b4c33..328b4735453ded3 100644 --- a/x-pack/plugins/security_solution/public/detections/components/rules/rule_preview/preview_histogram.tsx +++ b/x-pack/plugins/security_solution/public/detections/components/rules/rule_preview/preview_histogram.tsx @@ -116,7 +116,9 @@ export const PreviewHistogram = ({ (): string => isLoading ? i18n.QUERY_PREVIEW_SUBTITLE_LOADING - : i18n.QUERY_PREVIEW_TITLE(isThresholdRule ? thresholdTotalCount : totalCount), + : isThresholdRule + ? i18n.QUERY_PREVIEW_THRESHOLD_WITH_FIELD_TITLE(thresholdTotalCount) + : i18n.QUERY_PREVIEW_TITLE(totalCount), [isLoading, totalCount, thresholdTotalCount, isThresholdRule] ); diff --git a/x-pack/plugins/security_solution/public/detections/components/rules/rule_preview/use_preview_histogram.tsx b/x-pack/plugins/security_solution/public/detections/components/rules/rule_preview/use_preview_histogram.tsx index 9182aa0100a9912..76946f932eaf4e2 100644 --- a/x-pack/plugins/security_solution/public/detections/components/rules/rule_preview/use_preview_histogram.tsx +++ b/x-pack/plugins/security_solution/public/detections/components/rules/rule_preview/use_preview_histogram.tsx @@ -35,7 +35,7 @@ export const usePreviewHistogram = ({ const { uiSettings } = useKibana().services; const { query: queryString, filters } = query; - const [filterQuery] = convertToBuildEsQuery({ + const [filterQuery, error] = convertToBuildEsQuery({ config: getEsQueryConfig(uiSettings), indexPattern: { fields: [ @@ -63,8 +63,9 @@ export const usePreviewHistogram = ({ stackByField: threshold != null ? threshold.field[0] : 'event.category', startDate, threshold, + skip: error != null, }; - }, [startDate, endDate, filterQuery, spaceId, threshold]); + }, [startDate, endDate, filterQuery, spaceId, error, threshold]); return useMatrixHistogram(matrixHistogramRequest); };