mirror of
https://github.com/bitwarden/browser.git
synced 2025-01-03 18:28:13 +01:00
compute counts on every load scenario
This commit is contained in:
parent
90c079e743
commit
9e96906f32
@ -41,7 +41,6 @@
|
|||||||
decCollection.collection = true;
|
decCollection.collection = true;
|
||||||
decGroupings.push(decCollection);
|
decGroupings.push(decCollection);
|
||||||
}
|
}
|
||||||
$scope.collectionCount = collections.Data.length;
|
|
||||||
}).$promise;
|
}).$promise;
|
||||||
|
|
||||||
var folderPromise = apiService.folders.list({}, function (folders) {
|
var folderPromise = apiService.folders.list({}, function (folders) {
|
||||||
@ -50,7 +49,6 @@
|
|||||||
decFolder.folder = true;
|
decFolder.folder = true;
|
||||||
decGroupings.push(decFolder);
|
decGroupings.push(decFolder);
|
||||||
}
|
}
|
||||||
$scope.folderCount = folders.Data.length;
|
|
||||||
}).$promise;
|
}).$promise;
|
||||||
|
|
||||||
var groupingPromise = $q.all([collectionPromise, folderPromise]).then(function () {
|
var groupingPromise = $q.all([collectionPromise, folderPromise]).then(function () {
|
||||||
@ -78,6 +76,8 @@
|
|||||||
function loadGroupingData(decGroupings) {
|
function loadGroupingData(decGroupings) {
|
||||||
$rootScope.vaultGroupings = $filter('orderBy')(decGroupings, ['folder', groupingSort]);
|
$rootScope.vaultGroupings = $filter('orderBy')(decGroupings, ['folder', groupingSort]);
|
||||||
var collections = $filter('filter')($rootScope.vaultGroupings, { collection: true });
|
var collections = $filter('filter')($rootScope.vaultGroupings, { collection: true });
|
||||||
|
$scope.collectionCount = collections.length;
|
||||||
|
$scope.folderCount = decGroupings.length - collections.length - 1;
|
||||||
if (collections && collections.length) {
|
if (collections && collections.length) {
|
||||||
$scope.firstCollectionId = collections[0].id;
|
$scope.firstCollectionId = collections[0].id;
|
||||||
}
|
}
|
||||||
@ -344,6 +344,7 @@
|
|||||||
var index = $rootScope.vaultGroupings.indexOf(folder);
|
var index = $rootScope.vaultGroupings.indexOf(folder);
|
||||||
if (index > -1) {
|
if (index > -1) {
|
||||||
$rootScope.vaultGroupings.splice(index, 1);
|
$rootScope.vaultGroupings.splice(index, 1);
|
||||||
|
$scope.folderCount--;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user