From 290cbe6b55f2c2b252e2a88dba93c59bdc488e46 Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Tue, 7 Mar 2017 23:05:49 -0500 Subject: [PATCH] list subvaults for org --- .../organizationSubvaultsController.js | 22 +++++++++++- .../views/organizationSubvaults.html | 34 +++++++++++++++++-- src/app/services/apiService.js | 9 +++++ 3 files changed, 62 insertions(+), 3 deletions(-) diff --git a/src/app/organization/organizationSubvaultsController.js b/src/app/organization/organizationSubvaultsController.js index 07d09ce9fe..199c9b15bf 100644 --- a/src/app/organization/organizationSubvaultsController.js +++ b/src/app/organization/organizationSubvaultsController.js @@ -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; + }); + } }); diff --git a/src/app/organization/views/organizationSubvaults.html b/src/app/organization/views/organizationSubvaults.html index dcb5443227..b55bfd73dd 100644 --- a/src/app/organization/views/organizationSubvaults.html +++ b/src/app/organization/views/organizationSubvaults.html @@ -14,8 +14,38 @@ -
- Some data +
+
+ Loading... +
+
+

No subvaults.

+ +
+
+ + + + + + + + +
+
+ + +
+
+ + + {{subvault.name}} +
+
diff --git a/src/app/services/apiService.js b/src/app/services/apiService.js index 7f5a8b91f1..52a61887b7 100644 --- a/src/app/services/apiService.js +++ b/src/app/services/apiService.js @@ -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' } },