All importers return progress object

This commit is contained in:
brantje 2016-09-26 18:23:35 +02:00
parent 0a39cdc582
commit ae990e2b4b
8 changed files with 51 additions and 9 deletions

View file

@ -45,7 +45,12 @@ PassmanImporter.clippers.readFile = function (file_data, callback) {
if(_credential.label){ if(_credential.label){
credential_list.push(_credential); credential_list.push(_credential);
} }
this.call_progress(i/json_objects.length*100); var progress = {
percent: i/json_objects.length*100,
loaded: i,
total: json_objects.length
};
this.call_progress(progress);
} }
} }
this.call_then(credential_list); this.call_then(credential_list);

View file

@ -35,7 +35,13 @@ PassmanImporter.dashLaneCsv.readFile = function (file_data, callback) {
if(_credential.label){ if(_credential.label){
credential_list.push(_credential); credential_list.push(_credential);
} }
this.call_progress(i/rows.length*100);
var progress = {
percent: i/rows.length*100,
loaded: i,
total: rows.length
};
this.call_progress(progress);
} }
this.call_then(credential_list); this.call_then(credential_list);
}); });

View file

@ -35,7 +35,14 @@ PassmanImporter.keepassCsv.readFile = function (file_data, callback) {
} }
_credential.tags = tags; _credential.tags = tags;
credential_list.push(_credential); credential_list.push(_credential);
this.call_progress(i/parsed_csv.length*100);
var progress = {
percent: i/parsed_csv.length*100,
loaded: i,
total: parsed_csv.length
};
this.call_progress(progress);
} }
this.call_then(credential_list); this.call_then(credential_list);
}); });

View file

@ -27,7 +27,12 @@ PassmanImporter.lastpassCsv.readFile = function (file_data, callback) {
if(_credential.label){ if(_credential.label){
credential_list.push(_credential); credential_list.push(_credential);
} }
this.call_progress(i/parsed_csv.length*100); var progress = {
percent: i/parsed_csv.length*100,
loaded: i,
total: parsed_csv.length
};
this.call_progress(progress);
} }
this.call_then(credential_list) this.call_then(credential_list)
}); });

View file

@ -56,8 +56,13 @@ PassmanImporter.passmanJson.readFile = function (file_data, callback) {
if(_credential.label){ if(_credential.label){
credential_list.push(_credential); credential_list.push(_credential);
} }
var progress = {
percent: i/parsed_json.length*100,
loaded: i,
total: parsed_json.length
};
this.call_progress(i/parsed_json.length*100); this.call_progress(progress);
} }
this.call_then(credential_list); this.call_then(credential_list);
}); });

View file

@ -38,7 +38,14 @@ PassmanImporter.passpackCsv.readFile = function (file_data, callback) {
if (_credential.label) { if (_credential.label) {
credential_list.push(_credential); credential_list.push(_credential);
} }
this.call_progress(i/parsed_csv.length*100);
var progress = {
percent: i/parsed_csv.length*100,
loaded: i,
total: parsed_csv.length
};
this.call_progress(progress);
} }
this.call_then(credential_list); this.call_then(credential_list);
}) })

View file

@ -58,12 +58,12 @@ PassmanImporter.randomData.readFile = function (file_data, callback) {
} }
credential_list.push(_credential); credential_list.push(_credential);
if (i <= max) { if (i <= max) {
var values = { var progress = {
percent: i / max * 100, percent: i / max * 100,
loaded: i, loaded: i,
total: max total: max
}; };
_this.call_progress(values); _this.call_progress(progress);
generateCredential(max, i + 1, callback) generateCredential(max, i + 1, callback)
} else { } else {
callback(credential_list) callback(credential_list)

View file

@ -26,7 +26,14 @@ PassmanImporter.zohoCsv.readFile = function (file_data, callback) {
if(_credential.label){ if(_credential.label){
credential_list.push(_credential); credential_list.push(_credential);
} }
this.call_progress(i/parsed_csv.length*100);
var progress = {
percent: i/parsed_csv.length*100,
loaded: i,
total: parsed_csv.length
};
this.call_progress(progress);
} }
this.call_then(credential_list); this.call_then(credential_list);
}) })