Skip to content

Commit

Permalink
move menu together
Browse files Browse the repository at this point in the history
Signed-off-by: Lu Yu <[email protected]>
  • Loading branch information
BionIT committed Mar 13, 2024
1 parent c5da9b6 commit 8984299
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 17 deletions.
17 changes: 1 addition & 16 deletions public/components/map_page/map_page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,6 @@ export const MapComponent = ({ mapIdFromSavedObject, dashboardProps }: MapCompon
'globalFilterGroup__wrapper-isVisible': !!mapState.spatialMetaFilters?.length,
});

const dataSourceManagementEnabled: boolean = !!dataSourceManagement;

console.log(indexPatternIds, 'Print-----indexPatternIds-----MapComponent');

return (
Expand All @@ -138,20 +136,7 @@ export const MapComponent = ({ mapIdFromSavedObject, dashboardProps }: MapCompon
mapState={mapState}
setMapState={setMapState}
setIsUpdatingLayerRender={setIsUpdatingLayerRender}
/>
)}
{dataSourceManagementEnabled && (
// @ts-ignore
<dataSourceManagement.ui.DataSourceMenu
setMenuMountPoint={setActionMenu}
showDataSourceAggregatedView={true}
activeDatasourceIds={indexPatternIds}
savedObjects={savedObjectsClient}
notifications={notifications}
appName={'mapsPageDataSourceMenu'}
hideLocalCluster={false}
fullWidth={true}
displayAllCompatibleDataSources={true}
dataSourceManagement={dataSourceManagement}
/>
)}
{!isReadOnlyMode && !!mapState.spatialMetaFilters?.length && (
Expand Down
25 changes: 24 additions & 1 deletion public/components/map_top_nav/top_nav_menu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export const MapTopNavMenu = ({
maplibreRef,
mapState,
setMapState,
setIsUpdatingLayerRender,
setIsUpdatingLayerRender
}: MapTopNavMenuProps) => {
const { services } = useOpenSearchDashboards<MapServices>();
const {
Expand All @@ -48,6 +48,9 @@ export const MapTopNavMenu = ({
application: { navigateToApp },
embeddable,
scopedHistory,
dataSourceManagement,
savedObjects: { client: savedObjectsClient },
notifications,
} = services;

const [title, setTitle] = useState<string>('');
Expand Down Expand Up @@ -132,8 +135,11 @@ export const MapTopNavMenu = ({
});
}, [services, mapIdFromUrl, layers, title, description, mapState, originatingApp]);

const dataSourceManagementEnabled: boolean = !!dataSourceManagement;

return (
// @ts-ignore
<>
<TopNavMenu
appName={MAPS_APP_ID}
config={config}
Expand All @@ -154,5 +160,22 @@ export const MapTopNavMenu = ({
onRefresh={refreshDataLayerRender}
onRefreshChange={onRefreshChange}
/>
{dataSourceManagementEnabled && (
// @ts-ignore
<dataSourceManagement.ui.DataSourceMenu
setMenuMountPoint={setHeaderActionMenu}
showDataSourceAggregatedView={true}
activeDatasourceIds={['']}
savedObjects={savedObjectsClient}
notifications={notifications}
appName={'mapsPageDataSourceMenu'}
hideLocalCluster={false}
fullWidth={true}
displayAllCompatibleDataSources={true}
showTopNavMenuItems={true}
config={config}
/>
)}
</>
);
};

0 comments on commit 8984299

Please sign in to comment.