Added upload progress bar on the sharing view

This commit is contained in:
Marcos Zuriaga 2016-10-04 18:42:21 +02:00
parent 0d8ad5b8f7
commit 7d8a132463
No known key found for this signature in database
GPG key ID: 7D15585354D072FF
3 changed files with 19 additions and 2 deletions

View file

@ -87,6 +87,10 @@ angular.module('passmanApp')
cypher_progress: {
done: 0,
total: 0
},
upload_progress: {
done: 0,
total: 0
}
};
@ -208,6 +212,9 @@ angular.module('passmanApp')
$scope.share_settings.cypher_progress.total = 0;
$scope.share_settings.cypher_progress.times = [];
$scope.share_settings.cypher_progress.times_total = [];
$scope.share_settings.upload_progress.done = 0;
$scope.share_settings.upload_progress.total = 0;
console.log($scope.storedCredential);
//Credential is already shared
if($scope.storedCredential.shared_key && $scope.storedCredential.shared_key != '' && $scope.storedCredential.shared_key != null){
@ -278,8 +285,14 @@ angular.module('passmanApp')
};
$scope.uploadChanges = function (user) {
$scope.share_settings.upload_progress.total ++;
user.accessLevel = angular.copy(user.acl.getAccessLevel());
ShareService.shareWithUser(storedCredential, user);
ShareService.shareWithUser(storedCredential, user)
.then(function(data){
$scope.share_settings.upload_progress.done ++;
$scope.share_settings.upload_progress.percent = $scope.share_settings.upload_progress.done / $scope.share_settings.upload_progress.total * 100;
});
};
$scope.calculate_total_time = function () {

View file

@ -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',
'<div class="row"><div class="col-xs-12 col-md-6"><div><table class="table sharing_table"><thead><tr><td><tags-input ng-model="inputSharedWith" replace-spaces-with-dashes="false" add-from-autocomplete-only="true" placeholder="Search users or groups..."><auto-complete source="searchUsers($query)" min-length="0" template="autocomplete-template"></auto-complete></tags-input></td><td><button class="button" ng-click="shareWith(inputSharedWith, selectedAccessLevel)">+</button></td></tr></thead></table><div ng-if="share_settings.cypher_progress.done > 0">Cyphering...<div progress-bar="share_settings.cypher_progress.percent" index="share_settings.cypher_progress.done" total="share_settings.cypher_progress.total"></div></div></div></div><div class="col-xs-12 col-md-6"><table class="table"><thead><tr><td>User</td><td>Crypto time</td></tr></thead><tr ng-repeat="user in share_settings.cypher_progress.times"><td><i class="fa fa-user"></i> {{user.user}}</td><td>{{user.time}} s</td></tr></table>Total time spent cyphering: {{ calculate_total_time() }}</div></div><div class="row"><div class="col-xs-12 col-md-6"><table class="table shared_table" ng-show="share_settings.credentialSharedWithUserAndGroup.length > 0"><thead><tr><td>User</td><td>Read</td><td>Write</td><td>Files</td><td>Revisions</td></tr></thead><tr ng-repeat="user in share_settings.credentialSharedWithUserAndGroup"><td><i class="fa fa-user" ng-if="user.type === \'user\'"></i> <i class="fa fa-group" ng-if="user.type === \'group\'"></i> {{user.userId}}</td><td><input type="checkbox" ng-click="setPermission(user.acl, default_permissions.permissions.READ)" ng-checked="hasPermission(user.acl, default_permissions.permissions.READ)"></td><td><input type="checkbox" ng-click="setPermission(user.acl, default_permissions.permissions.WRITE)" ng-checked="hasPermission(user.acl, default_permissions.permissions.WRITE)"></td><td><input type="checkbox" ng-click="setPermission(user.acl, default_permissions.permissions.FILES)" ng-checked="hasPermission(user.acl, default_permissions.permissions.FILES)"></td><td><input type="checkbox" ng-click="setPermission(user.acl, default_permissions.permissions.HISTORY)" ng-checked="hasPermission(user.acl, default_permissions.permissions.HISTORY)"></td></tr></table></div></div><script type="text/ng-template" id="autocomplete-template"><i class="fa fa-user" ng-if="data.type === \'user\'"></i>\n' +
'<div class="row"><div class="col-xs-12 col-md-6"><div><table class="table sharing_table"><thead><tr><td><tags-input ng-model="inputSharedWith" replace-spaces-with-dashes="false" add-from-autocomplete-only="true" placeholder="Search users or groups..."><auto-complete source="searchUsers($query)" min-length="0" template="autocomplete-template"></auto-complete></tags-input></td><td><button class="button" ng-click="shareWith(inputSharedWith, selectedAccessLevel)">+</button></td></tr></thead></table><div ng-if="share_settings.cypher_progress.done > 0">Cyphering...<div progress-bar="share_settings.cypher_progress.percent" index="share_settings.cypher_progress.done" total="share_settings.cypher_progress.total"></div></div><div ng-if="share_settings.upload_progress.done > 0">Uploading...<div progress-bar="share_settings.upload_progress.percent" index="share_settings.upload_progress.done" total="share_settings.upload_progress.total"></div></div></div></div><div class="col-xs-12 col-md-6"><table class="table"><thead><tr><td>User</td><td>Crypto time</td></tr></thead><tr ng-repeat="user in share_settings.cypher_progress.times"><td><i class="fa fa-user"></i> {{user.user}}</td><td>{{user.time}} s</td></tr></table>Total time spent cyphering: {{ calculate_total_time() }}</div></div><div class="row"><div class="col-xs-12 col-md-6"><table class="table shared_table" ng-show="share_settings.credentialSharedWithUserAndGroup.length > 0"><thead><tr><td>User</td><td>Read</td><td>Write</td><td>Files</td><td>Revisions</td></tr></thead><tr ng-repeat="user in share_settings.credentialSharedWithUserAndGroup"><td><i class="fa fa-user" ng-if="user.type === \'user\'"></i> <i class="fa fa-group" ng-if="user.type === \'group\'"></i> {{user.userId}}</td><td><input type="checkbox" ng-click="setPermission(user.acl, default_permissions.permissions.READ)" ng-checked="hasPermission(user.acl, default_permissions.permissions.READ)"></td><td><input type="checkbox" ng-click="setPermission(user.acl, default_permissions.permissions.WRITE)" ng-checked="hasPermission(user.acl, default_permissions.permissions.WRITE)"></td><td><input type="checkbox" ng-click="setPermission(user.acl, default_permissions.permissions.FILES)" ng-checked="hasPermission(user.acl, default_permissions.permissions.FILES)"></td><td><input type="checkbox" ng-click="setPermission(user.acl, default_permissions.permissions.HISTORY)" ng-checked="hasPermission(user.acl, default_permissions.permissions.HISTORY)"></td></tr></table></div></div><script type="text/ng-template" id="autocomplete-template"><i class="fa fa-user" ng-if="data.type === \'user\'"></i>\n' +
' <i class="fa fa-group" ng-if="data.type === \'group\'"></i>\n' +
' {{data.text}}</script>');
}]);

View file

@ -29,6 +29,10 @@
Cyphering...
<div progress-bar="share_settings.cypher_progress.percent" index="share_settings.cypher_progress.done" total="share_settings.cypher_progress.total"></div>
</div>
<div ng-if="share_settings.upload_progress.done > 0">
Uploading...
<div progress-bar="share_settings.upload_progress.percent" index="share_settings.upload_progress.done" total="share_settings.upload_progress.total"></div>
</div>
</div>
</div>
<div class="col-xs-12 col-md-6">