1
0
mirror of https://github.com/bitwarden/desktop.git synced 2024-11-08 09:32:07 +01:00

If vault has too many sites, only show a folder list

This commit is contained in:
Kyle Spearrin 2016-12-06 00:26:14 -05:00
parent b6bfa030eb
commit b5f3a1254b
4 changed files with 42 additions and 18 deletions

View File

@ -312,8 +312,8 @@
"description": "Edit"
},
"noSitesInList": {
"message": "There are no sites in list.",
"description": "There are no sites in list."
"message": "There are no sites to list.",
"description": "There are no sites to list."
},
"siteInformation": {
"message": "Site Information",

View File

@ -75,23 +75,28 @@
};
$scope.searchSites = function () {
if (!$scope.searchText) {
if (!$scope.searchText || $scope.searchText.length < 3) {
return;
}
return function (site) {
var searchTerm = $scope.searchText.toLowerCase();
if (site.name && site.name.toLowerCase().indexOf(searchTerm) !== -1) {
return true;
}
if (site.username && site.username.toLowerCase().indexOf(searchTerm) !== -1) {
return true;
}
return false;
};
return searchSite;
};
function searchSite(site) {
var searchTerm = $scope.searchText.toLowerCase();
if (site.name && site.name.toLowerCase().indexOf(searchTerm) !== -1) {
return true;
}
if (site.username && site.username.toLowerCase().indexOf(searchTerm) !== -1) {
return true;
}
if (site.uri && site.uri.toLowerCase().indexOf(searchTerm) !== -1) {
return true;
}
return false;
}
$scope.addSite = function () {
$state.go('addSite', {
animation: 'in-slide-up',
@ -109,6 +114,10 @@
});
};
$scope.viewFolder = function (folder) {
// TODO: vault folder page
};
$scope.clipboardError = function (e) {
toastr.info(i18n.browserNotSupportClipboard);
};

View File

@ -8,17 +8,31 @@
</div>
</div>
<div class="content content-tabs">
<div ng-if="vaultSites.length">
<div ng-if="vaultSites.length && vaultSites.length >= 100 && vaultFolders.length && (!searchText || searchText.length < 3)">
<div class="list">
<div class="list-section">
<div class="list-section-header">
{{i18n.folders}}
</div>
<a href="javascript:void(0)" ng-click="viewFolder(folder)" class="list-section-item"
ng-repeat="folder in vaultFolders | orderBy: folderSort">
{{folder.name}}
<i class="fa fa-chevron-right fa-lg"></i>
</a>
</div>
</div>
</div>
<div ng-if="vaultSites.length && (vaultSites.length < 100 || (searchText && searchText.length >= 3))">
<div class="list">
<div class="list-grouped" ng-repeat="folder in vaultFolders | orderBy: folderSort" ng-show="vaultFolders.length">
<div ng-if="(vaultSites | filter: { folderId: folder.id } | filter: searchSites()).length">
<div ng-if="(vaultSites | filter: { folderId: folder.id } | filter: searchSites()).length">
<div class="list-grouped-header">
<i class="fa fa-folder-open"></i> {{folder.name}}
</div>
<a href="javascript:void(0)" ng-click="viewSite(site)"
class="list-grouped-item condensed" title="{{i18n.edit}} {{site.name}}"
ng-repeat="site in folderSites = (vaultSites | filter: { folderId: folder.id }
| filter: searchSites() | orderBy: ['name', 'username'])">
ng-repeat="site in vaultSites | filter: { folderId: folder.id }
| filter: searchSites() | orderBy: ['name', 'username']">
<span class="btn-list" ng-click="$event.stopPropagation()" title="{{i18n.copyPassword}}" ngclipboard
ngclipboard-error="clipboardError(e)" ngclipboard-success="clipboardSuccess(e, i18n.password)"
data-clipboard-text="{{site.password}}" ng-class="{'disabled': !site.password}">

View File

@ -431,5 +431,6 @@
display: block;
text-align: center;
padding: 0 10px;
width: 100%;
}
}