feat(plugins): data overlays (MIN-222)
Overlays
Get list of available data overlays
To get list of available data overlays, plugins can use the getDataOverlays
method defined in window.minerva.overlays.data
. This method returns array with all overlays.
Example of getDataOverlays usage:
window.minerva.overlays.data.getDataOverlays();
Get list of visible data overlays
To get list of visible data overlays, plugins can use the getVisibleDataOverlays
method defined in window.minerva.overlays.data
. This method returns array with all visible data overlays.
Example of getVisibleDataOverlays usage:
window.minerva.overlays.data.getVisibleDataOverlays();
Show an overlay
To show an overlay, plugins can use the showDataOverlay
method defined in window.minerva.overlays
. This method takes one argument: the ID of the overlay that the plugin wants to show.
Example of showDataOverlay usage:
window.minerva.overlays.showDataOverlay(109);
Hide an overlay
To hide an overlay, plugins can use the hideDataOverlay
method defined in window.minerva.overlays
. This method takes one argument: the ID of the overlay that the plugin wants to hide.
Example of showDataOverlay usage:
window.minerva.overlays.hideDataOverlay(109);
Add an overlay
To add an overlay, plugins can use the addDataOverlay
method defined in window.minerva.overlays
. This method takes one argument: the object with the following properties:
-
name (string): The name of the overlay.
-
description (optional string): A description of the overlay.
-
filename (optional string): The filename of the overlay data.
-
fileContent (string or text File): The content of the overlay data.
-
type (optional string): The type of overlay data.
Example of addDataOverlay usage:
window.minerva.overlays.addDataOverlay({
name: 'Plugin Test',
fileContent: 'plugin test content',
});
Remove an overlay
To remove an overlay, plugins can use the removeDataOverlay
method defined in window.minerva.overlays
. This method takes one argument: the ID of the overlay that the plugin wants to remove.
Example of removeDataOverlay usage:
window.minerva.overlays.removeDataOverlay(129);
Get Api Urls:
To get Api urls associated with the project, plugins can use the getApiUrls
method defined in window.minerva.project.data
object.
Example usage of getApiUrls method:
window.minerva.project.data.getApiUrls();
Merge request reports
Activity
assigned to @mateusz-winiarczyk
83 ); 84 85 await expect(() => addDataOverlay(overlay)).rejects.toThrow('Project id does not exist'); 86 }); 87 88 it('should throw error when overlay name is not provided', async () => { 89 getStateSpy.mockImplementation(() => MOCK_STATE as RootState); 90 91 const overlayWithoutName = { 92 ...overlay, 93 name: '', 94 }; 95 96 await expect(addDataOverlay(overlayWithoutName)).rejects.toThrow( 97 'Overlay name is not provided', 98 ); - docs/plugins/overlays.md 0 → 100644
10 window.minerva.overlays.data.getDataOverlays(); 11 ``` 12 13 #### Get list of visible data overlays 14 15 To get list of visible data overlays, plugins can use the `getVisibleDataOverlays` method defined in `window.minerva.overlays.data`. This method returns array with all visible data overlays. 16 17 ##### Example of getVisibleDataOverlays usage: 18 19 ```javascript 20 window.minerva.overlays.data.getVisibleDataOverlays(); 21 ``` 22 23 #### Show an overlay 24 25 To show an overlay, plugins can use the `showDataOverlay` method defined in `window.minerva.overlays`. This method takes one argument: the ID of the overlay that the plugin wants to show. changed this line in version 3 of the diff
1 import { emptyBackgroundIdSelector } from '@/redux/backgrounds/background.selectors'; 2 import { setMapBackground } from '@/redux/map/map.slice'; 3 import { store } from '@/redux/store'; 4 import { PluginsEventBus } from '@/services/pluginsManager/pluginsEventBus'; 5 6 export const setBackgroundtoEmptyIfAvailable = (): void => { 7 const { dispatch, getState } = store; 8 const emptyBackgroundId = emptyBackgroundIdSelector(getState()); 9 10 if (emptyBackgroundId) { 11 dispatch(setMapBackground(emptyBackgroundId)); 12 13 PluginsEventBus.dispatchEvent('onBackgroundOverlayChange', emptyBackgroundId); changed this line in version 3 of the diff
added 10 commits
-
55ec910c...b61872e4 - 9 commits from branch
development
- 079caa5f - Merge remote-tracking branch 'origin/development' into MIN-222-data-overlays
-
55ec910c...b61872e4 - 9 commits from branch
added 1 commit
- d6c72ede - feat(overlays): add possibility to set empty background by optional function argument
mentioned in commit 119c70c2