show loading while syncing on vault list
This commit is contained in:
parent
3f95c3a7ea
commit
c3d1d4101e
|
@ -86,7 +86,7 @@ angular
|
|||
}
|
||||
};
|
||||
|
||||
$scope.$on('syncCompleted', function (event, args) {
|
||||
$scope.$on('syncCompleted', function (event, successfully) {
|
||||
if ($scope.loaded) {
|
||||
setTimeout(loadVault, 500);
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
angular
|
||||
angular
|
||||
.module('bit.global')
|
||||
|
||||
.controller('mainController', function ($scope, $state, loginService, toastr) {
|
||||
|
@ -18,7 +18,7 @@
|
|||
|
||||
chrome.runtime.onMessage.addListener(function (msg, sender, sendResponse) {
|
||||
if (msg.command === 'syncCompleted') {
|
||||
$scope.$broadcast('syncCompleted');
|
||||
$scope.$broadcast('syncCompleted', msg.successfully);
|
||||
}
|
||||
else if (msg.command === 'syncStarted') {
|
||||
$scope.$broadcast('syncStarted');
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
angular
|
||||
.module('bit.vault')
|
||||
|
||||
.controller('vaultController', function ($scope, $rootScope, siteService, folderService, $q, $state, $stateParams, toastr) {
|
||||
.controller('vaultController', function ($scope, $rootScope, siteService, folderService, $q, $state, $stateParams, toastr,
|
||||
syncService) {
|
||||
$('#search').focus();
|
||||
|
||||
var delayLoad = true;
|
||||
|
@ -42,9 +43,11 @@
|
|||
promises.push(sitePromise);
|
||||
|
||||
$q.all(promises).then(function () {
|
||||
$scope.loaded = true;
|
||||
$rootScope.vaultFolders = decFolders;
|
||||
$rootScope.vaultSites = decSites;
|
||||
if (decSites.length || !syncService.syncInProgress) {
|
||||
$scope.loaded = true;
|
||||
$rootScope.vaultFolders = decFolders;
|
||||
$rootScope.vaultSites = decSites;
|
||||
}
|
||||
if (!delayLoad) {
|
||||
setScrollY();
|
||||
}
|
||||
|
@ -108,10 +111,8 @@
|
|||
toastr.info(type + ' copied!');
|
||||
};
|
||||
|
||||
$scope.$on('syncCompleted', function (event, args) {
|
||||
if ($scope.loaded) {
|
||||
setTimeout(loadVault, 500);
|
||||
}
|
||||
$scope.$on('syncCompleted', function (event, successfully) {
|
||||
setTimeout(loadVault, 500);
|
||||
});
|
||||
|
||||
function getScrollY() {
|
||||
|
|
|
@ -14,15 +14,17 @@ function initSyncService() {
|
|||
throw 'callback function required';
|
||||
}
|
||||
|
||||
syncStarted();
|
||||
|
||||
var self = this;
|
||||
self.userService.isAuthenticated(function (isAuthenticated) {
|
||||
if (!isAuthenticated) {
|
||||
syncCompleted(false);
|
||||
callback(false);
|
||||
return;
|
||||
}
|
||||
|
||||
self.userService.getUserId(function (userId) {
|
||||
syncStarted();
|
||||
var now = new Date();
|
||||
var ciphers = self.apiService.getCiphers(function (response) {
|
||||
var sites = {};
|
||||
|
@ -178,6 +180,7 @@ function initSyncService() {
|
|||
}
|
||||
|
||||
function handleError() {
|
||||
syncCompleted(false);
|
||||
// TODO: check for unauth or forbidden and logout
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue