mirror of
https://github.com/nextcloud/passman.git
synced 2024-12-26 09:34:02 +08:00
Progressbar on share action for cypher
TODO: add a progressbar of the upload and the actual upload
This commit is contained in:
parent
288e6f19c0
commit
d682df4806
3 changed files with 32 additions and 3 deletions
|
@ -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);
|
||||
|
|
|
@ -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><select ng-model="selectedAccessLevel"><option ng-repeat="lvl in accessLevels" value="{{lvl.value}}">{{lvl.label}}</option></select><button class="button" ng-click="shareWith(inputSharedWith, selectedAccessLevel)">+</button></td></tr></thead></table></div></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 / group</td><td>Access</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>{{user.accessLevel}}</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><select ng-model="selectedAccessLevel"><option ng-repeat="lvl in accessLevels" value="{{lvl.value}}">{{lvl.label}}</option></select><button class="button" ng-click="shareWith(inputSharedWith, selectedAccessLevel)">+</button></td></tr></thead></table></div></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 / group</td><td>Access</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>{{user.accessLevel}}</td></tr></table></div></div><div class="row" ng-if="share_settings.cypher_progress.done > 0">Cyphering...<div progress-bar="share_settings.cypher_progress"></div>{{ share_settings.cypher_progress.done }} / {{ share_settings.cypher_progress.total }}</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>');
|
||||
}]);
|
||||
|
|
|
@ -55,6 +55,12 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row" ng-if="share_settings.cypher_progress.done > 0">
|
||||
Cyphering...
|
||||
<div progress-bar="share_settings.cypher_progress"></div>
|
||||
{{ share_settings.cypher_progress.done }} / {{ share_settings.cypher_progress.total }}
|
||||
</div>
|
||||
|
||||
<script type="text/ng-template" id="autocomplete-template">
|
||||
<i class="fa fa-user" ng-if="data.type === 'user'"></i>
|
||||
<i class="fa fa-group" ng-if="data.type === 'group'"></i>
|
||||
|
|
Loading…
Reference in a new issue