Skip to content

Commit 92bb765

Browse files
Merge branch 'fixing-api-calls' into 'master'
Fixing api calls See merge request datopian/clients/nhs-dataexplorer!28
2 parents 702ab5d + 16222c3 commit 92bb765

File tree

3 files changed

+9
-7
lines changed

3 files changed

+9
-7
lines changed

ckanext/dataexplorer/public/resource-view-filters-override.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,6 @@ this.ckan.module('resource-view-filters-override', function (jQuery) {
9595
}
9696

9797
function _appendDropdowns(dropdowns, resourceId, template, fields, filters) {
98-
9998
$.each(fields, function (i, field) {
10099
if (filters.hasOwnProperty(field)) {
101100
dropdowns.append(_buildDropdown(self.el, template, field));
@@ -144,7 +143,8 @@ this.ckan.module('resource-view-filters-override', function (jQuery) {
144143
fields: filterName,
145144
distinct: true,
146145
sort: filterName,
147-
include_total: false
146+
include_total: false,
147+
api_call_type: 'browser-data-explorer-filter',
148148
};
149149

150150
if (term !== '') {

ckanext/dataexplorer/public/vendor/ckan.js/ckan.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,8 @@ if (isNodeModule) {
154154
q: queryObj.q,
155155
filters: {},
156156
limit: queryObj.size || 10,
157-
offset: queryObj.from || 0
157+
offset: queryObj.from || 0,
158+
api_call_type: 'browser-data-explorer'
158159
};
159160

160161
if (queryObj.sort && queryObj.sort.length > 0) {
@@ -250,6 +251,7 @@ recline.Backend.Ckan = recline.Backend.Ckan || {};
250251
wrapper = new CKAN.Client(out.endpoint);
251252
}
252253
queryObj.resource_id = dataset.bq_table_name //dataset.id;
254+
queryObj.resource_details = dataset
253255
wrapper.datastoreQuery(queryObj, function(err, out) {
254256
if (err) {
255257
dfd.reject(err);

ckanext/dataexplorer/public/vendor/recline/recline.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -441,7 +441,7 @@ this.recline.Model = this.recline.Model || {};
441441
this.recordCount = null;
442442
this.queryState = new my.Query();
443443
this.queryState.bind("change facet:add", function () {
444-
self.query(); // We want to call query() without any arguments.
444+
// self.query(); // We want to call query() without any arguments.
445445
});
446446
// store is what we query and save against
447447
// store will either be the backend or be a memory store if Backend fetch
@@ -4826,11 +4826,11 @@ this.recline.View = this.recline.View || {};
48264826

48274827
var model_fields = self.model.fields;
48284828
var sql_query = this.jsQueryToSQL(query, model_fields);
4829-
this.extractFile(self, sql_query, format);
4829+
this.extractFile(self, sql_query, format, query);
48304830
},
4831-
extractFile: function (self, sql_query, format) {
4831+
extractFile: function (self, sql_query, format, query={}) {
48324832
var base_path = self.model.attributes.endpoint || self.options.site_url;
4833-
var endpoint = `${base_path}/3/action/datastore_search_sql?sql=${escape(sql_query)}`; // USE BASE_PATH IN PRODUCTION
4833+
var endpoint = `${base_path}/3/action/datastore_search_sql?sql=${escape(sql_query)}&resource_id=${query.resource_id}`; // USE BASE_PATH IN PRODUCTION
48344834
self.progress();
48354835

48364836
fetch(endpoint)

0 commit comments

Comments
 (0)