From 3e8a02ce0b7f6738c0300ca2f9d093e1c759fc3f Mon Sep 17 00:00:00 2001 From: Peter Fitzgibbons Date: Fri, 20 Oct 2023 10:07:56 -0700 Subject: [PATCH 1/3] Quiet react-dnd draggableId/droppableId warnings. Fix countDistribution access error when countDistribution not available. Signed-off-by: Peter Fitzgibbons --- .../event_analytics/explorer/explorer.tsx | 26 +++++++++++++++++-- .../explorer/sidebar/sidebar.tsx | 10 +++---- 2 files changed, 29 insertions(+), 7 deletions(-) diff --git a/public/components/event_analytics/explorer/explorer.tsx b/public/components/event_analytics/explorer/explorer.tsx index 0f60b71c5..a516466f3 100644 --- a/public/components/event_analytics/explorer/explorer.tsx +++ b/public/components/event_analytics/explorer/explorer.tsx @@ -496,7 +496,7 @@ export const Explorer = ({ {countDistribution?.data && !isLiveTailOnRef.current && ( <> {}} /> @@ -577,7 +577,7 @@ export const Explorer = ({ explorerFields={explorerFields} timeStampField={queryRef.current![SELECTED_TIMESTAMP]} rawQuery={appBasedRef.current || queryRef.current![RAW_QUERY]} - totalHits={_.sum(countDistribution.data['count()'])} + totalHits={_.sum(countDistribution.data?.['count()'])} requestParams={requestParams} startTime={appLogEvents ? startTime : dateRange[0]} endTime={appLogEvents ? endTime : dateRange[1]} @@ -780,6 +780,28 @@ export const Explorer = ({ } ); } else { + console.log('creating SaveAsNewVisualization', [ + { + tabId, + history, + notifications, + showPermissionErrorToast, + appLogEvents, + addVisualizationToPanel, + }, + { batch, dispatch, changeQuery, updateTabName }, + OSDSavedVisualizationClient.getInstance(), + new PanelSavedObjectClient(http), + { + ...commonParams, + type: curVisId, + applicationId: appId, + userConfigs: JSON.stringify(userVizConfigs[curVisId]), + description: userVizConfigs[curVisId]?.dataConfig?.panelOptions?.description || '', + subType, + selectedPanels: selectedCustomPanelOptions, + }, + ]); soClient = new SaveAsNewVisualization( { tabId, diff --git a/public/components/event_analytics/explorer/sidebar/sidebar.tsx b/public/components/event_analytics/explorer/sidebar/sidebar.tsx index ea4d59782..ae6a55a31 100644 --- a/public/components/event_analytics/explorer/sidebar/sidebar.tsx +++ b/public/components/event_analytics/explorer/sidebar/sidebar.tsx @@ -191,7 +191,7 @@ export const Sidebar = (props: ISidebarProps) => { data-attr-field={field.name} className="dscSidebar__item sidebar_content" index={index} - draggableId={field.name} + draggableId={`queriedField-${field.name}`} > { className="dscSidebarList explorerFieldList--selected" aria-labelledby="selected_fields" data-test-subj={`fieldList-selected`} - droppableId="" + droppableId="selectedFields-drop" spacing="m" > {explorerData && @@ -243,7 +243,7 @@ export const Sidebar = (props: ISidebarProps) => { data-attr-field={field.name} className="dscSidebar__item sidebar_content" index={index} - draggableId="" + draggableId={`selectedField-${field.name}`} > { }`} aria-labelledby="available_fields" data-test-subj={`fieldList-unpopular`} - droppableId="" + droppableId="unpopularFields-drop" spacing="m" > {storedExplorerFields?.availableFields && @@ -298,7 +298,7 @@ export const Sidebar = (props: ISidebarProps) => { data-attr-field={field.name} className="dscSidebar__item sidebar_content" index={index} - draggableId="" + draggableId={`availableField-field${field.name}`} > Date: Fri, 20 Oct 2023 11:33:24 -0700 Subject: [PATCH 2/3] Update Sidebar Test Signed-off-by: Peter Fitzgibbons --- .../__snapshots__/sidebar.test.tsx.snap | 380 +++++++++--------- 1 file changed, 190 insertions(+), 190 deletions(-) diff --git a/public/components/event_analytics/explorer/sidebar/__tests__/__snapshots__/sidebar.test.tsx.snap b/public/components/event_analytics/explorer/sidebar/__tests__/__snapshots__/sidebar.test.tsx.snap index fae58502a..afc799306 100644 --- a/public/components/event_analytics/explorer/sidebar/__tests__/__snapshots__/sidebar.test.tsx.snap +++ b/public/components/event_analytics/explorer/sidebar/__tests__/__snapshots__/sidebar.test.tsx.snap @@ -1048,21 +1048,21 @@ exports[`Siderbar component Renders sidebar component 1`] = `
Date: Fri, 20 Oct 2023 15:16:48 -0700 Subject: [PATCH 3/3] Cleanup logging Signed-off-by: Peter Fitzgibbons --- .../event_analytics/explorer/explorer.tsx | 22 ------------------- 1 file changed, 22 deletions(-) diff --git a/public/components/event_analytics/explorer/explorer.tsx b/public/components/event_analytics/explorer/explorer.tsx index a516466f3..5053c38eb 100644 --- a/public/components/event_analytics/explorer/explorer.tsx +++ b/public/components/event_analytics/explorer/explorer.tsx @@ -780,28 +780,6 @@ export const Explorer = ({ } ); } else { - console.log('creating SaveAsNewVisualization', [ - { - tabId, - history, - notifications, - showPermissionErrorToast, - appLogEvents, - addVisualizationToPanel, - }, - { batch, dispatch, changeQuery, updateTabName }, - OSDSavedVisualizationClient.getInstance(), - new PanelSavedObjectClient(http), - { - ...commonParams, - type: curVisId, - applicationId: appId, - userConfigs: JSON.stringify(userVizConfigs[curVisId]), - description: userVizConfigs[curVisId]?.dataConfig?.panelOptions?.description || '', - subType, - selectedPanels: selectedCustomPanelOptions, - }, - ]); soClient = new SaveAsNewVisualization( { tabId,