notify user that large uploads might take a while
This commit is contained in:
@@ -5,6 +5,7 @@ onmessage = function(message) {
|
||||
var docs = [];
|
||||
_.each(rows, function(row) {
|
||||
if (row.length == 0) return;
|
||||
postMessage(JSON.stringify({size: rows.length}));
|
||||
var doc = {};
|
||||
_.each(row.split(','), function(field, index) { doc['field' + index] = field });
|
||||
docs.push(doc);
|
||||
|
||||
@@ -116,12 +116,15 @@ var costco = function() {
|
||||
};
|
||||
var worker = new Worker('script/costco-csv-worker.js');
|
||||
worker.onmessage = function(message) {
|
||||
if(JSON.parse(message.data).done) {
|
||||
message = JSON.parse(message.data);
|
||||
if(message.done) {
|
||||
util.hide('dialog');
|
||||
util.notify("Data uploaded successfully!");
|
||||
recline.initializeTable(app.offset);
|
||||
} else if (message.size) {
|
||||
util.notify("Processing " + message.size + " rows. This could take a while...", {persist: true, loader: true});
|
||||
} else {
|
||||
util.notify(message.data);
|
||||
util.notify(JSON.stringify(message));
|
||||
}
|
||||
};
|
||||
worker.postMessage(payload);
|
||||
|
||||
Reference in New Issue
Block a user