From 823add1eac4cb2e70053d6f98066fff65d6c645c Mon Sep 17 00:00:00 2001 From: Walter Rafelsberger Date: Fri, 17 May 2024 15:02:19 +0200 Subject: [PATCH 1/3] fix refresh --- x-pack/plugins/aiops/public/hooks/use_data.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x-pack/plugins/aiops/public/hooks/use_data.ts b/x-pack/plugins/aiops/public/hooks/use_data.ts index 9986a4d65dd708..26941cf2840fa4 100644 --- a/x-pack/plugins/aiops/public/hooks/use_data.ts +++ b/x-pack/plugins/aiops/public/hooks/use_data.ts @@ -117,8 +117,8 @@ export const useData = ( time: timefilter.getTime(), refreshInterval: timefilter.getRefreshInterval(), }); - setLastRefresh(Date.now()); } + setLastRefresh(Date.now()); }); // This listens just for an initial update of the timefilter to be switched on. From aac746d5356644d16b37378d09de4f5027ebd1f7 Mon Sep 17 00:00:00 2001 From: Walter Rafelsberger Date: Fri, 17 May 2024 15:03:08 +0200 Subject: [PATCH 2/3] update comments --- .../log_rate_analysis_content/log_rate_analysis_content.tsx | 1 + .../components/log_rate_analysis/log_rate_analysis_page.tsx | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/x-pack/plugins/aiops/public/components/log_rate_analysis/log_rate_analysis_content/log_rate_analysis_content.tsx b/x-pack/plugins/aiops/public/components/log_rate_analysis/log_rate_analysis_content/log_rate_analysis_content.tsx index 59373ae4b9253e..16fc210d2efc2e 100644 --- a/x-pack/plugins/aiops/public/components/log_rate_analysis/log_rate_analysis_content/log_rate_analysis_content.tsx +++ b/x-pack/plugins/aiops/public/components/log_rate_analysis/log_rate_analysis_content/log_rate_analysis_content.tsx @@ -63,6 +63,7 @@ export function getDocumentCountStatsSplitLabel( } export interface LogRateAnalysisContentProps { + /** Optional time range override */ timeRange?: { min: Moment; max: Moment }; /** Elasticsearch query to pass to analysis endpoint */ esSearchQuery?: estypes.QueryDslQueryContainer; diff --git a/x-pack/plugins/aiops/public/components/log_rate_analysis/log_rate_analysis_page.tsx b/x-pack/plugins/aiops/public/components/log_rate_analysis/log_rate_analysis_page.tsx index c8d69b54e70a6e..f6a40f2540f65e 100644 --- a/x-pack/plugins/aiops/public/components/log_rate_analysis/log_rate_analysis_page.tsx +++ b/x-pack/plugins/aiops/public/components/log_rate_analysis/log_rate_analysis_page.tsx @@ -99,7 +99,7 @@ export const LogRateAnalysisPage: FC = ({ stickyHistogram }) => { ); useEffect( - // TODO: Consolidate this hook/function with with Data visualizer's + // TODO: Consolidate this hook/function with the one in `x-pack/plugins/data_visualizer/public/application/index_data_visualizer/components/index_data_visualizer_view/index_data_visualizer_view.tsx` function clearFiltersOnLeave() { return () => { // We want to clear all filters that have not been pinned globally From 4f4e1e71dae98be2dac3c4d52c6b21b6a6121dd4 Mon Sep 17 00:00:00 2001 From: Walter Rafelsberger Date: Fri, 17 May 2024 18:09:12 +0200 Subject: [PATCH 3/3] fix brush updates --- .../src/dual_brush/dual_brush.tsx | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/x-pack/packages/ml/aiops_components/src/dual_brush/dual_brush.tsx b/x-pack/packages/ml/aiops_components/src/dual_brush/dual_brush.tsx index fe5eceb9041f9f..43d498aa98905f 100644 --- a/x-pack/packages/ml/aiops_components/src/dual_brush/dual_brush.tsx +++ b/x-pack/packages/ml/aiops_components/src/dual_brush/dual_brush.tsx @@ -233,10 +233,14 @@ export const DualBrush: FC = (props) => { ]); } - brushes.current[0].start = snappedWindowParameters.baselineMin; - brushes.current[0].end = snappedWindowParameters.baselineMax; - brushes.current[1].start = snappedWindowParameters.deviationMin; - brushes.current[1].end = snappedWindowParameters.deviationMax; + if (id === 'baseline') { + brushes.current[0].start = snappedWindowParameters.baselineMin; + brushes.current[0].end = snappedWindowParameters.baselineMax; + } + if (id === 'deviation') { + brushes.current[1].start = snappedWindowParameters.deviationMin; + brushes.current[1].end = snappedWindowParameters.deviationMax; + } if (onChange) { onChange(snappedWindowParameters, newBrushPx); @@ -263,7 +267,10 @@ export const DualBrush: FC = (props) => { return 'aiopsBrush' + b.id.charAt(0).toUpperCase() + b.id.slice(1); }) .each((brushObject: DualBrush, i, n) => { - const x = d3.scaleLinear().domain([min, max]).rangeRound([0, widthRef.current]); + const x = d3 + .scaleLinear() + .domain([minRef.current, maxRef.current]) + .rangeRound([0, widthRef.current]); // Ensure brush style is applied brushObject.brush.extent([ [0, BRUSH_MARGIN],