[app][s]: split CSV and Excel as options in importer and use this info to explicitly set format for dataproxy.

* Previously could not import CSV files if did not end in .csv.
This commit is contained in:
Rufus Pollock
2012-05-07 03:53:30 +01:00
parent f1ed1cd593
commit 2291f06948
2 changed files with 13 additions and 9 deletions

View File

@@ -128,14 +128,17 @@ var ExplorerApp = Backbone.View.extend({
$('.modal.js-import-dialog-url').modal('hide');
var $form = $(e.target);
var source = $form.find('input[name="source"]').val();
var datasetInfo = {
id: 'my-dataset',
url: source,
webstore_url: source
};
var type = $form.find('select[name="backend_type"]').val();
var dataset = new recline.Model.Dataset({
id: 'my-dataset',
url: source,
webstore_url: source
},
type
);
if (type === 'csv' || type === 'excel') {
datasetInfo.format = type;
type = 'dataproxy';
}
var dataset = new recline.Model.Dataset(datasetInfo, type);
this.createExplorer(dataset);
},