1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-12-27 17:18:04 +01:00

loading switches for cipher and groupings

This commit is contained in:
Kyle Spearrin 2018-03-19 11:28:23 -04:00
parent 4ccd9501a8
commit 7a50c0536c
2 changed files with 13 additions and 14 deletions

View File

@ -3,7 +3,8 @@
.controller('vaultController', function ($scope, $uibModal, apiService, $filter, cryptoService, authService, toastr,
cipherService, $q, $localStorage, $timeout, $rootScope, $state, $analytics, constants, validationService) {
$scope.loading = true;
$scope.loadingCiphers = true;
$scope.loadingGroupings = true;
$scope.ciphers = [];
$scope.folders = [];
$scope.collections = [];
@ -29,7 +30,7 @@
}, 500);
if (($rootScope.vaultFolders || $rootScope.vaultCollections) && $rootScope.vaultCiphers) {
$scope.loading = false;
$scope.loadingCiphers = $scope.loadingGroupings = false;
loadCipherData($rootScope.vaultCiphers);
return;
}
@ -62,9 +63,10 @@
var groupingPromise = $q.all([collectionPromise, folderPromise]).then(function () {
$rootScope.vaultCollections = decCollections;
$rootScope.vaultFolders = decFolders;
$scope.loadingGroupings = false;
});
var cipherPromise = apiService.ciphers.list({}, function (ciphers) {
apiService.ciphers.list({}, function (ciphers) {
var decCiphers = [];
for (var i = 0; i < ciphers.Data.length; i++) {
@ -76,14 +78,11 @@
loadCipherData(decCiphers);
});
}).$promise;
$q.all([cipherPromise, groupingPromise]).then(function () {
$scope.loading = false;
});
}
function loadCipherData(decCiphers) {
$rootScope.vaultCiphers = $scope.ciphers = $filter('orderBy')(decCiphers, ['sort', 'name', 'subTitle']);
$scope.loadingCiphers = false;
var chunks = chunk($rootScope.vaultCiphers, 400);
if (chunks.length > 0) {

View File

@ -40,10 +40,10 @@
</h1>
</section>
<section class="content">
<div ng-show="loading">
<div ng-show="loadingCiphers">
<p>Loading...</p>
</div>
<div class="box" ng-show="!loading">
<div class="box" ng-show="!loadingCiphers">
<div class="box-header with-border">
<h3 class="box-title">
<i class="fa {{selectedIcon}}"></i>
@ -195,10 +195,10 @@
</ul>
</div>
<h3 class="control-sidebar-heading">Folders</h3>
<div ng-show="loading && !vaultFolders.length">
<div ng-show="loadingGroupings">
<p>Loading...</p>
</div>
<div class="control-sidebar-section" ng-show="!loading && vaultFolders.length">
<div class="control-sidebar-section" ng-show="!loadingGroupings">
<ul class="control-sidebar-menu">
<li ng-repeat="folder in vaultFolders | orderBy: [groupingSort] track by folder.id"
ng-class="{active: selectedFolder && folder.id === selectedFolder.id}">
@ -210,16 +210,16 @@
</ul>
</div>
<h3 class="control-sidebar-heading">Collections</h3>
<div ng-show="loading && !vaultCollections.length">
<div ng-show="loadingGroupings">
<p>Loading...</p>
</div>
<div ng-show="!loading && !vaultCollections.length">
<div ng-show="!loadingGroupings && !vaultCollections.length">
<p>No collections are being shared with you. <i class="fa fa-frown-o"></i></p>
<a ui-sref="backend.user.settingsCreateOrg" class="btn btn-default btn-lint">
Create an Organization
</a>
</div>
<div class="control-sidebar-section" ng-show="!loading && vaultCollections.length">
<div class="control-sidebar-section" ng-show="!loadingGroupings && vaultCollections.length">
<ul class="control-sidebar-menu">
<li ng-repeat="collection in vaultCollections | orderBy: [groupingSort] track by collection.id"
ng-class="{active: selectedCollection && collection.id === selectedCollection.id}">