From d72383495c77aafb4f828eabc93492790ad0afdf Mon Sep 17 00:00:00 2001 From: Lu Yu Date: Wed, 13 Mar 2024 18:11:44 +0000 Subject: [PATCH] fix set action menu function Signed-off-by: Lu Yu --- public/application.tsx | 4 ++-- public/components/app.tsx | 4 ++-- public/components/maps_list/maps_list.tsx | 8 ++++---- public/plugin.tsx | 1 + public/types.ts | 2 ++ 5 files changed, 11 insertions(+), 8 deletions(-) diff --git a/public/application.tsx b/public/application.tsx index 38991f20..9fec4afe 100644 --- a/public/application.tsx +++ b/public/application.tsx @@ -11,13 +11,13 @@ import { MapsDashboardsApp } from './components/app'; import { OpenSearchDashboardsContextProvider } from '../../../src/plugins/opensearch_dashboards_react/public'; export const renderApp = ( - { element, setHeaderActionMenu }: AppMountParameters, + { element }: AppMountParameters, services: MapServices, dataSourceManagementEnabled: boolean ) => { ReactDOM.render( - + , element ); diff --git a/public/components/app.tsx b/public/components/app.tsx index 2dc04fdf..f8d1b4a1 100644 --- a/public/components/app.tsx +++ b/public/components/app.tsx @@ -12,7 +12,7 @@ import { APP_PATH } from '../../common'; import { useOpenSearchDashboards } from '../../../../src/plugins/opensearch_dashboards_react/public'; import { MapServices } from '../types'; -export const MapsDashboardsApp = (setHeaderActionMenu: any) => { +export const MapsDashboardsApp = () => { const { services: { appBasePath }, } = useOpenSearchDashboards(); @@ -25,7 +25,7 @@ export const MapsDashboardsApp = (setHeaderActionMenu: any) => { } + render={() => } /> diff --git a/public/components/maps_list/maps_list.tsx b/public/components/maps_list/maps_list.tsx index a2a1c2c3..b4ae82f8 100644 --- a/public/components/maps_list/maps_list.tsx +++ b/public/components/maps_list/maps_list.tsx @@ -22,9 +22,8 @@ import { MapSavedObjectAttributes } from '../../../common/map_saved_object_attri import { MapServices } from '../../types'; import { getMapsLandingBreadcrumbs } from '../../utils/breadcrumbs'; import { APP_PATH, MAPS_APP_ID } from '../../../common'; -import { MountPoint } from '../../../../../src/core/public'; -export const MapsList = (setHeaderActionMenu: (menuMount: MountPoint | undefined) => void) => { +export const MapsList = () => { const { services: { notifications, @@ -32,6 +31,7 @@ export const MapsList = (setHeaderActionMenu: (menuMount: MountPoint | undefined application: { navigateToApp }, chrome: { docTitle, setBreadcrumbs }, dataSourceManagement, + setActionMenu, }, } = useOpenSearchDashboards(); @@ -116,7 +116,7 @@ export const MapsList = (setHeaderActionMenu: (menuMount: MountPoint | undefined /> ); const dataSourceManagementEnabled: boolean = !!dataSourceManagement; - console.log('test: ', setHeaderActionMenu); + console.log('test: ', setActionMenu); // Render the map list DOM. return ( @@ -126,7 +126,7 @@ export const MapsList = (setHeaderActionMenu: (menuMount: MountPoint | undefined {dataSourceManagementEnabled && ( void; } // eslint-disable-next-line @typescript-eslint/no-empty-interface