From 47a8664888bd740e4b5b46ef97988cb7f2b357c9 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Wed, 25 Oct 2023 23:37:52 +0000 Subject: [PATCH] Bug fixes for observability count distribution and application analytics (#1187) * remove unused files Signed-off-by: Eric Wei * missing snapshots Signed-off-by: Eric Wei * remove unused files Signed-off-by: Eric Wei * fix for count distribution disappear on page refresh Signed-off-by: Eric * fix query composing issue in app analytics Signed-off-by: Eric * add one fix for count distribution and update snapshots Signed-off-by: Eric --------- Signed-off-by: Eric Wei Signed-off-by: Eric (cherry picked from commit 0b238a0314d97e2c46ba535be0c2d022b61618b5) Signed-off-by: github-actions[bot] --- public/components/common/query_utils/index.ts | 5 ++++- .../event_analytics/explorer/explorer.tsx | 17 +++++++++++++++-- .../count_distribution/count_distribution.tsx | 1 - .../redux/slices/count_distribution_slice.ts | 1 + 4 files changed, 20 insertions(+), 4 deletions(-) diff --git a/public/components/common/query_utils/index.ts b/public/components/common/query_utils/index.ts index bed3432dbb..9f4024bb31 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 d311cdcc1b..1f4806b3c0 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 6fa6778819..8e5f10f315 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 59aa1e03f2..b960c5064b 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, }; },