1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-10-31 08:20:37 +01:00

list subvaults for org

This commit is contained in:
Kyle Spearrin 2017-03-07 23:05:49 -05:00
parent d5708f24e6
commit 290cbe6b55
3 changed files with 62 additions and 3 deletions

View File

@ -1,6 +1,26 @@
angular
.module('bit.organization')
.controller('organizationSubvaultsController', function ($scope) {
.controller('organizationSubvaultsController', function ($scope, $state, apiService) {
$scope.subvaults = [];
$scope.loading = true;
$scope.$on('$viewContentLoaded', function () {
loadList();
});
function loadList() {
apiService.subvaults.listOrganization({ orgId: $state.params.orgId }, function (list) {
var subvaults = [];
for (var i = 0; i < list.Data.length; i++) {
subvaults.push({
id: list.Data[i].Id,
name: list.Data[i].Name
});
}
$scope.subvaults = subvaults;
$scope.loading = false;
});
}
});

View File

@ -14,8 +14,38 @@
</button>
</div>
</div>
<div class="box-body">
Some data
<div class="box-body" ng-class="{'no-padding': subvault.length}">
<div ng-show="loading && !subvault.length">
Loading...
</div>
<div ng-show="!loading && !subvault.length">
<p>No subvaults.</p>
<button type="button" ng-click="add()" class="btn btn-default btn-flat">Add a Subvault</button>
</div>
<div class="table-responsive" ng-show="subvault.length">
<table class="table table-striped table-hover">
<tbody>
<tr ng-repeat="subvault in subvaults | orderBy: ['name']">
<td style="width: 70px;" valign="middle">
<div class="btn-group">
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
<i class="fa fa-cog"></i> <span class="caret"></span>
</button>
<ul class="dropdown-menu">
<li><a href="#" class="text-danger">Remove</a></li>
</ul>
</div>
</td>
<td style="width: 45px;" valign="middle">
<i class="fa fa-share-alt fa-2x"></i>
</td>
<td valign="middle">
{{subvault.name}}
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</section>

View File

@ -29,6 +29,15 @@
del: { url: _apiUri + '/ciphers/:id/delete', method: 'POST', params: { id: '@id' } }
});
_service.subvaults = $resource(_apiUri + '/subvaults/:id', {}, {
get: { method: 'GET', params: { id: '@id' } },
list: { method: 'GET', params: {} },
listOrganization: { url: _apiUri + '/subvaults/organization/:orgId', method: 'GET', params: { orgId: '@orgId' } },
post: { method: 'POST', params: {} },
put: { method: 'POST', params: { id: '@id' } },
del: { url: _apiUri + '/subvaults/:id/delete', method: 'POST', params: { id: '@id' } }
});
_service.organizations = $resource(_apiUri + '/organizations/:id', {}, {
get: { method: 'GET', params: { id: '@id' } },
getExtended: { url: _apiUri + '/organizations/:id/extended', method: 'GET', params: { id: '@id' } },