mirror of
https://github.com/bitwarden/browser.git
synced 2024-11-23 11:56:00 +01:00
subvault listing
This commit is contained in:
parent
9f1ab6f961
commit
d51eab779c
@ -24,6 +24,7 @@
|
||||
_service.ciphers = $resource(_apiUri + '/ciphers/:id', {}, {
|
||||
get: { method: 'GET', params: { id: '@id' } },
|
||||
list: { method: 'GET', params: {} },
|
||||
listSubvaults: { url: _apiUri + '/ciphers/subvaults', method: 'GET', params: {} },
|
||||
'import': { url: _apiUri + '/ciphers/import', method: 'POST', params: {} },
|
||||
favorite: { url: _apiUri + '/ciphers/:id/favorite', method: 'POST', params: { id: '@id' } },
|
||||
move: { url: _apiUri + '/ciphers/:id/move', method: 'POST', params: { id: '@id' } },
|
||||
|
@ -26,6 +26,7 @@ angular
|
||||
var login = {
|
||||
id: encryptedLogin.Id,
|
||||
organizationId: encryptedLogin.OrganizationId,
|
||||
subvaultIds: encryptedLogin.SubvaultIds || [],
|
||||
'type': 1,
|
||||
folderId: encryptedLogin.FolderId,
|
||||
favorite: encryptedLogin.Favorite,
|
||||
@ -56,6 +57,7 @@ angular
|
||||
var login = {
|
||||
id: encryptedCipher.Id,
|
||||
organizationId: encryptedCipher.OrganizationId,
|
||||
subvaultIds: encryptedCipher.SubvaultIds || [],
|
||||
folderId: encryptedCipher.FolderId,
|
||||
favorite: encryptedCipher.Favorite,
|
||||
name: _service.decryptProperty(encryptedCipher.Data.Name, key, false),
|
||||
|
@ -1,6 +1,44 @@
|
||||
angular
|
||||
.module('bit.sharing')
|
||||
|
||||
.controller('sharingController', function ($scope, apiService, cryptoService, cipherService, $analytics) {
|
||||
.controller('sharingController', function ($scope, apiService, cipherService, $analytics, $q) {
|
||||
$scope.logins = [];
|
||||
$scope.subvaults = [];
|
||||
$scope.loading = true;
|
||||
|
||||
$scope.$on('$viewContentLoaded', function () {
|
||||
var subvaultPromise = apiService.subvaults.listMe({}, function (subvaults) {
|
||||
var decSubvaults = [];
|
||||
|
||||
for (var i = 0; i < subvaults.Data.length; i++) {
|
||||
var decSubvault = cipherService.decryptSubvault(subvaults.Data[i], null, true);
|
||||
decSubvaults.push(decSubvault);
|
||||
}
|
||||
|
||||
$scope.subvaults = decSubvaults;
|
||||
}).$promise;
|
||||
|
||||
var cipherPromise = apiService.ciphers.listSubvaults({}, function (ciphers) {
|
||||
var decLogins = [];
|
||||
|
||||
for (var i = 0; i < ciphers.Data.length; i++) {
|
||||
if (ciphers.Data[i].Type === 1) {
|
||||
var decLogin = cipherService.decryptLoginPreview(ciphers.Data[i]);
|
||||
decLogins.push(decLogin);
|
||||
}
|
||||
}
|
||||
|
||||
$scope.logins = decLogins;
|
||||
}).$promise;
|
||||
|
||||
$q.all([subvaultPromise, cipherPromise]).then(function () {
|
||||
$scope.loading = false;
|
||||
});
|
||||
});
|
||||
|
||||
$scope.filterBySubvault = function (subvault) {
|
||||
return function (cipher) {
|
||||
return cipher.subvaultIds.indexOf(subvault.id) > -1;
|
||||
};
|
||||
};
|
||||
});
|
||||
|
@ -1,7 +1,7 @@
|
||||
<section class="content-header">
|
||||
<h1>
|
||||
Sharing Center
|
||||
<small>{{subvaults.length > 0 ? subvaults.length - 1 : 0}} subvaults, {{logins.length}} logins</small>
|
||||
<small>{{subvaults.length}} subvaults, {{logins.length}} logins</small>
|
||||
</h1>
|
||||
</section>
|
||||
<section class="content">
|
||||
@ -27,7 +27,7 @@
|
||||
<div class="box-body" ng-class="{'no-padding': subvaultLogins.length}">
|
||||
<div ng-show="!subvaultLogins.length">
|
||||
<p>No logins in this folder.</p>
|
||||
<button type="button" ng-click="addLogin(folder)" class="btn btn-default btn-flat">Add a Login</button>
|
||||
<button type="button" ng-click="addLogin(subvault)" class="btn btn-default btn-flat">Add a Login</button>
|
||||
</div>
|
||||
<div class="table-responsive" ng-show="subvaultLogins.length">
|
||||
<table class="table table-striped table-hover table-selectable">
|
||||
@ -39,7 +39,7 @@
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr ng-repeat="login in subvaultLogins = (logins | filter: { subvaultId: subvault.id } |
|
||||
<tr ng-repeat="login in subvaultLogins = (logins | filter: filterBySubvault(subvault) |
|
||||
filter: (main.searchVaultText || '') | orderBy: ['name', 'username'])">
|
||||
<td class="actions">
|
||||
<button type="button" ng-click="deleteLogin(login)" class="btn btn-link btn-table"
|
||||
|
Loading…
Reference in New Issue
Block a user