Skip to content

Commit

Permalink
[ckan#2733,js][s]: data viewer working with new (v2) DataStore.
Browse files Browse the repository at this point in the history
* Upgraded to latest recline.js which has support for new CKAN datastore
* Refactor application.js setup code to use this plus new datastore_active flag
  • Loading branch information
rufuspollock committed Aug 28, 2012
1 parent 35eef77 commit 95c9752
Show file tree
Hide file tree
Showing 2 changed files with 745 additions and 414 deletions.
13 changes: 8 additions & 5 deletions ckan/public/scripts/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -1669,8 +1669,8 @@ CKAN.DataPreview = function ($, my) {
}

// 4 situations
// a) webstore_url is active (something was posted to the datastore)
// b) csv or xls (but not webstore)
// a) something was posted to the datastore - need to check for this
// b) csv or xls (but not datastore)
// c) can be treated as plain text
// d) none of the above but worth iframing (assumption is
// that if we got here (i.e. preview shown) worth doing
Expand All @@ -1688,9 +1688,12 @@ CKAN.DataPreview = function ($, my) {
}
}

if (resourceData.webstore_url) {
resourceData.url = '/api/data/' + resourceData.id;
resourceData.backend = 'elasticsearch';
// Set recline CKAN backend API endpoint to right location (so it can locate
// CKAN DataStore)
recline.Backend.Ckan.API_ENDPOINT = CKAN.SITE_URL + '/api';

if (resourceData.datastore_active) {
resourceData.backend = 'ckan';
var dataset = new recline.Model.Dataset(resourceData);
var errorMsg = CKAN.Strings.errorLoadingPreview + ': ' + CKAN.Strings.errorDataStore;
dataset.fetch()
Expand Down
Loading

0 comments on commit 95c9752

Please sign in to comment.