From ae990e2b4bf1753eac3785efdcd33e51a320c8b6 Mon Sep 17 00:00:00 2001 From: brantje Date: Mon, 26 Sep 2016 18:23:35 +0200 Subject: [PATCH] All importers return progress object --- js/importers/importer-clipperz.js | 7 ++++++- js/importers/importer-dashlanecsv.js | 8 +++++++- js/importers/importer-keepasscsv.js | 9 ++++++++- js/importers/importer-lastpasscsv.js | 7 ++++++- js/importers/importer-passmanjson.js | 7 ++++++- js/importers/importer-passpackcsv.js | 9 ++++++++- js/importers/importer-randomdata.js | 4 ++-- js/importers/importer-zohocsv.js | 9 ++++++++- 8 files changed, 51 insertions(+), 9 deletions(-) diff --git a/js/importers/importer-clipperz.js b/js/importers/importer-clipperz.js index b12ddcea..1b7666e3 100644 --- a/js/importers/importer-clipperz.js +++ b/js/importers/importer-clipperz.js @@ -45,7 +45,12 @@ PassmanImporter.clippers.readFile = function (file_data, callback) { if(_credential.label){ 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); diff --git a/js/importers/importer-dashlanecsv.js b/js/importers/importer-dashlanecsv.js index 8c5f1ca2..64611526 100644 --- a/js/importers/importer-dashlanecsv.js +++ b/js/importers/importer-dashlanecsv.js @@ -35,7 +35,13 @@ PassmanImporter.dashLaneCsv.readFile = function (file_data, callback) { if(_credential.label){ 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); }); diff --git a/js/importers/importer-keepasscsv.js b/js/importers/importer-keepasscsv.js index bd1767c0..0ecd62cd 100644 --- a/js/importers/importer-keepasscsv.js +++ b/js/importers/importer-keepasscsv.js @@ -35,7 +35,14 @@ PassmanImporter.keepassCsv.readFile = function (file_data, callback) { } _credential.tags = tags; 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); }); diff --git a/js/importers/importer-lastpasscsv.js b/js/importers/importer-lastpasscsv.js index 0f3a1c54..c13a5bd0 100644 --- a/js/importers/importer-lastpasscsv.js +++ b/js/importers/importer-lastpasscsv.js @@ -27,7 +27,12 @@ PassmanImporter.lastpassCsv.readFile = function (file_data, callback) { if(_credential.label){ 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) }); diff --git a/js/importers/importer-passmanjson.js b/js/importers/importer-passmanjson.js index 4b274b8d..b3a237a9 100644 --- a/js/importers/importer-passmanjson.js +++ b/js/importers/importer-passmanjson.js @@ -56,8 +56,13 @@ PassmanImporter.passmanJson.readFile = function (file_data, callback) { if(_credential.label){ 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); }); diff --git a/js/importers/importer-passpackcsv.js b/js/importers/importer-passpackcsv.js index f45fcb69..775ba967 100644 --- a/js/importers/importer-passpackcsv.js +++ b/js/importers/importer-passpackcsv.js @@ -38,7 +38,14 @@ PassmanImporter.passpackCsv.readFile = function (file_data, callback) { if (_credential.label) { 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); }) diff --git a/js/importers/importer-randomdata.js b/js/importers/importer-randomdata.js index 8c6aa15d..062443a7 100644 --- a/js/importers/importer-randomdata.js +++ b/js/importers/importer-randomdata.js @@ -58,12 +58,12 @@ PassmanImporter.randomData.readFile = function (file_data, callback) { } credential_list.push(_credential); if (i <= max) { - var values = { + var progress = { percent: i / max * 100, loaded: i, total: max }; - _this.call_progress(values); + _this.call_progress(progress); generateCredential(max, i + 1, callback) } else { callback(credential_list) diff --git a/js/importers/importer-zohocsv.js b/js/importers/importer-zohocsv.js index 68d513e7..bf3d5d75 100644 --- a/js/importers/importer-zohocsv.js +++ b/js/importers/importer-zohocsv.js @@ -26,7 +26,14 @@ PassmanImporter.zohoCsv.readFile = function (file_data, callback) { if(_credential.label){ 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); })