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