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

Add SearchServicesConfig plugin #109

Closed
wants to merge 1 commit into from
Closed

Add SearchServicesConfig plugin #109

wants to merge 1 commit into from

Conversation

ideonion
Copy link

@ideonion ideonion commented Apr 5, 2021

No description provided.

Copy link
Collaborator

@allyoucanmap allyoucanmap left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @ideonion ,
in the latest version of the master and stable branches the configuration used inside geonode_mapstore_client/static/geonode/js/ms2/utils/ as been removed in favor of a static json file and a template snippent configuration so these changes are not effecting the current apps structures.

The main reasons about thiese changes were to;

  • make the configuration centralized in a minumun set of files (two in this case localConfig.json and _geonode_config.html)
  • make this configation more similar to the one expected in a custom MapStore project
  • make the configuration overridable in a geonode-project

Here the reasons that brings us to remove the SearchServicesConfig from the default configuration:

53b9be1#commitcomment-48898671

Even if the SearchServicesConfig is not declared in the default configuration now is still possible to enabled it in a custom geonode project by overriding the _geonode_config.html template. This is the expected override file if you want to enabled the SearchServicesConfig in the map_edit plugins list:

{% extends 'geonode-mapstore-client/_geonode_config.html' %}
{% block override_local_config %}
<script>
    window.__GEONODE_CONFIG__.overrideLocalConfig = function(localConfig, _) {
        // list of available keys under the plugins property
        // the key should match the name of the template where the configuration is used
        // "map_embed","layer_embed","layer_view","layer_style_edit","layer_data_edit","map_view","map_edit","geostory","geostory_embed"
        localConfig.plugins.map_edit.push({ "name": "SearchServicesConfig" });

        return localConfig;
    };
</script>
{% endblock %}

here is described where this template should placed inside a geonode-project
https://github.com/GeoNode/geonode-mapstore-client#customization-via-configurationstemplates

This kind of approach allows a customization of the plugin structure directly inside the geonode-project. Please ensure to use the latest version of the master or stable 2.1.x branch to apply this override

Hope this could help with your issue, I'm waiting on your feedback before closing this PR
because the changed files in the PR are not used anymore

@ideonion
Copy link
Author

ideonion commented Apr 6, 2021

Thank you @giohappy for your kind reply. I'm going to test the customization and if I have any questions, I can ask.
Grateful

@allyoucanmap
Copy link
Collaborator

Closing this PR because the structure of configuration files changed in the master and stable branches (3.3.x/3..2.x) so the changes provided by this PR are not valid anymore. Anyway is still possible to configure the SearchServicesConfig plugin in a geonode-project as explained in this comment #109 (review)

@ideonion
Copy link
Author

Hello allyoucanmap

I have installed geonode using greonode_project 3.2.x. Created the _geonode_config.html file inside the / opt / geonode_custom / geonode-project / project_name / templates / geonode-mapstore-client directory

has been recompiled geonode:
docker-compose build --no-cache
docker-compose up -d

When you open the map viewer, the search function does NOT appear.

Some guidance to enable it.
Thanks for your attention

image

@allyoucanmap
Copy link
Collaborator

Hi @ideonion ,
The configuration provided in the previous comment was enabling the SearchServicesConfig only for the path map/{pk}/edit. This should be the configuration if you want override it also on the map/{pk}/view

{% extends 'geonode-mapstore-client/_geonode_config.html' %}
{% block override_local_config %}
<script>
    window.__GEONODE_CONFIG__.overrideLocalConfig = function(localConfig) {
        /*
        "SearchServicesConfig" has been disabled by default but still available
        inside the list of imported plugin.
        It should be enabled only in the pages that contains the "Search" plugin.
        */
        // map_edit page used for path /maps/{pk}/edit
        localConfig.plugins.map_edit.push({ "name": "SearchServicesConfig" });
        // map_view page used for path /maps/{pk}/view
        localConfig.plugins.map_view.push({ "name": "SearchServicesConfig" });

        return localConfig;
    };
</script>
{% endblock %}

We just added it also in the README for 3.3.x
https://github.com/GeoNode/geonode-mapstore-client/tree/3.3.x#customization-via-configurationstemplates

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

Successfully merging this pull request may close these issues.

2 participants