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], 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 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.