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

allow plugin to get info about opened panel

parent 41175910
No related branches found
No related tags found
1 merge request!306Resolve "Allow plugin to hide left panel"
### Interface
#### getOpenedPanel
Return string identifying panel that is currently opened. Available options:
```
undefined
'none'
'search'
'project-info'
'plugins'
'export'
'legend'
'submaps'
'reaction'
'overlays'
'bio-entity'
'comment'
'available-plugins'
'layers';
```
##### Example of getOpenedPanel method usage:
```javascript
window.minerva.map.data.getOpenedPanel();
```
...@@ -2,7 +2,6 @@ import { getBounds } from '@/services/pluginsManager/map/data/getBounds'; ...@@ -2,7 +2,6 @@ import { getBounds } from '@/services/pluginsManager/map/data/getBounds';
import { fitBounds } from '@/services/pluginsManager/map/fitBounds'; import { fitBounds } from '@/services/pluginsManager/map/fitBounds';
import { getOpenMapId } from '@/services/pluginsManager/map/getOpenMapId'; import { getOpenMapId } from '@/services/pluginsManager/map/getOpenMapId';
import { triggerSearch } from '@/services/pluginsManager/map/triggerSearch'; import { triggerSearch } from '@/services/pluginsManager/map/triggerSearch';
import { MinervaConfiguration } from '@/services/pluginsManager/pluginsManager';
import { getModels } from '@/services/pluginsManager/map/models/getModels'; import { getModels } from '@/services/pluginsManager/map/models/getModels';
import { openMap } from '@/services/pluginsManager/map/openMap'; import { openMap } from '@/services/pluginsManager/map/openMap';
import { getCenter } from '@/services/pluginsManager/map/position/getCenter'; import { getCenter } from '@/services/pluginsManager/map/position/getCenter';
...@@ -21,6 +20,7 @@ import { hideDataOverlay } from '@/services/pluginsManager/map/overlays/hideData ...@@ -21,6 +20,7 @@ import { hideDataOverlay } from '@/services/pluginsManager/map/overlays/hideData
import { removeDataOverlay } from '@/services/pluginsManager/map/overlays/removeDataOverlay'; import { removeDataOverlay } from '@/services/pluginsManager/map/overlays/removeDataOverlay';
import { addDataOverlay } from '@/services/pluginsManager/map/overlays/addDataOverlay'; import { addDataOverlay } from '@/services/pluginsManager/map/overlays/addDataOverlay';
import { getApiUrls } from '@/services/pluginsManager/project/data/getApiUrls'; import { getApiUrls } from '@/services/pluginsManager/project/data/getApiUrls';
import { getOpenedPanel } from '@/services/pluginsManager/interface/getOpenedPanel';
type Plugin = { type Plugin = {
pluginName: string; pluginName: string;
...@@ -73,6 +73,9 @@ declare global { ...@@ -73,6 +73,9 @@ declare global {
getCenter: typeof getCenter; getCenter: typeof getCenter;
setCenter: typeof setCenter; setCenter: typeof setCenter;
}; };
interface: {
getOpenedPanel: typeof getOpenedPanel;
};
overviewImage: { overviewImage: {
getCurrentOverviewImage: typeof getCurrentOverviewImage; getCurrentOverviewImage: typeof getCurrentOverviewImage;
getOverviewImages: typeof getOverviewImages; getOverviewImages: typeof getOverviewImages;
......
...@@ -147,3 +147,10 @@ export const searchDrawerOpenSelector = createSelector( ...@@ -147,3 +147,10 @@ export const searchDrawerOpenSelector = createSelector(
export const resultDrawerOpen = createSelector(drawerSelector, drawer => { export const resultDrawerOpen = createSelector(drawerSelector, drawer => {
return drawer.isOpen && RESULT_DRAWERS.includes(drawer.drawerName); return drawer.isOpen && RESULT_DRAWERS.includes(drawer.drawerName);
}); });
export const openedDrawerSelector = createSelector(drawerSelector, drawer => {
if (drawer.isOpen) {
return drawer.drawerName;
}
return undefined;
});
import { store } from '@/redux/store';
import { openedDrawerSelector } from '@/redux/drawer/drawer.selectors';
export const getOpenedPanel = (): string | undefined => {
const { getState } = store;
const drawerName = openedDrawerSelector(getState());
return drawerName;
};
...@@ -9,6 +9,7 @@ import { getPluginHashWithoutPrefix } from '@/utils/plugins/getPluginHashWithout ...@@ -9,6 +9,7 @@ import { getPluginHashWithoutPrefix } from '@/utils/plugins/getPluginHashWithout
import { ONE, ZERO } from '@/constants/common'; import { ONE, ZERO } from '@/constants/common';
import { minervaDefine } from '@/services/pluginsManager/map/minervaDefine'; import { minervaDefine } from '@/services/pluginsManager/map/minervaDefine';
import { PluginsContextMenu } from '@/services/pluginsManager/pluginContextMenu/pluginsContextMenu'; import { PluginsContextMenu } from '@/services/pluginsManager/pluginContextMenu/pluginsContextMenu';
import { getOpenedPanel } from '@/services/pluginsManager/interface/getOpenedPanel';
import { bioEntitiesMethods } from './bioEntities'; import { bioEntitiesMethods } from './bioEntities';
import { getModels } from './map/models/getModels'; import { getModels } from './map/models/getModels';
import { openMap } from './map/openMap'; import { openMap } from './map/openMap';
...@@ -78,6 +79,9 @@ export const PluginsManager: PluginsManagerType = { ...@@ -78,6 +79,9 @@ export const PluginsManager: PluginsManagerType = {
data: { data: {
bioEntities: bioEntitiesMethods, bioEntities: bioEntitiesMethods,
}, },
interface: {
getOpenedPanel,
},
map: { map: {
data: { data: {
getBounds, getBounds,
......
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