[model][xs]: tweak to _backendFromString to remove option to look up backends specified as full module pathes as this is a liable to bugs and it is not being used.

This commit is contained in:
Rufus Pollock
2012-09-18 22:57:44 +01:00
parent ce668a32c7
commit d5f0b074c2
4 changed files with 8 additions and 47 deletions

View File

@@ -262,22 +262,8 @@ my.Dataset = Backbone.Model.extend({
// ### _backendFromString(backendString) // ### _backendFromString(backendString)
// //
// See backend argument to initialize for details // Look up a backend module from a backend string (look in recline.Backend)
_backendFromString: function(backendString) { _backendFromString: function(backendString) {
var parts = backendString.split('.');
// walk through the specified path xxx.yyy.zzz to get the final object which should be backend class
var current = window;
for(ii=0;ii<parts.length;ii++) {
if (!current) {
break;
}
current = current[parts[ii]];
}
if (current) {
return current;
}
// alternatively we just had a simple string
var backend = null; var backend = null;
if (recline && recline.Backend) { if (recline && recline.Backend) {
_.each(_.keys(recline.Backend), function(name) { _.each(_.keys(recline.Backend), function(name) {

16
dist/recline.js vendored
View File

@@ -1438,22 +1438,8 @@ my.Dataset = Backbone.Model.extend({
// ### _backendFromString(backendString) // ### _backendFromString(backendString)
// //
// See backend argument to initialize for details // Look up a backend module from a backend string (look in recline.Backend)
_backendFromString: function(backendString) { _backendFromString: function(backendString) {
var parts = backendString.split('.');
// walk through the specified path xxx.yyy.zzz to get the final object which should be backend class
var current = window;
for(ii=0;ii<parts.length;ii++) {
if (!current) {
break;
}
current = current[parts[ii]];
}
if (current) {
return current;
}
// alternatively we just had a simple string
var backend = null; var backend = null;
if (recline && recline.Backend) { if (recline && recline.Backend) {
_.each(_.keys(recline.Backend), function(name) { _.each(_.keys(recline.Backend), function(name) {

View File

@@ -32,7 +32,7 @@ var dataset = new recline.model.Dataset({
// information about data source e.g. // information about data source e.g.
url: http://url.to.my.data.endpoint/ url: http://url.to.my.data.endpoint/
// backend string or object // backend string or object
backend: the backend we are using - see below backend: a string identifying the backend we are using - see below
}); });
// initialize dataset with data from the backend. // initialize dataset with data from the backend.
@@ -55,7 +55,10 @@ dataset.docCount // total number of Records in the last query
fields on this Dataset (this can be set explicitly, or, will be set by fields on this Dataset (this can be set explicitly, or, will be set by
Dataset.fetch() Dataset.fetch()
* docCount: total number of records in this dataset * docCount: total number of records in this dataset
* backend: the Backend (instance) for this Dataset. * backend: the Backend (instance) for this Dataset. (NB: this is a the backend
attribute on the object itself not the backend in the Backbone attributes
i.e. the result of dataset.get('backend'). The latter is a string identifying
the backend.
* queryState: a `Query` object which stores current queryState. queryState may * queryState: a `Query` object which stores current queryState. queryState may
be edited by other components (e.g. a query editor view) changes will trigger be edited by other components (e.g. a query editor view) changes will trigger
a Dataset query. a Dataset query.

View File

@@ -262,22 +262,8 @@ my.Dataset = Backbone.Model.extend({
// ### _backendFromString(backendString) // ### _backendFromString(backendString)
// //
// See backend argument to initialize for details // Look up a backend module from a backend string (look in recline.Backend)
_backendFromString: function(backendString) { _backendFromString: function(backendString) {
var parts = backendString.split('.');
// walk through the specified path xxx.yyy.zzz to get the final object which should be backend class
var current = window;
for(ii=0;ii<parts.length;ii++) {
if (!current) {
break;
}
current = current[parts[ii]];
}
if (current) {
return current;
}
// alternatively we just had a simple string
var backend = null; var backend = null;
if (recline && recline.Backend) { if (recline && recline.Backend) {
_.each(_.keys(recline.Backend), function(name) { _.each(_.keys(recline.Backend), function(name) {