From a242c780e1a9a134a5331b4bfae238c842c6ab67 Mon Sep 17 00:00:00 2001 From: "opensearch-trigger-bot[bot]" <98922864+opensearch-trigger-bot[bot]@users.noreply.github.com> Date: Mon, 18 Mar 2024 11:41:17 -0700 Subject: [PATCH] Implement redirection to explorer within data sources (#1548) (#1553) * history location state retrieval * populate fields as required * every single change made in datasources * remove unused method * remove console log * use enum for s3 glue * properly redirect for skipping indices * fix linting complaints * updated snapshot --------- (cherry picked from commit 2a575ed882ef474d8e4387a512fb12917f632f51) Signed-off-by: Paul Sebastian Signed-off-by: github-actions[bot] Co-authored-by: github-actions[bot] --- common/types/data_connections.ts | 2 +- .../associated_objects_tab.test.tsx.snap | 664 +++++++++++++++--- .../acceleration_details_flyout.tsx | 10 +- .../accelerations/acceleration_table.tsx | 4 +- .../utils/acceleration_utils.tsx | 21 +- .../associated_objects_details_flyout.tsx | 22 +- .../associated_objects_tab.tsx | 2 +- .../modules/associated_objects_table.tsx | 29 +- .../utils/associated_objects_tab_utils.tsx | 41 +- .../components/manage/data_connection.tsx | 51 +- .../event_analytics/explorer/explorer.tsx | 40 +- public/plugin.tsx | 18 +- 12 files changed, 752 insertions(+), 152 deletions(-) diff --git a/common/types/data_connections.ts b/common/types/data_connections.ts index 62b48bad9..9293c6004 100644 --- a/common/types/data_connections.ts +++ b/common/types/data_connections.ts @@ -38,7 +38,7 @@ export interface AssociatedObject { id: string; name: string; database: string; - type: string; + type: AccelerationIndexType | 'table'; accelerations: Acceleration[]; columns?: TableColumn[]; } diff --git a/public/components/datasources/components/__tests__/__snapshots__/associated_objects_tab.test.tsx.snap b/public/components/datasources/components/__tests__/__snapshots__/associated_objects_tab.test.tsx.snap index 392c0728a..a2f438767 100644 --- a/public/components/datasources/components/__tests__/__snapshots__/associated_objects_tab.test.tsx.snap +++ b/public/components/datasources/components/__tests__/__snapshots__/associated_objects_tab.test.tsx.snap @@ -604,7 +604,7 @@ exports[`AssociatedObjectsTab Component renders correctly with associated object "datasource": "mock_data_source", "id": "mock_acceleration_1", "name": "mock_acceleration_1", - "type": "Skipping Index", + "type": "skipping", }, Object { "accelerations": Array [], @@ -613,7 +613,7 @@ exports[`AssociatedObjectsTab Component renders correctly with associated object "datasource": "mock_data_source", "id": "mock_acceleration_2", "name": "mock_acceleration_2", - "type": "Materialized View", + "type": "materialized", }, ] } @@ -659,6 +659,7 @@ exports[`AssociatedObjectsTab Component renders correctly with associated object Object { "field": "type", "name": "Type", + "render": [Function], "sortable": true, }, Object { @@ -744,7 +745,7 @@ exports[`AssociatedObjectsTab Component renders correctly with associated object "datasource": "mock_data_source", "id": "mock_acceleration_1", "name": "mock_acceleration_1", - "type": "Skipping Index", + "type": "skipping", }, Object { "accelerations": Array [], @@ -753,7 +754,7 @@ exports[`AssociatedObjectsTab Component renders correctly with associated object "datasource": "mock_data_source", "id": "mock_acceleration_2", "name": "mock_acceleration_2", - "type": "Materialized View", + "type": "materialized", }, ] } @@ -1220,6 +1221,7 @@ exports[`AssociatedObjectsTab Component renders correctly with associated object Object { "field": "type", "name": "Type", + "render": [Function], "sortable": true, }, Object { @@ -1260,7 +1262,7 @@ exports[`AssociatedObjectsTab Component renders correctly with associated object "datasource": "mock_data_source", "id": "mock_acceleration_1", "name": "mock_acceleration_1", - "type": "Skipping Index", + "type": "skipping", }, Object { "accelerations": Array [], @@ -1269,7 +1271,7 @@ exports[`AssociatedObjectsTab Component renders correctly with associated object "datasource": "mock_data_source", "id": "mock_acceleration_2", "name": "mock_acceleration_2", - "type": "Materialized View", + "type": "materialized", }, Object { "accelerations": Array [], @@ -1959,7 +1961,7 @@ exports[`AssociatedObjectsTab Component renders correctly with associated object } } setScopeRow={false} - textOnly={true} + textOnly={false} >
- - Skipping Index - + Skipping Index
@@ -2057,7 +2055,7 @@ exports[`AssociatedObjectsTab Component renders correctly with associated object "datasource": "mock_data_source", "id": "mock_acceleration_1", "name": "mock_acceleration_1", - "type": "Skipping Index", + "type": "skipping", } } itemId={0} @@ -2083,7 +2081,7 @@ exports[`AssociatedObjectsTab Component renders correctly with associated object "datasource": "mock_data_source", "id": "mock_acceleration_1", "name": "mock_acceleration_1", - "type": "Skipping Index", + "type": "skipping", } } key="item_action_0_0" @@ -2264,7 +2262,7 @@ exports[`AssociatedObjectsTab Component renders correctly with associated object } } setScopeRow={false} - textOnly={true} + textOnly={false} >
- - Materialized View - + Materialized View
@@ -2362,7 +2356,7 @@ exports[`AssociatedObjectsTab Component renders correctly with associated object "datasource": "mock_data_source", "id": "mock_acceleration_2", "name": "mock_acceleration_2", - "type": "Materialized View", + "type": "materialized", } } itemId={1} @@ -2388,7 +2382,7 @@ exports[`AssociatedObjectsTab Component renders correctly with associated object "datasource": "mock_data_source", "id": "mock_acceleration_2", "name": "mock_acceleration_2", - "type": "Materialized View", + "type": "materialized", } } key="item_action_1_0" @@ -2569,7 +2563,7 @@ exports[`AssociatedObjectsTab Component renders correctly with associated object } } setScopeRow={false} - textOnly={true} + textOnly={false} >
- - table - + Table
@@ -2656,6 +2646,14 @@ exports[`AssociatedObjectsTab Component renders correctly with associated object "onClick": [Function], "type": "icon", }, + Object { + "available": [Function], + "description": "Accelerate this object", + "icon": "bolt", + "name": "Accelerate", + "onClick": [Function], + "type": "icon", + }, ] } className="euiTableCellContent__hoverItem" @@ -2768,6 +2766,102 @@ exports[`AssociatedObjectsTab Component renders correctly with associated object + + + + + + + + + Accelerate + + + + + @@ -2874,7 +2968,7 @@ exports[`AssociatedObjectsTab Component renders correctly with associated object } } setScopeRow={false} - textOnly={true} + textOnly={false} >
- - table - + Table
@@ -2961,6 +3051,14 @@ exports[`AssociatedObjectsTab Component renders correctly with associated object "onClick": [Function], "type": "icon", }, + Object { + "available": [Function], + "description": "Accelerate this object", + "icon": "bolt", + "name": "Accelerate", + "onClick": [Function], + "type": "icon", + }, ] } className="euiTableCellContent__hoverItem" @@ -3073,6 +3171,102 @@ exports[`AssociatedObjectsTab Component renders correctly with associated object + + + + + + + + + Accelerate + + + + + @@ -3179,7 +3373,7 @@ exports[`AssociatedObjectsTab Component renders correctly with associated object } } setScopeRow={false} - textOnly={true} + textOnly={false} >
- - table - + Table
@@ -3266,6 +3456,14 @@ exports[`AssociatedObjectsTab Component renders correctly with associated object "onClick": [Function], "type": "icon", }, + Object { + "available": [Function], + "description": "Accelerate this object", + "icon": "bolt", + "name": "Accelerate", + "onClick": [Function], + "type": "icon", + }, ] } className="euiTableCellContent__hoverItem" @@ -3378,32 +3576,128 @@ exports[`AssociatedObjectsTab Component renders correctly with associated object - - - - - - - - - + + + + + + + + + Accelerate + + + + + + + + + + + + + +
- - table - + Table
@@ -3571,6 +3861,14 @@ exports[`AssociatedObjectsTab Component renders correctly with associated object "onClick": [Function], "type": "icon", }, + Object { + "available": [Function], + "description": "Accelerate this object", + "icon": "bolt", + "name": "Accelerate", + "onClick": [Function], + "type": "icon", + }, ] } className="euiTableCellContent__hoverItem" @@ -3683,6 +3981,102 @@ exports[`AssociatedObjectsTab Component renders correctly with associated object + + + + + + + + + Accelerate + + + + + @@ -3789,7 +4183,7 @@ exports[`AssociatedObjectsTab Component renders correctly with associated object } } setScopeRow={false} - textOnly={true} + textOnly={false} >
- - table - + Table
@@ -3876,6 +4266,14 @@ exports[`AssociatedObjectsTab Component renders correctly with associated object "onClick": [Function], "type": "icon", }, + Object { + "available": [Function], + "description": "Accelerate this object", + "icon": "bolt", + "name": "Accelerate", + "onClick": [Function], + "type": "icon", + }, ] } className="euiTableCellContent__hoverItem" @@ -3988,6 +4386,102 @@ exports[`AssociatedObjectsTab Component renders correctly with associated object + + + + + + + + + Accelerate + + + + + diff --git a/public/components/datasources/components/manage/accelerations/acceleration_details_flyout.tsx b/public/components/datasources/components/manage/accelerations/acceleration_details_flyout.tsx index 796367136..108af38b9 100644 --- a/public/components/datasources/components/manage/accelerations/acceleration_details_flyout.tsx +++ b/public/components/datasources/components/manage/accelerations/acceleration_details_flyout.tsx @@ -33,6 +33,7 @@ export interface AccelerationDetailsFlyoutProps { index: string; acceleration: CachedAcceleration; dataSourceName: string; + resetFlyout: () => void; } const getMappings = (index: string): Promise | undefined => { @@ -57,7 +58,7 @@ const handleDetailsFetchingPromise = ( }; export const AccelerationDetailsFlyout = (props: AccelerationDetailsFlyoutProps) => { - const { index, dataSourceName, acceleration } = props; + const { index, dataSourceName, acceleration, resetFlyout } = props; console.log(index, acceleration, dataSourceName); const { flintIndexName } = acceleration; const [selectedTab, setSelectedTab] = useState('details'); @@ -109,7 +110,12 @@ export const AccelerationDetailsFlyout = (props: AccelerationDetailsFlyoutProps) const DiscoverButton = () => { // TODO: display button if can be sent to discover return ( - + { + onDiscoverButtonClick(acceleration, dataSourceName); + resetFlyout(); + }} + > ); diff --git a/public/components/datasources/components/manage/accelerations/acceleration_table.tsx b/public/components/datasources/components/manage/accelerations/acceleration_table.tsx index 706925604..34c46ed84 100644 --- a/public/components/datasources/components/manage/accelerations/acceleration_table.tsx +++ b/public/components/datasources/components/manage/accelerations/acceleration_table.tsx @@ -179,7 +179,9 @@ export const AccelerationTable = ({ description: 'Open in Discover', icon: 'discoverApp', type: 'icon', - onClick: onDiscoverButtonClick, + onClick: (acc: CachedAcceleration) => { + onDiscoverButtonClick(acc, dataSourceName); + }, }, { name: 'Refresh', diff --git a/public/components/datasources/components/manage/accelerations/utils/acceleration_utils.tsx b/public/components/datasources/components/manage/accelerations/utils/acceleration_utils.tsx index acc8379ee..85cc1b1da 100644 --- a/public/components/datasources/components/manage/accelerations/utils/acceleration_utils.tsx +++ b/public/components/datasources/components/manage/accelerations/utils/acceleration_utils.tsx @@ -6,6 +6,11 @@ import React from 'react'; import { EuiHealth } from '@elastic/eui'; import { CachedAcceleration } from '../../../../../../../common/types/data_connections'; +import { + redirectToExplorerOSIdx, + redirectToExplorerWithDataSrc, +} from '../../associated_objects/utils/associated_objects_tab_utils'; +import { DATA_SOURCE_TYPES } from '../../../../../../../common/constants/data_sources'; export const ACC_PANEL_TITLE = 'Accelerations'; export const ACC_PANEL_DESC = @@ -80,9 +85,19 @@ export const onRefreshButtonClick = (acceleration: any) => { console.log('refreshing', acceleration.name); }; -export const onDiscoverButtonClick = (acceleration: any) => { - // TODO: send user to Discover - console.log('sending user to discover for', acceleration.name); +export const onDiscoverButtonClick = (acceleration: CachedAcceleration, dataSourceName: string) => { + // boolean determining whether its a skipping index table or mv/ci + if (acceleration.type === undefined) return; + if (acceleration.type === 'skipping') { + redirectToExplorerWithDataSrc( + dataSourceName, + DATA_SOURCE_TYPES.S3Glue, + acceleration.database, + acceleration.table + ); + } else { + redirectToExplorerOSIdx(acceleration.flintIndexName); + } }; export const onDeleteButtonClick = (acceleration: any) => { diff --git a/public/components/datasources/components/manage/associated_objects/associated_objects_details_flyout.tsx b/public/components/datasources/components/manage/associated_objects/associated_objects_details_flyout.tsx index 7a03e4696..8b10a19c9 100644 --- a/public/components/datasources/components/manage/associated_objects/associated_objects_details_flyout.tsx +++ b/public/components/datasources/components/manage/associated_objects/associated_objects_details_flyout.tsx @@ -29,7 +29,7 @@ import { i18n } from '@osd/i18n'; import { onAccelerateButtonClick, onDeleteButtonClick, - onDiscoverButtonClick, + redirectToExplorerWithDataSrc, } from './utils/associated_objects_tab_utils'; import { getRenderAccelerationDetailsFlyout } from '../../../../../plugin'; import { AccelerationStatus } from '../accelerations/utils/acceleration_utils'; @@ -38,16 +38,32 @@ import { ACCE_NO_DATA_DESCRIPTION, CREATE_ACCELERATION_DESCRIPTION, } from '../associated_objects/utils/associated_objects_tab_utils'; +import { DATA_SOURCE_TYPES } from '../../../../../../common/constants/data_sources'; export interface AssociatedObjectsFlyoutProps { tableDetail: AssociatedObject; + resetFlyout: () => void; } -export const AssociatedObjectsDetailsFlyout = ({ tableDetail }: AssociatedObjectsFlyoutProps) => { +export const AssociatedObjectsDetailsFlyout = ({ + tableDetail, + resetFlyout, +}: AssociatedObjectsFlyoutProps) => { const DiscoverButton = () => { // TODO: display button if can be sent to discover return ( - + { + if (tableDetail.type !== 'table') return; + redirectToExplorerWithDataSrc( + tableDetail.datasource, + DATA_SOURCE_TYPES.S3Glue, + tableDetail.database, + tableDetail.name + ); + resetFlyout(); + }} + > ); diff --git a/public/components/datasources/components/manage/associated_objects/associated_objects_tab.tsx b/public/components/datasources/components/manage/associated_objects/associated_objects_tab.tsx index f39ce90f5..cb992f120 100644 --- a/public/components/datasources/components/manage/associated_objects/associated_objects_tab.tsx +++ b/public/components/datasources/components/manage/associated_objects/associated_objects_tab.tsx @@ -277,7 +277,7 @@ export const AssociatedObjectsTab: React.FC = (props) name: getAccelerationName(acceleration.indexName, acceleration, datasource.name), database: acceleration.database, type: ACCELERATION_INDEX_TYPES.find((accelType) => accelType.value === acceleration.type)! - .label, + .value, // Temporary dummy array accelerations: [], columns: undefined, diff --git a/public/components/datasources/components/manage/associated_objects/modules/associated_objects_table.tsx b/public/components/datasources/components/manage/associated_objects/modules/associated_objects_table.tsx index ba74b5134..4334a71df 100644 --- a/public/components/datasources/components/manage/associated_objects/modules/associated_objects_table.tsx +++ b/public/components/datasources/components/manage/associated_objects/modules/associated_objects_table.tsx @@ -24,8 +24,14 @@ import { ASSC_OBJ_TABLE_ACC_COLUMN_NAME, ASSC_OBJ_TABLE_SEARCH_HINT, ASSC_OBJ_TABLE_SUBJ, + redirectToExplorerOSIdx, + redirectToExplorerWithDataSrc, } from '../utils/associated_objects_tab_utils'; import { getAccelerationName } from '../../accelerations/utils/acceleration_utils'; +import { + ACCELERATION_INDEX_TYPES, + DATA_SOURCE_TYPES, +} from '../../../../../../../common/constants/data_sources'; interface AssociatedObjectsTableProps { datasourceName: string; @@ -97,6 +103,10 @@ export const AssociatedObjectsTable = (props: AssociatedObjectsTableProps) => { defaultMessage: 'Type', }), sortable: true, + render: (type) => { + if (type === 'table') return 'Table'; + return ACCELERATION_INDEX_TYPES.find((accType) => type === accType.value)!.label; + }, }, { field: 'accelerations', @@ -134,7 +144,22 @@ export const AssociatedObjectsTable = (props: AssociatedObjectsTableProps) => { ), type: 'icon', icon: 'discoverApp', - onClick: (item: AssociatedObject) => console.log('Discover', item), + onClick: (asscObj: AssociatedObject) => { + if (asscObj.type === 'covering' || asscObj.type === 'materialized') { + // find the flint index name through the cached acceleration + const acceleration = cachedAccelerations.find( + (acc) => getAccelerationName(acc.indexName, acc, datasourceName) === asscObj.name + ); + redirectToExplorerOSIdx(acceleration!.flintIndexName); + } else if (asscObj.type === 'table') { + redirectToExplorerWithDataSrc( + asscObj.datasource, + DATA_SOURCE_TYPES.S3Glue, + asscObj.database, + asscObj.name + ); + } + }, }, { name: i18n.translate('datasources.associatedObjectsTab.action.accelerate.name', { @@ -148,7 +173,7 @@ export const AssociatedObjectsTable = (props: AssociatedObjectsTableProps) => { ), type: 'icon', icon: 'bolt', - available: (item: AssociatedObject) => item.type === 'Table', + available: (item: AssociatedObject) => item.type === 'table', onClick: (item: AssociatedObject) => console.log('Accelerate', item), }, ], diff --git a/public/components/datasources/components/manage/associated_objects/utils/associated_objects_tab_utils.tsx b/public/components/datasources/components/manage/associated_objects/utils/associated_objects_tab_utils.tsx index 28942265e..3604d797a 100644 --- a/public/components/datasources/components/manage/associated_objects/utils/associated_objects_tab_utils.tsx +++ b/public/components/datasources/components/manage/associated_objects/utils/associated_objects_tab_utils.tsx @@ -3,7 +3,13 @@ * SPDX-License-Identifier: Apache-2.0 */ +import { coreRefs } from '../../../../../../framework/core_refs'; import { DirectQueryLoadingStatus } from '../../../../../../../common/types/explorer'; +import { + DEFAULT_DATA_SOURCE_NAME, + DEFAULT_DATA_SOURCE_TYPE, +} from '../../../../../../../common/constants/data_sources'; +import { observabilityLogsID } from '../../../../../../../common/constants/shared'; export const ASSC_OBJ_TABLE_SUBJ = 'associatedObjectsTable'; @@ -36,11 +42,6 @@ export const onAccelerateButtonClick = (tableDetail: any) => { console.log('accelerating', tableDetail.name); }; -export const onDiscoverButtonClick = (tabaleDetail: any) => { - // TODO: send user to Discover - console.log('sending user to discover for', tabaleDetail.name); -}; - export const onDeleteButtonClick = (tableDetail: any) => { // TODO: delete table console.log('deleting', tableDetail.name); @@ -57,3 +58,33 @@ export const isCatalogCacheFetching = (...statuses: DirectQueryLoadingStatus[]) catalogCacheFetchingStatus.includes(status) ); }; + +export const redirectToExplorerWithDataSrc = ( + datasourceName: string, + datasourceType: string, + databaseName: string, + tableName: string +) => { + const queryIndex = `${datasourceName}.${databaseName}.${tableName}`; + redirectToExplorerWithQuery(datasourceName, datasourceType, queryIndex); +}; + +export const redirectToExplorerOSIdx = (indexName: string) => { + redirectToExplorerWithQuery(DEFAULT_DATA_SOURCE_NAME, DEFAULT_DATA_SOURCE_TYPE, indexName); +}; + +const redirectToExplorerWithQuery = ( + datasourceName: string, + datasourceType: string, + queriedIndex: string +) => { + // navigate to explorer + coreRefs?.application!.navigateToApp(observabilityLogsID, { + path: `#/explorer`, + state: { + datasourceName, + datasourceType, + queryToRun: `source = ${queriedIndex} | head 10`, + }, + }); +}; diff --git a/public/components/datasources/components/manage/data_connection.tsx b/public/components/datasources/components/manage/data_connection.tsx index b3380d229..0e511d046 100644 --- a/public/components/datasources/components/manage/data_connection.tsx +++ b/public/components/datasources/components/manage/data_connection.tsx @@ -37,6 +37,7 @@ import { useLoadDatabasesToCache, useLoadTablesToCache, } from '../../../../../public/framework/catalog_cache/cache_loader'; +import { DATA_SOURCE_TYPES } from '../../../../../common/constants/data_sources'; import { coreRefs } from '../../../../framework/core_refs'; import { getRenderCreateAccelerationFlyout } from '../../../../plugin'; import { NoAccess } from '../no_access'; @@ -81,48 +82,6 @@ export const DataConnection = (props: any) => { startLoadingAccelerations, }; - // Dummy accelerations variables for mock purposes - // Actual accelerations should be retrieved from the backend - // const sampleSql = 'select * from `httplogs`.`default`.`table2` limit 10'; - const _dummyAccelerations = [ - { - flintIndexName: 'flint_mys3_default_http_logs_skipping_index', - kind: 'skipping', - database: 'default', - table: 'test', - indexName: 'skipping_index', - autoRefresh: true, - status: 'Active', - }, - { - flintIndexName: 'flint_mys3_default_test_mycv_index', - kind: 'covering', - database: 'default', - table: 'test', - indexName: 'mycv', - autoRefresh: false, - status: 'Active', - }, - { - flintIndexName: 'flint_mys3_default_mymv', - kind: ' ', - database: 'default', - table: '', - indexName: 'mymv', - autoRefresh: true, - status: 'Active', - }, - { - flintIndexName: 'flint_mys3_default_sample_mv', - kind: 'mv', - database: 'default', - table: 'sample_table', - indexName: 'sample_mv', - autoRefresh: true, - status: 'Active', - }, - ]; - const [dataSourceIntegrations, setDataSourceIntegrations] = useState( [] as IntegrationInstanceResult[] ); @@ -156,7 +115,13 @@ export const DataConnection = (props: any) => { }; const onclickDiscoverCard = () => { - application!.navigateToApp(observabilityLogsID); + application!.navigateToApp(observabilityLogsID, { + path: `#/explorer`, + state: { + datasourceName: dataSource, + datasourceType: DATA_SOURCE_TYPES.S3Glue, + }, + }); }; const DefaultDatasourceCards = () => { diff --git a/public/components/event_analytics/explorer/explorer.tsx b/public/components/event_analytics/explorer/explorer.tsx index 46d0f5930..0319f0a6d 100644 --- a/public/components/event_analytics/explorer/explorer.tsx +++ b/public/components/event_analytics/explorer/explorer.tsx @@ -32,6 +32,7 @@ import React, { useState, } from 'react'; import { batch, useDispatch, useSelector } from 'react-redux'; +import { createBrowserHistory } from 'history'; import { LogExplorerRouterContext } from '..'; import { DEFAULT_DATA_SOURCE_TYPE, @@ -98,7 +99,10 @@ import { findMinInterval } from '../../common/query_utils'; import { onItemSelect, parseGetSuggestions } from '../../common/search/autocomplete_logic'; import { Search } from '../../common/search/search'; import { processMetricsData } from '../../custom_panels/helpers/utils'; -import { selectSearchMetaData } from '../../event_analytics/redux/slices/search_meta_data_slice'; +import { + selectSearchMetaData, + update as updateSearchMetaData, +} from '../../event_analytics/redux/slices/search_meta_data_slice'; import { getVizContainerProps } from '../../visualizations/charts/helpers'; import { TabContext, useFetchEvents, useFetchPatterns, useFetchVisualizations } from '../hooks'; import { @@ -263,6 +267,40 @@ export const Explorer = ({ ); }; + const historyFromRedirection = createBrowserHistory(); + useEffect(() => { + console.log(historyFromRedirection.location.state); + if (!historyFromRedirection.location.state) return; + const { + datasourceName, + datasourceType, + queryToRun, + }: any = historyFromRedirection.location.state; + batch(() => { + dispatch( + updateSearchMetaData({ + tabId, + data: { + datasources: [ + { + label: datasourceName, + type: datasourceType, + value: datasourceName, + name: datasourceName, + }, + ], + }, + }) + ); + dispatch( + changeQuery({ + tabId, + query: { [RAW_QUERY]: queryToRun }, + }) + ); + }); + }, []); + useEffect(() => { const handleSetBrowserTabFocus = () => { if (document.hidden) setBrowserTabFocus(false); diff --git a/public/plugin.tsx b/public/plugin.tsx index b35ffc75f..eb2cc4cf7 100644 --- a/public/plugin.tsx +++ b/public/plugin.tsx @@ -410,22 +410,30 @@ export class ObservabilityPlugin index: string; acceleration: CachedAcceleration; dataSourceName: string; - }) => - core.overlays.openFlyout( + }) => { + const accelerationDetailsFlyout = core.overlays.openFlyout( toMountPoint( accelerationDetailsFlyout.close()} /> ) ); + }; setRenderAccelerationDetailsFlyout(renderAccelerationDetailsFlyout); - const renderAssociatedObjectsDetailsFlyout = (tableDetail: AssociatedObjectsFlyoutProps) => - core.overlays.openFlyout( - toMountPoint() + const renderAssociatedObjectsDetailsFlyout = (tableDetail: AssociatedObjectsFlyoutProps) => { + const associatedObjectsDetailsFlyout = core.overlays.openFlyout( + toMountPoint( + associatedObjectsDetailsFlyout.close()} + /> + ) ); + }; setRenderAssociatedObjectsDetailsFlyout(renderAssociatedObjectsDetailsFlyout); const renderCreateAccelerationFlyout = (selectedDatasource: string) => {