From c09dc68bfc41db67e4731b5dbe4f5afe603427ff Mon Sep 17 00:00:00 2001 From: "opensearch-trigger-bot[bot]" <98922864+opensearch-trigger-bot[bot]@users.noreply.github.com> Date: Tue, 9 Aug 2022 10:12:38 -0700 Subject: [PATCH] fix failed unit tests (#303) (#304) Signed-off-by: Jackie Han (cherry picked from commit 77c0931cb13b5f39c7548ac35e3d114f4e763629) Co-authored-by: Jackie Han <41348518+jackiehanyang@users.noreply.github.com> --- public/pages/AnomalyCharts/containers/AnomalyDetailsChart.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/public/pages/AnomalyCharts/containers/AnomalyDetailsChart.tsx b/public/pages/AnomalyCharts/containers/AnomalyDetailsChart.tsx index 687b9462..ef078d93 100644 --- a/public/pages/AnomalyCharts/containers/AnomalyDetailsChart.tsx +++ b/public/pages/AnomalyCharts/containers/AnomalyDetailsChart.tsx @@ -396,7 +396,8 @@ export const AnomalyDetailsChart = React.memo( let annotations = [] as any[]; anomalies.forEach((anomalyTimeSeries: AnomalyData[]) => { annotations.push( - anomalyTimeSeries + Array.isArray(anomalyTimeSeries) ? ( + anomalyTimeSeries .filter((anomaly: AnomalyData) => anomaly.anomalyGrade > 0) .map((anomaly: AnomalyData) => ( { @@ -406,6 +407,7 @@ export const AnomalyDetailsChart = React.memo( }, details: `${JSON.stringify(anomaly)}` })) + ) : [] ); }); return annotations;