mirror of
https://github.com/nextcloud/passman.git
synced 2025-01-27 01:39:56 +08:00
Sharing settings improvements
More sharing logic benchmarking and tests
This commit is contained in:
parent
38299973d0
commit
973746389d
5 changed files with 48 additions and 8 deletions
|
@ -123,6 +123,7 @@ angular.module('passmanApp')
|
|||
$scope.share_settings.cypher_progress.done = 0;
|
||||
$scope.share_settings.cypher_progress.total = 0;
|
||||
$scope.share_settings.cypher_progress.times = [];
|
||||
$scope.share_settings.cypher_progress.times_total = [];
|
||||
|
||||
ShareService.generateSharedKey(20).then(function(key){
|
||||
console.log(key);
|
||||
|
@ -159,4 +160,14 @@ angular.module('passmanApp')
|
|||
}
|
||||
})
|
||||
};
|
||||
|
||||
$scope.calculate_total_time = function(){
|
||||
$scope.share_settings.cypher_progress.times = $scope.share_settings.cypher_progress.times || [];
|
||||
var total = 0;
|
||||
for (var i = 0; i < $scope.share_settings.cypher_progress.times.length; i++){
|
||||
total += $scope.share_settings.cypher_progress.times[i].time;
|
||||
}
|
||||
console.log(total);
|
||||
return total;
|
||||
}
|
||||
}]);
|
||||
|
|
|
@ -10,6 +10,34 @@ angular.module('passmanApp')
|
|||
$scope.progress = 1;
|
||||
$scope.generating = false;
|
||||
|
||||
|
||||
|
||||
$scope.available_sizes = [
|
||||
{
|
||||
size: 1024,
|
||||
name: 1024
|
||||
},
|
||||
{
|
||||
size: 2048,
|
||||
name: 2048
|
||||
},
|
||||
{
|
||||
size: 4096,
|
||||
name: 4096
|
||||
}
|
||||
];
|
||||
|
||||
$scope.setKeySize = function (size) {
|
||||
for (var i = 0; i < $scope.available_sizes.length; i++) {
|
||||
if ($scope.available_sizes[i].size == size) {
|
||||
$scope.key_size = $scope.available_sizes[i];
|
||||
return;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
$scope.setKeySize(2048);
|
||||
|
||||
$scope.generateKeys = function (length) {
|
||||
$scope.progress = 1;
|
||||
$scope.generating = true;
|
||||
|
|
|
@ -69,7 +69,7 @@ angular.module('views/partials/forms/settings/password_settings.html', []).run([
|
|||
angular.module('views/partials/forms/settings/sharing.html', []).run(['$templateCache', function($templateCache) {
|
||||
'use strict';
|
||||
$templateCache.put('views/partials/forms/settings/sharing.html',
|
||||
'<div ng-controller="SharingSettingsCtrl"><div class="row"><div class="col-md-6"><label>Private Key</label><textarea class="col-md-12">{{sharing_keys.private_sharing_key}}</textarea></div><div class="col-md-6"><label>Public key</label><textarea class="col-md-12">{{sharing_keys.public_sharing_key}}</textarea></div></div><div class="row"><div class="col-md-12"><label>Key size<select ng-model="key_size"><option value="512">512</option><option value="1024">1024</option><option value="2048">2048</option><option value="4096">4096</option></select><button ng-if="!generating" ng-click="generateKeys(key_size)">Generate sharing keys</button> <button ng-if="generating"><i class="fa fa-spinner fa-spin"></i> Generating sharing keys step {{progress}}/2</button></label></div></div></div>');
|
||||
'<div ng-controller="SharingSettingsCtrl"><div class="row"><div class="col-md-6"><label>Private Key</label><textarea class="col-md-12">{{sharing_keys.private_sharing_key}}</textarea></div><div class="col-md-6"><label>Public key</label><textarea class="col-md-12">{{sharing_keys.public_sharing_key}}</textarea></div></div><div class="row"><div class="col-md-12"><label>Key size<select ng-model="key_size" ng-options="size.name for size in available_sizes"></select><button ng-if="!generating" ng-click="generateKeys(key_size.size)">Generate sharing keys</button> <button ng-if="generating"><i class="fa fa-spinner fa-spin"></i> Generating sharing keys step {{progress}}/2</button></label></div></div></div>');
|
||||
}]);
|
||||
|
||||
angular.module('views/partials/forms/settings/tool.html', []).run(['$templateCache', function($templateCache) {
|
||||
|
@ -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 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></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 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 / 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' +
|
||||
' <i class="fa fa-group" ng-if="data.type === \'group\'"></i>\n' +
|
||||
' {{data.text}}</script>');
|
||||
}]);
|
||||
|
|
|
@ -13,13 +13,13 @@
|
|||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<label>Key size
|
||||
<select ng-model="key_size">
|
||||
<option value="512">512</option>
|
||||
<option value="1024">1024</option>
|
||||
<option value="2048">2048</option>
|
||||
<option value="4096">4096</option>
|
||||
<select ng-model="key_size" ng-options="size.name for size in available_sizes">
|
||||
<!--<option value="512">512</option>-->
|
||||
<!--<option value="1024">1024</option>-->
|
||||
<!--<option value="2048">2048</option>-->
|
||||
<!--<option value="4096">4096</option>-->
|
||||
</select>
|
||||
<button ng-if="!generating" ng-click="generateKeys(key_size)">Generate sharing keys</button>
|
||||
<button ng-if="!generating" ng-click="generateKeys(key_size.size)">Generate sharing keys</button>
|
||||
<button ng-if="generating"><i class="fa fa-spinner fa-spin"></i> Generating sharing keys step {{progress}}/2</button>
|
||||
</label>
|
||||
</div>
|
||||
|
|
|
@ -53,6 +53,7 @@
|
|||
<td>{{user.time}} s</td>
|
||||
</tr>
|
||||
</table>
|
||||
Total time spent cyphering: {{ calculate_total_time() }}
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
|
|
Loading…
Reference in a new issue