Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix set action menu #16

Merged
merged 1 commit into from
Mar 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions public/application.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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(
<OpenSearchDashboardsContextProvider services={services}>
<MapsDashboardsApp setHeaderActionMenu={setHeaderActionMenu} />
<MapsDashboardsApp />
</OpenSearchDashboardsContextProvider>,
element
);
Expand Down
4 changes: 2 additions & 2 deletions public/components/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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<MapServices>();
Expand All @@ -25,7 +25,7 @@ export const MapsDashboardsApp = (setHeaderActionMenu: any) => {
<Route
exact
path={APP_PATH.LANDING_PAGE_PATH}
render={() => <MapsList setHeaderActionMenu={setHeaderActionMenu} />}
render={() => <MapsList />}
/>
</Switch>
</I18nProvider>
Expand Down
8 changes: 4 additions & 4 deletions public/components/maps_list/maps_list.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,16 @@ 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,
savedObjects: { client: savedObjectsClient },
application: { navigateToApp },
chrome: { docTitle, setBreadcrumbs },
dataSourceManagement,
setActionMenu,
},
} = useOpenSearchDashboards<MapServices>();

Expand Down Expand Up @@ -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 (
<I18nProvider>
Expand All @@ -126,7 +126,7 @@ export const MapsList = (setHeaderActionMenu: (menuMount: MountPoint | undefined
<EuiPageContentBody>
{dataSourceManagementEnabled && (
<dataSourceManagement.ui.DataSourceMenu
setMenuMountPoint={setHeaderActionMenu}
setMenuMountPoint={setActionMenu}
showDataSourceAggregatedView={true}
savedObjects={savedObjectsClient}
notifications={notifications}
Expand Down
1 change: 1 addition & 0 deletions public/plugin.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ export class CustomImportMapPlugin
uiSettings: coreStart.uiSettings,
mapConfig,
dataSourceManagement,
setActionMenu: params.setHeaderActionMenu,
};
params.element.classList.add('mapAppContainer');
// Render the application
Expand Down
2 changes: 2 additions & 0 deletions public/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
SavedObjectsClient,
ToastsStart,
ScopedHistory,
MountPoint,
} from '../../../src/core/public';
import { NavigationPublicPluginStart } from '../../../src/plugins/navigation/public';
import { DataPublicPluginSetup, DataPublicPluginStart } from '../../../src/plugins/data/public';
Expand Down Expand Up @@ -43,6 +44,7 @@ export interface MapServices extends CoreStart {
uiSettings: CoreStart['uiSettings'];
mapConfig: ConfigSchema;
dataSourceManagement: DataSourceManagementPluginSetup;
setActionMenu: (menuMount: MountPoint | undefined) => void;
}

// eslint-disable-next-line @typescript-eslint/no-empty-interface
Expand Down
Loading