mirror of
https://github.com/bitwarden/browser
synced 2025-12-17 08:43:33 +00:00
subvault listing search and edit subvault
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
angular
|
angular
|
||||||
.module('bit.organization')
|
.module('bit.organization')
|
||||||
|
|
||||||
.controller('organizationSubvaultsController', function ($scope, $state, apiService, $uibModal, cipherService) {
|
.controller('organizationSubvaultsController', function ($scope, $state, apiService, $uibModal, cipherService, $filter) {
|
||||||
$scope.subvaults = [];
|
$scope.subvaults = [];
|
||||||
$scope.loading = true;
|
$scope.loading = true;
|
||||||
$scope.$on('$viewContentLoaded', function () {
|
$scope.$on('$viewContentLoaded', function () {
|
||||||
@@ -20,6 +20,24 @@
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
$scope.edit = function (subvault) {
|
||||||
|
var modal = $uibModal.open({
|
||||||
|
animation: true,
|
||||||
|
templateUrl: 'app/organization/views/organizationSubvaultsEdit.html',
|
||||||
|
controller: 'organizationSubvaultsEditController',
|
||||||
|
resolve: {
|
||||||
|
id: function () { return subvault.id; }
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
modal.result.then(function (editedSubvault) {
|
||||||
|
var existingSubvaults = $filter('filter')($scope.subvaults, { id: editedSubvault.id }, true);
|
||||||
|
if (existingSubvaults && existingSubvaults.length > 0) {
|
||||||
|
existingSubvaults[0].name = editedSubvault.name;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
$scope.delete = function (subvault) {
|
$scope.delete = function (subvault) {
|
||||||
if (!confirm('Are you sure you want to delete this subvault (' + subvault.name + ')?')) {
|
if (!confirm('Are you sure you want to delete this subvault (' + subvault.name + ')?')) {
|
||||||
return;
|
return;
|
||||||
|
|||||||
26
src/app/organization/organizationSubvaultsEditController.js
Normal file
26
src/app/organization/organizationSubvaultsEditController.js
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
angular
|
||||||
|
.module('bit.organization')
|
||||||
|
|
||||||
|
.controller('organizationSubvaultsEditController', function ($scope, $state, $uibModalInstance, apiService, cipherService,
|
||||||
|
$analytics, id) {
|
||||||
|
$scope.subvault = {};
|
||||||
|
|
||||||
|
$uibModalInstance.opened.then(function () {
|
||||||
|
apiService.subvaults.get({ orgId: $state.params.orgId, id: id }, function (subvault) {
|
||||||
|
$scope.subvault = cipherService.decryptSubvault(subvault);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
$scope.submit = function (model) {
|
||||||
|
var subvault = cipherService.encryptSubvault(model, $state.params.orgId);
|
||||||
|
$scope.submitPromise = apiService.subvaults.put({ orgId: $state.params.orgId }, subvault, function (response) {
|
||||||
|
$analytics.eventTrack('Edited Subvault');
|
||||||
|
var decSubvault = cipherService.decryptSubvault(response, $state.params.orgId, true);
|
||||||
|
$uibModalInstance.close(decSubvault);
|
||||||
|
}).$promise;
|
||||||
|
};
|
||||||
|
|
||||||
|
$scope.close = function () {
|
||||||
|
$uibModalInstance.dismiss('cancel');
|
||||||
|
};
|
||||||
|
});
|
||||||
@@ -7,19 +7,27 @@
|
|||||||
<section class="content">
|
<section class="content">
|
||||||
<div class="box">
|
<div class="box">
|
||||||
<div class="box-header with-border">
|
<div class="box-header with-border">
|
||||||
<h3 class="box-title">
|
|
||||||
|
<div class="box-filters hidden-xs">
|
||||||
</h3>
|
<div class="form-group form-group-sm has-feedback has-feedback-left">
|
||||||
|
<input type="text" id="search" class="form-control" placeholder="Search subvaults..."
|
||||||
|
style="width: 200px;" ng-model="filterSearch">
|
||||||
|
<span class="fa fa-search form-control-feedback text-muted" aria-hidden="true"></span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<div class="box-tools">
|
<div class="box-tools">
|
||||||
<button type="button" class="btn btn-primary btn-sm btn-flat" ng-click="add()">
|
<button type="button" class="btn btn-primary btn-sm btn-flat" ng-click="add()">
|
||||||
<i class="fa fa-fw fa-plus-circle"></i> New Subvault
|
<i class="fa fa-fw fa-plus-circle"></i> New Subvault
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="box-body" ng-class="{'no-padding': subvaults.length}">
|
<div class="box-body" ng-class="{'no-padding': filteredSubvaults.length}">
|
||||||
<div ng-show="loading && !subvaults.length">
|
<div ng-show="loading && !subvaults.length">
|
||||||
Loading...
|
Loading...
|
||||||
</div>
|
</div>
|
||||||
|
<div ng-show="!filteredSubvaults.length && filterSearch">
|
||||||
|
No subvaults to list.
|
||||||
|
</div>
|
||||||
<div ng-show="!loading && !subvaults.length">
|
<div ng-show="!loading && !subvaults.length">
|
||||||
<p>No subvaults.</p>
|
<p>No subvaults.</p>
|
||||||
<button type="button" ng-click="add()" class="btn btn-default btn-flat">Add a Subvault</button>
|
<button type="button" ng-click="add()" class="btn btn-default btn-flat">Add a Subvault</button>
|
||||||
@@ -27,7 +35,8 @@
|
|||||||
<div class="table-responsive" ng-show="subvaults.length">
|
<div class="table-responsive" ng-show="subvaults.length">
|
||||||
<table class="table table-striped table-hover">
|
<table class="table table-striped table-hover">
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr ng-repeat="subvault in subvaults | orderBy: ['name']">
|
<tr ng-repeat="subvault in filteredSubvaults = (subvaults | filter: (filterSearch || '') |
|
||||||
|
orderBy: ['name'])">
|
||||||
<td valign="middle">
|
<td valign="middle">
|
||||||
<a href="javascript:void(0)" ng-click="edit(subvault)">
|
<a href="javascript:void(0)" ng-click="edit(subvault)">
|
||||||
{{subvault.name}}
|
{{subvault.name}}
|
||||||
|
|||||||
@@ -4,9 +4,6 @@
|
|||||||
</div>
|
</div>
|
||||||
<form name="form" ng-submit="form.$valid && submit(model)" api-form="submitPromise">
|
<form name="form" ng-submit="form.$valid && submit(model)" api-form="submitPromise">
|
||||||
<div class="modal-body">
|
<div class="modal-body">
|
||||||
<p>
|
|
||||||
Add a subvault.
|
|
||||||
</p>
|
|
||||||
<div class="callout callout-danger validation-errors" ng-show="form.$errors">
|
<div class="callout callout-danger validation-errors" ng-show="form.$errors">
|
||||||
<h4>Errors have occured</h4>
|
<h4>Errors have occured</h4>
|
||||||
<ul>
|
<ul>
|
||||||
|
|||||||
25
src/app/organization/views/organizationSubvaultsEdit.html
Normal file
25
src/app/organization/views/organizationSubvaultsEdit.html
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
<div class="modal-header">
|
||||||
|
<button type="button" class="close" ng-click="close()" aria-label="Close"><span aria-hidden="true">×</span></button>
|
||||||
|
<h4 class="modal-title"><i class="fa fa-share-alt"></i> Edit Subvault</h4>
|
||||||
|
</div>
|
||||||
|
<form name="form" ng-submit="form.$valid && submit(subvault)" api-form="submitPromise">
|
||||||
|
<div class="modal-body">
|
||||||
|
<div class="callout callout-danger validation-errors" ng-show="form.$errors">
|
||||||
|
<h4>Errors have occured</h4>
|
||||||
|
<ul>
|
||||||
|
<li ng-repeat="e in form.$errors">{{e}}</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<div class="form-group" show-errors>
|
||||||
|
<label for="email">Name</label>
|
||||||
|
<input type="text" id="name" name="Name" ng-model="subvault.name" class="form-control" required api-field />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer">
|
||||||
|
<button type="submit" class="btn btn-primary btn-flat" ng-disabled="form.$loading">
|
||||||
|
<i class="fa fa-refresh fa-spin loading-icon" ng-show="form.$loading"></i>Submit
|
||||||
|
</button>
|
||||||
|
<button type="button" class="btn btn-default btn-flat" ng-click="close()">Close</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
|
||||||
@@ -126,6 +126,7 @@
|
|||||||
<script src="app/organization/organizationPeopleEditController.js"></script>
|
<script src="app/organization/organizationPeopleEditController.js"></script>
|
||||||
<script src="app/organization/organizationSubvaultsController.js"></script>
|
<script src="app/organization/organizationSubvaultsController.js"></script>
|
||||||
<script src="app/organization/organizationSubvaultsAddController.js"></script>
|
<script src="app/organization/organizationSubvaultsAddController.js"></script>
|
||||||
|
<script src="app/organization/organizationSubvaultsEditController.js"></script>
|
||||||
|
|
||||||
<script src="app/settings/settingsModule.js"></script>
|
<script src="app/settings/settingsModule.js"></script>
|
||||||
<script src="app/settings/settingsController.js"></script>
|
<script src="app/settings/settingsController.js"></script>
|
||||||
|
|||||||
Reference in New Issue
Block a user