making notifications when bulk uploading csvs make a little more sense

This commit is contained in:
Max Ogden
2011-08-01 22:04:19 -04:00
parent f72b9c31db
commit 9b76faf60f
4 changed files with 10 additions and 12 deletions

View File

@@ -105,13 +105,11 @@ var costco = function() {
}
function uploadCSV() {
util.notify('Upload started.');
var file = $('#file')[0].files[0];
if (file) {
var reader = new FileReader();
reader.readAsText(file);
reader.onload = function(event) {
util.notify('File loaded.');
var payload = {
url: window.location.href + "/api/_bulk_docs", // todo more robust url composition
data: event.target.result
@@ -119,9 +117,9 @@ var costco = function() {
var worker = new Worker('script/costco-csv-worker.js');
worker.onmessage = function(message) {
if(JSON.parse(message.data).done) {
util.hide('dialog');
util.notify("Data uploaded successfully!");
recline.initializeTable(app.offset);
util.hide('dialog');
} else {
util.notify(message.data);
}