From 1edf702c54aed7a0ef6ff7d76b6667457b8784fd Mon Sep 17 00:00:00 2001 From: Sean Li Date: Mon, 18 Mar 2024 00:37:48 -0700 Subject: [PATCH] rebasing with main, updating types, and fixing refresh accelerations Signed-off-by: Sean Li --- .../accelerations/acceleration_table.tsx | 6 +-- .../accelerations_schema_tab.tsx | 2 + .../associated_objects_tab.tsx | 3 +- .../modules/associated_objects_table.tsx | 25 ++++------- public/plugin.tsx | 41 ++++++------------- public/types.ts | 17 ++++---- 6 files changed, 35 insertions(+), 59 deletions(-) diff --git a/public/components/datasources/components/manage/accelerations/acceleration_table.tsx b/public/components/datasources/components/manage/accelerations/acceleration_table.tsx index dcd1ac56d..e47157058 100644 --- a/public/components/datasources/components/manage/accelerations/acceleration_table.tsx +++ b/public/components/datasources/components/manage/accelerations/acceleration_table.tsx @@ -210,11 +210,7 @@ export const AccelerationTable = ({ { console.log(displayName); - renderAccelerationDetailsFlyout({ - index: displayName, - acceleration, - dataSourceName, - }); + renderAccelerationDetailsFlyout(displayName, acceleration, dataSourceName); }} > {displayName} diff --git a/public/components/datasources/components/manage/accelerations/flyout_modules/accelerations_schema_tab.tsx b/public/components/datasources/components/manage/accelerations/flyout_modules/accelerations_schema_tab.tsx index 9c11fd726..0199dee0a 100644 --- a/public/components/datasources/components/manage/accelerations/flyout_modules/accelerations_schema_tab.tsx +++ b/public/components/datasources/components/manage/accelerations/flyout_modules/accelerations_schema_tab.tsx @@ -12,6 +12,8 @@ interface AccelerationSchemaTabProps { } export const AccelerationSchemaTab = ({ mappings, indexInfo }: AccelerationSchemaTabProps) => { + console.log('mappings', mappings); + console.log('indexInfo', indexInfo); const indexName = indexInfo.data[0]?.index; const indexData = mappings.data[indexName]?.mappings._meta?.indexedColumns; const indexType = mappings.data[indexName]?.mappings._meta?.kind; 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 baad05349..168821c70 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 @@ -92,6 +92,7 @@ export const AssociatedObjectsTab: React.FC = (props) const onRefreshButtonClick = () => { if (!isCatalogCacheFetching(databasesLoadStatus, tablesLoadStatus, accelerationsLoadStatus)) { startLoadingDatabases(datasource.name); + startLoadingAccelerations(datasource.name); setIsRefreshing(true); } }; @@ -321,7 +322,7 @@ export const AssociatedObjectsTab: React.FC = (props) - {isObjectsLoading && !isRefreshing ? ( + {isObjectsLoading && isFirstTimeLoading ? ( ) : ( <> 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 11c64e0fd..a2b6ba11c 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 @@ -70,19 +70,15 @@ export const AssociatedObjectsTable = (props: AssociatedObjectsTableProps) => { { if (item.type === 'table') { - renderAssociatedObjectsDetailsFlyout({ - tableDetail: item, - datasourceName, - }); + renderAssociatedObjectsDetailsFlyout(item, datasourceName); } else { const acceleration = cachedAccelerations.find((acc) => acc.indexName === item.id); - console.log(acceleration); if (acceleration) { - renderAccelerationDetailsFlyout({ - index: getAccelerationName(acceleration, datasourceName), + renderAccelerationDetailsFlyout( + getAccelerationName(acceleration, datasourceName), acceleration, - dataSourceName: datasourceName, - }); + datasourceName + ); } } }} @@ -124,11 +120,7 @@ export const AssociatedObjectsTable = (props: AssociatedObjectsTableProps) => { return ( { - renderAccelerationDetailsFlyout({ - index: name, - acceleration: accelerations[0], - dataSourceName: datasourceName, - }); + renderAccelerationDetailsFlyout(name, accelerations[0], datasourceName); }} > {name} @@ -138,10 +130,7 @@ export const AssociatedObjectsTable = (props: AssociatedObjectsTableProps) => { return ( { - renderAssociatedObjectsDetailsFlyout({ - tableDetail: obj, - datasourceName, - }); + renderAssociatedObjectsDetailsFlyout(obj, datasourceName); }} size="xs" > diff --git a/public/plugin.tsx b/public/plugin.tsx index a9cb8786d..851fcdae1 100644 --- a/public/plugin.tsx +++ b/public/plugin.tsx @@ -48,7 +48,7 @@ import { observabilityTracesTitle, } from '../common/constants/shared'; import { QueryManager } from '../common/query_manager'; -import { CachedAcceleration } from '../common/types/data_connections'; +import { AssociatedObject, CachedAcceleration } from '../common/types/data_connections'; import { VISUALIZATION_SAVED_OBJECT } from '../common/types/observability_saved_object_attributes'; import { setOSDHttp, @@ -60,10 +60,7 @@ import { DirectSearch } from './components/common/search/direct_search'; import { Search } from './components/common/search/search'; import { AccelerationDetailsFlyout } from './components/datasources/components/manage/accelerations/acceleration_details_flyout'; import { CreateAcceleration } from './components/datasources/components/manage/accelerations/create_accelerations_flyout'; -import { - AssociatedObjectsDetailsFlyout, - AssociatedObjectsFlyoutProps, -} from './components/datasources/components/manage/associated_objects/associated_objects_details_flyout'; +import { AssociatedObjectsDetailsFlyout } from './components/datasources/components/manage/associated_objects/associated_objects_details_flyout'; import { convertLegacyNotebooksUrl } from './components/notebooks/components/helpers/legacy_route_helpers'; import { convertLegacyTraceAnalyticsUrl } from './components/trace_analytics/components/common/legacy_route_helpers'; import { registerAsssitantDependencies } from './dependencies/register_assistant'; @@ -104,21 +101,13 @@ export const [ getRenderAccelerationDetailsFlyout, setRenderAccelerationDetailsFlyout, ] = createGetterSetter< - ({ - index, - acceleration, - dataSourceName, - }: { - index: string; - acceleration: CachedAcceleration; - dataSourceName: string; - }) => void + (index: string, acceleration: CachedAcceleration, dataSourceName: string) => void >('renderAccelerationDetailsFlyout'); export const [ getRenderAssociatedObjectsDetailsFlyout, setRenderAssociatedObjectsDetailsFlyout, -] = createGetterSetter<({ tableDetail, datasourceName }: AssociatedObjectsFlyoutProps) => void>( +] = createGetterSetter<(tableDetail: AssociatedObject, datasourceName: string) => void>( 'renderAssociatedObjectsDetailsFlyout' ); @@ -404,15 +393,11 @@ export class ObservabilityPlugin }); // Use overlay service to render flyouts - const renderAccelerationDetailsFlyout = ({ - index, - acceleration, - dataSourceName, - }: { - index: string; - acceleration: CachedAcceleration; - dataSourceName: string; - }) => { + const renderAccelerationDetailsFlyout = ( + index: string, + acceleration: CachedAcceleration, + dataSourceName: string + ) => { const accelerationDetailsFlyout = core.overlays.openFlyout( toMountPoint( { + const renderAssociatedObjectsDetailsFlyout = ( + tableDetail: AssociatedObject, + datasourceName: string + ) => { const associatedObjectsDetailsFlyout = core.overlays.openFlyout( toMountPoint( void; - renderAssociatedObjectsDetailsFlyout: ({ - tableDetail, - }: { - tableDetail: AssociatedObject; - }) => void; + renderAccelerationDetailsFlyout: ( + index: string, + acceleration: CachedAcceleration, + datasourceName: string + ) => void; + renderAssociatedObjectsDetailsFlyout: ( + tableDetail: AssociatedObject, + datasourceName: string + ) => void; renderCreateAccelerationFlyout: (selectedDatasource: string) => void; }