From d682df48061723c578b040c7da1d56ffceded376 Mon Sep 17 00:00:00 2001 From: Marcos Zuriaga Date: Fri, 30 Sep 2016 21:26:55 +0200 Subject: [PATCH] Progressbar on share action for cypher TODO: add a progressbar of the upload and the actual upload --- js/app/controllers/share.js | 27 +++++++++++++++++-- js/templates.js | 2 +- .../forms/share_credential/basics.html | 6 +++++ 3 files changed, 32 insertions(+), 3 deletions(-) diff --git a/js/app/controllers/share.js b/js/app/controllers/share.js index 5439bd74..20d429e6 100644 --- a/js/app/controllers/share.js +++ b/js/app/controllers/share.js @@ -62,7 +62,24 @@ angular.module('passmanApp') $scope.share_settings = { - credentialSharedWithUserAndGroup:[] + credentialSharedWithUserAndGroup:[ + { + accessLevel:1, + displayName:"wolf", + userId:"wolf", + type:'user' + }, + { + accessLevel:1, + displayName:"cat", + userId:"cat", + type:'user' + } + ], + cypher_progress:{ + done:0, + total:0 + } }; $scope.accessLevels = [ @@ -100,6 +117,9 @@ angular.module('passmanApp') }; $scope.applyShare = function(){ + $scope.share_settings.cypher_progress.done = 0; + $scope.share_settings.cypher_progress.total = 0; + ShareService.generateSharedKey(20).then(function(key){ console.log(key); var list = $scope.share_settings.credentialSharedWithUserAndGroup; @@ -108,13 +128,16 @@ angular.module('passmanApp') var iterator = i; if (list[i].type == "user") { ShareService.getVaultsByUser(list[i].userId).then(function (data) { + $scope.share_settings.cypher_progress.total += data.length; + list[iterator].vaults = data; console.log(data); var start = new Date().getTime() / 1000; ShareService.cypherRSAStringWithPublicKeyBulkAsync(data, key) .progress(function (data) { - console.log(data); + $scope.share_settings.cypher_progress.done ++; + $scope.$digest(); }) .then(function (result) { console.log(result); diff --git a/js/templates.js b/js/templates.js index 606ad011..d541fb44 100644 --- a/js/templates.js +++ b/js/templates.js @@ -81,7 +81,7 @@ angular.module('views/partials/forms/settings/tool.html', []).run(['$templateCac angular.module('views/partials/forms/share_credential/basics.html', []).run(['$templateCache', function($templateCache) { 'use strict'; $templateCache.put('views/partials/forms/share_credential/basics.html', - '
User / groupAccess
{{user.userId}}{{user.accessLevel}}
'); }]); diff --git a/templates/views/partials/forms/share_credential/basics.html b/templates/views/partials/forms/share_credential/basics.html index 92fe1cc7..c50e39b3 100644 --- a/templates/views/partials/forms/share_credential/basics.html +++ b/templates/views/partials/forms/share_credential/basics.html @@ -55,6 +55,12 @@ +
+ Cyphering... +
+ {{ share_settings.cypher_progress.done }} / {{ share_settings.cypher_progress.total }} +
+