admin: add a progression indicator for the deep synchronization
This commit is contained in:
parent
d9fb261232
commit
7227c7109e
4 changed files with 43 additions and 3 deletions
|
@ -422,7 +422,7 @@ angular.module("FICApp")
|
|||
$interval(updBox, 750);
|
||||
})
|
||||
|
||||
.controller("SettingsController", function($scope, $rootScope, Settings, ROSettings, $location, $http) {
|
||||
.controller("SettingsController", function($scope, $rootScope, Settings, ROSettings, $location, $http, $interval) {
|
||||
$scope.config = Settings.get();
|
||||
$scope.config.$promise.then(function(response) {
|
||||
$rootScope.settings.start = new Date(response.start);
|
||||
|
@ -433,6 +433,21 @@ angular.module("FICApp")
|
|||
$scope.configro = ROSettings.get();
|
||||
$scope.duration = 240;
|
||||
|
||||
var progressInterval = $interval(function() {
|
||||
$http.get("/api/sync/deep").then(function(response) {
|
||||
if (response.data && response.data.progress)
|
||||
$scope.syncProgress = Math.floor(response.data.progress * 100 / 255) + " %";
|
||||
else
|
||||
$scope.syncProgress = response.data;
|
||||
}, function(response) {
|
||||
if (response.data && response.data.errmsg)
|
||||
$scope.syncProgress = response.data.errmsg;
|
||||
else
|
||||
$scope.syncProgress = response.data;
|
||||
})
|
||||
}, 1500);
|
||||
$scope.$on('$destroy', function () { $interval.cancel(progressInterval); });
|
||||
|
||||
$scope.saveSettings = function(msg) {
|
||||
if (msg === undefined) { msg = 'New settings saved!'; }
|
||||
var nStart = this.config.start;
|
||||
|
|
Reference in a new issue