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

Investigate the possibility to use MapStoreExtension to extend the list of plugins available #225

Open
allyoucanmap opened this issue Jun 4, 2021 · 0 comments

Comments

@allyoucanmap
Copy link
Collaborator

It would be nice to support a mechanism to extend the available plugins to be used in the various application contexts (eg map, layer) without fork or branch the repo. There was some initial test on master to use the MapStoreExtension and we need to control if this process can support the requirement to extent the list of plugins.
If this process is working we should document it in the README file.

Initial Test

The MapStoreExtension should allow to create a custom plugins and configure them with a json file. This should be the expected structure in a geonode-project

geonode-project/
|-- ...
|-- project-name/
|    |-- ...
|    +-- templates/
|         |-- ...
|         +-- geonode-mapstore-client/
|              +-- _geonode_config.html
|    +-- static/
|         |-- ...
|         +-- mapstore/
|              +-- extensions/
|                   |-- SampleExtension/
|                   |    |-- assets/
|                   |    |-- translations/
|                   |    +-- index.js
|                   +-- index.json
|-- ...

where:

  • geonode-project/project-name/static/mapstore/extensions/SampleExtension/ contain the unzipped compiled extension (sample downloade from the release)
  • geonode-project/project-name/static/mapstore/extensions/index.json declare the extension to add in mapstore app:
{
    "SampleExtension": {
        "bundle": "/static/mapstore/extensions/SampleExtension/index.js",
        "translations": "/static/mapstore/extensions/SampleExtension/translations",
        "assets": "/static/mapstore/extensions/SampleExtension/assets"
    }
}
  • geonode-project/project-name/templates/geonode-mapstore-client/_geonode_config.html modify the plugins configuration. For example the map_embed page
{% extends 'geonode-mapstore-client/_geonode_config.html' %}
{% block override_local_config %}
<script>
    window.__GEONODE_CONFIG__.overrideLocalConfig = function(localConfig, _) {
        localConfig.plugins.map_embed.push({ name: 'SampleExtension' });
        return localConfig;
    };
</script>
{% endblock %}

Now the /map/{pk}/emebed path should show the new plugin

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant