Skip to content
Snippets Groups Projects
Commit 86b9482c authored by Piotr Gawron's avatar Piotr Gawron
Browse files

allow plugin to hide left panel

parent c4a4293f
No related branches found
No related tags found
1 merge request!306Resolve "Allow plugin to hide left panel"
......@@ -2,6 +2,8 @@ minerva-front (19.0.0~alpha.0) stable; urgency=medium
* Feature: support for matomo (#289)
* Feature: allow plugin to not have a panel (#306)
* Feature: allow plugin to add menu option to context menu (#307)
* Feature: allow plugin to access info about opened panel (#309)
* Feature: allow plugin to hide opened panel (#309)
-- Piotr Gawron <piotr.gawron@uni.lu> Fri, 18 Oct 2024 13:00:00 +0200
......
......@@ -3,6 +3,7 @@
#### getOpenedPanel
Return string identifying panel that is currently opened. Available options:
```
undefined
'none'
......@@ -26,3 +27,16 @@ undefined
window.minerva.map.data.getOpenedPanel();
```
#### hidePanel
Close opened panel.
##### Example of hidePanel method usage:
```javascript
//close specific panel if the panel is opened
window.minerva.map.data.hidePanel('available-plugins');
//close the panel (regardless which one is opened)
window.minerva.map.data.hidePanel('available-plugins');
```
......@@ -21,6 +21,7 @@ import { removeDataOverlay } from '@/services/pluginsManager/map/overlays/remove
import { addDataOverlay } from '@/services/pluginsManager/map/overlays/addDataOverlay';
import { getApiUrls } from '@/services/pluginsManager/project/data/getApiUrls';
import { getOpenedPanel } from '@/services/pluginsManager/interface/getOpenedPanel';
import { hidePanel } from '@/services/pluginsManager/interface/hidePanel';
type Plugin = {
pluginName: string;
......@@ -75,6 +76,7 @@ declare global {
};
interface: {
getOpenedPanel: typeof getOpenedPanel;
hidePanel: typeof hidePanel;
};
overviewImage: {
getCurrentOverviewImage: typeof getCurrentOverviewImage;
......
......@@ -6,6 +6,6 @@ window.config = {
BASE_API_URL: `${root}/minerva/api`,
BASE_NEW_API_URL: `${root}/minerva/new_api/`,
BASE_MAP_IMAGES_URL: `${root}/`,
DEFAULT_PROJECT_ID: 'sample',
DEFAULT_PROJECT_ID: 'minervar_example',
ADMIN_PANEL_URL: `${root}/minerva/admin.xhtml`,
};
import { store } from '@/redux/store';
import { openedDrawerSelector } from '@/redux/drawer/drawer.selectors';
import { DrawerName } from '@/types/drawerName';
import { closeDrawer } from '@/redux/drawer/drawer.slice';
export const hidePanel = (panelName: DrawerName | undefined): void => {
const { getState, dispatch } = store;
const drawerName = openedDrawerSelector(getState());
if (panelName === drawerName || panelName === undefined) {
dispatch(closeDrawer());
}
};
......@@ -10,6 +10,7 @@ import { ONE, ZERO } from '@/constants/common';
import { minervaDefine } from '@/services/pluginsManager/map/minervaDefine';
import { PluginsContextMenu } from '@/services/pluginsManager/pluginContextMenu/pluginsContextMenu';
import { getOpenedPanel } from '@/services/pluginsManager/interface/getOpenedPanel';
import { hidePanel } from '@/services/pluginsManager/interface/hidePanel';
import { bioEntitiesMethods } from './bioEntities';
import { getModels } from './map/models/getModels';
import { openMap } from './map/openMap';
......@@ -81,6 +82,7 @@ export const PluginsManager: PluginsManagerType = {
},
interface: {
getOpenedPanel,
hidePanel,
},
map: {
data: {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment