Skip to content

Commit

Permalink
[#4874] Allow to provide a custom DataProxy URL
Browse files Browse the repository at this point in the history
Adds support for providing a custom DataProxy URL via config option.
This will pave the way for deprecating it and completely removing it in
the near future. If someone really wants to use it they can host it
themselves and update the URL that Recline uses.
  • Loading branch information
amercader committed Jun 26, 2019
1 parent f6adcaa commit 211737a
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
9 changes: 8 additions & 1 deletion ckanext/reclineview/plugin.py
Expand Up @@ -21,6 +21,12 @@ def get_mapview_config():
if k.startswith(namespace)])


def get_dataproxy_url():
'''
Returns the value of the ckan.recline.dataproxy_url config option
'''
return config.get('ckan.recline.dataproxy_url', '//jsonpdataproxy.appspot.com')

def in_list(list_possible_values):
'''
Validator that checks that the input value is one of the given
Expand Down Expand Up @@ -83,7 +89,8 @@ def view_template(self, context, data_dict):

def get_helpers(self):
return {
'get_map_config': get_mapview_config
'get_map_config': get_mapview_config,
'get_dataproxy_url': get_dataproxy_url,
}


Expand Down
6 changes: 5 additions & 1 deletion ckanext/reclineview/theme/public/recline_view.js
Expand Up @@ -2,7 +2,8 @@ this.ckan.module('recline_view', function (jQuery) {
return {
options: {
site_url: "",
controlsClassName: "controls"
controlsClassName: "controls",
dataproxyUrl: "//jsonpdataproxy.appspot.com"
},

initialize: function () {
Expand Down Expand Up @@ -44,6 +45,9 @@ this.ckan.module('recline_view', function (jQuery) {

if (!resourceData.datastore_active) {
recline.Backend.DataProxy.timeout = 10000;

recline.Backend.DataProxy.dataproxy_url = this.options.dataproxyUrl;

resourceData.backend = 'dataproxy';
} else {
resourceData.backend = 'ckan';
Expand Down
1 change: 1 addition & 0 deletions ckanext/reclineview/theme/templates/recline_view.html
Expand Up @@ -8,6 +8,7 @@
data-module-resource = "{{ h.dump_json(resource_json) }}";
data-module-resource-view = "{{ h.dump_json(resource_view_json) }}";
data-module-map_config= "{{ h.dump_json(map_config) }}";
data-module-dataproxy-url= "{{ h.get_dataproxy_url() }}"
>
<h4 class="loading-dialog">
<div class="loading-spinner"></div>
Expand Down

0 comments on commit 211737a

Please sign in to comment.