diff --git a/public/components/common/query_utils/index.ts b/public/components/common/query_utils/index.ts index bed3432db..9f4024bb3 100644 --- a/public/components/common/query_utils/index.ts +++ b/public/components/common/query_utils/index.ts @@ -245,7 +245,10 @@ export const buildPatternsQuery = ( return finalQuery; }; -export const buildQuery = (baseQuery: string, currQuery: string) => baseQuery + '| ' + currQuery; +export const buildQuery = (baseQuery: string, currQuery: string) => { + if (!currQuery) return baseQuery; + return `${baseQuery} | ${currQuery}`; +}; export const buildRawQuery = (query: IQuery, appBaseQuery: string) => { if (appBaseQuery && !query.rawQuery.includes(appBaseQuery)) diff --git a/public/components/event_analytics/explorer/explorer.tsx b/public/components/event_analytics/explorer/explorer.tsx index d311cdcc1..1f4806b3c 100644 --- a/public/components/event_analytics/explorer/explorer.tsx +++ b/public/components/event_analytics/explorer/explorer.tsx @@ -258,6 +258,12 @@ export const Explorer = ({ ...TIME_INTERVAL_OPTIONS, ]); selectedIntervalRef.current = { text: 'Auto', value: 'auto_' + minInterval }; + dispatch( + updateCountDistribution({ + tabId, + data: { selectedInterval: selectedIntervalRef.current.value.replace(/^auto_/, '') }, + }) + ); }; useEffect(() => { @@ -495,13 +501,18 @@ export const Explorer = ({ selectedIntervalRef.current = timeIntervalOptions[intervalOptionsIndex]; getPatterns(intrv, getErrorHandler('Error fetching patterns')); }} - stateInterval={selectedIntervalRef.current?.value} + stateInterval={ + countDistribution.selectedInterval || selectedIntervalRef.current?.value + } startTime={appLogEvents ? startTime : dateRange[0]} endTime={appLogEvents ? endTime : dateRange[1]} /> + @@ -783,6 +794,8 @@ export const Explorer = ({ subType, selectedCustomPanelOptions, explorerSearchMeta, + selectedIntervalRef.current, + countDistribution, ]); const liveTailLoop = async ( diff --git a/public/components/event_analytics/explorer/visualizations/count_distribution/count_distribution.tsx b/public/components/event_analytics/explorer/visualizations/count_distribution/count_distribution.tsx index 6fa677881..8e5f10f31 100644 --- a/public/components/event_analytics/explorer/visualizations/count_distribution/count_distribution.tsx +++ b/public/components/event_analytics/explorer/visualizations/count_distribution/count_distribution.tsx @@ -4,7 +4,6 @@ */ import React from 'react'; -import { EuiPanel } from '@elastic/eui'; import { BarOrientation, LONG_CHART_COLOR } from '../../../../../../common/constants/shared'; import { Plt } from '../../../../visualizations/plotly/plot'; import { fillTimeDataWithEmpty } from '../../../utils/utils'; diff --git a/public/components/event_analytics/redux/slices/count_distribution_slice.ts b/public/components/event_analytics/redux/slices/count_distribution_slice.ts index 59aa1e03f..b960c5064 100644 --- a/public/components/event_analytics/redux/slices/count_distribution_slice.ts +++ b/public/components/event_analytics/redux/slices/count_distribution_slice.ts @@ -17,6 +17,7 @@ export const countDistributionSlice = createSlice({ reducers: { render: (state, { payload }) => { state[payload.tabId] = { + ...state[payload.tabId], ...payload.data, }; },