mirror of
https://github.com/bitwarden/web
synced 2025-12-15 15:53:18 +00:00
filter cipher list by type
This commit is contained in:
@@ -2,11 +2,13 @@
|
|||||||
.module('bit.vault')
|
.module('bit.vault')
|
||||||
|
|
||||||
.controller('vaultController', function ($scope, $uibModal, apiService, $filter, cryptoService, authService, toastr,
|
.controller('vaultController', function ($scope, $uibModal, apiService, $filter, cryptoService, authService, toastr,
|
||||||
cipherService, $q, $localStorage, $timeout, $rootScope, $state, $analytics) {
|
cipherService, $q, $localStorage, $timeout, $rootScope, $state, $analytics, constants) {
|
||||||
$scope.loading = true;
|
$scope.loading = true;
|
||||||
$scope.ciphers = [];
|
$scope.ciphers = [];
|
||||||
|
$scope.constants = constants;
|
||||||
$scope.favoriteCollapsed = $localStorage.collapsedFolders && 'favorite' in $localStorage.collapsedFolders;
|
$scope.favoriteCollapsed = $localStorage.collapsedFolders && 'favorite' in $localStorage.collapsedFolders;
|
||||||
$scope.folderIdFilter = undefined;
|
$scope.folderIdFilter = undefined;
|
||||||
|
$scope.typeFilter = undefined;
|
||||||
|
|
||||||
if ($state.params.refreshFromServer) {
|
if ($state.params.refreshFromServer) {
|
||||||
$rootScope.vaultFolders = $rootScope.vaultCiphers = null;
|
$rootScope.vaultFolders = $rootScope.vaultCiphers = null;
|
||||||
@@ -347,8 +349,19 @@
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
$scope.filterType = function (type) {
|
||||||
|
$scope.typeFilter = type;
|
||||||
|
|
||||||
|
if ($.AdminLTE && $.AdminLTE.layout) {
|
||||||
|
$timeout(function () {
|
||||||
|
$.AdminLTE.layout.fix();
|
||||||
|
}, 0);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
$scope.clearFilters = function () {
|
$scope.clearFilters = function () {
|
||||||
$scope.folderIdFilter = undefined;
|
$scope.folderIdFilter = undefined;
|
||||||
|
$scope.typeFilter = undefined;
|
||||||
|
|
||||||
if ($.AdminLTE && $.AdminLTE.layout) {
|
if ($.AdminLTE && $.AdminLTE.layout) {
|
||||||
$timeout(function () {
|
$timeout(function () {
|
||||||
@@ -361,6 +374,10 @@
|
|||||||
return $scope.folderIdFilter === undefined || folder.id === $scope.folderIdFilter;
|
return $scope.folderIdFilter === undefined || folder.id === $scope.folderIdFilter;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
$scope.cipherFilter = function (cipher) {
|
||||||
|
return $scope.typeFilter === undefined || cipher.type === $scope.typeFilter;
|
||||||
|
};
|
||||||
|
|
||||||
$scope.unselectAll = function () {
|
$scope.unselectAll = function () {
|
||||||
selectAll(false);
|
selectAll(false);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -183,8 +183,8 @@
|
|||||||
<div class="table-responsive" ng-show="folderCiphers.length">
|
<div class="table-responsive" ng-show="folderCiphers.length">
|
||||||
<table class="table table-striped table-hover table-vmiddle">
|
<table class="table table-striped table-hover table-vmiddle">
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr ng-repeat="cipher in folderCiphers = (ciphers | filter: { folderId: folder.id } |
|
<tr ng-repeat="cipher in folderCiphers = (ciphers | filter: { folderId: folder.id } |
|
||||||
filter: (main.searchVaultText || '')) track by cipher.id">
|
filter: cipherFilter | filter: (main.searchVaultText || '')) track by cipher.id">
|
||||||
<td style="width: 70px;">
|
<td style="width: 70px;">
|
||||||
<div class="btn-group" data-append-to="body">
|
<div class="btn-group" data-append-to="body">
|
||||||
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
|
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
|
||||||
@@ -254,6 +254,35 @@
|
|||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
<h3 class="control-sidebar-heading">
|
||||||
|
<i class="fa fa-tag fa-fw"></i> Types
|
||||||
|
</h3>
|
||||||
|
<ul class="control-sidebar-menu">
|
||||||
|
<li>
|
||||||
|
<a href="#" stop-click ng-click="filterType(constants.cipherType.login)">
|
||||||
|
<i class="fa fa-check" ng-if="constants.cipherType.login === typeFilter"></i>
|
||||||
|
Login
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<a href="#" stop-click ng-click="filterType(constants.cipherType.card)">
|
||||||
|
<i class="fa fa-check" ng-if="constants.cipherType.card === typeFilter"></i>
|
||||||
|
Card
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<a href="#" stop-click ng-click="filterType(constants.cipherType.identity)">
|
||||||
|
<i class="fa fa-check" ng-if="constants.cipherType.identity === typeFilter"></i>
|
||||||
|
Identity
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<a href="#" stop-click ng-click="filterType(constants.cipherType.secureNote)">
|
||||||
|
<i class="fa fa-check" ng-if="constants.cipherType.secureNote === typeFilter"></i>
|
||||||
|
Secure Note
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
<h3 class="control-sidebar-heading">
|
<h3 class="control-sidebar-heading">
|
||||||
<i class="fa fa-folder fa-fw"></i> Folders
|
<i class="fa fa-folder fa-fw"></i> Folders
|
||||||
</h3>
|
</h3>
|
||||||
|
|||||||
Reference in New Issue
Block a user