admin: Refactor synchronization status report + display last git error
This commit is contained in:
parent
c1924c0e92
commit
03d02669ea
6 changed files with 81 additions and 49 deletions
|
|
@ -230,9 +230,6 @@ angular.module("FICApp")
|
|||
.factory("File", function ($resource) {
|
||||
return $resource("api/files/:fileId", { fileId: '@id' })
|
||||
})
|
||||
.factory("ROSettings", function ($resource) {
|
||||
return $resource("api/settings-ro.json")
|
||||
})
|
||||
.factory("Settings", function ($resource) {
|
||||
return $resource("api/settings.json", null, {
|
||||
'update': { method: 'PUT' },
|
||||
|
|
@ -787,9 +784,8 @@ angular.module("FICApp")
|
|||
template: `<span class="badge {{ $ctrl.color }}">{{ $ctrl.status.hash }}</span> <small>{{ $ctrl.status.text }}</small>`
|
||||
})
|
||||
|
||||
.controller("SyncController", function ($scope, $rootScope, ROSettings, $location, $http, $interval) {
|
||||
.controller("SyncController", function ($scope, $rootScope, $location, $http, $interval) {
|
||||
$scope.displayDangerousActions = false;
|
||||
$scope.configro = ROSettings.get();
|
||||
|
||||
var needRefreshSyncReportWhenReady = false;
|
||||
var refreshSyncReport = function () {
|
||||
|
|
@ -800,30 +796,28 @@ angular.module("FICApp")
|
|||
};
|
||||
refreshSyncReport()
|
||||
|
||||
$scope.deepSyncInProgress = false;
|
||||
|
||||
var progressInterval = $interval(function () {
|
||||
$http.get("api/sync/deep").then(function (response) {
|
||||
$http.get("api/sync/status").then(function (response) {
|
||||
if (response.data.progress && response.data.progress != 255)
|
||||
needRefreshSyncReportWhenReady = true;
|
||||
else if (needRefreshSyncReportWhenReady)
|
||||
refreshSyncReport();
|
||||
if (response.data && response.data.progress) {
|
||||
$scope.syncPercent = Math.floor(response.data.progress * 100 / 255);
|
||||
$scope.syncProgress = Math.floor(response.data.progress * 100 / 255) + " %";
|
||||
$scope.deepSyncInProgress = response.data.pullMutex && response.data.syncMutex;
|
||||
} else {
|
||||
$scope.syncProgress = response.data;
|
||||
$scope.syncPercent = 0;
|
||||
}
|
||||
$scope.syncStatus = response.data;
|
||||
}, function (response) {
|
||||
$scope.syncPercent = 0;
|
||||
if (response.data && response.data.errmsg)
|
||||
$scope.syncProgress = response.data.errmsg;
|
||||
else
|
||||
$scope.syncProgress = response.data;
|
||||
$scope.syncStatus = response.data;
|
||||
})
|
||||
}, 1500);
|
||||
$scope.$on('$destroy', function () { $interval.cancel(progressInterval); });
|
||||
|
||||
$scope.deepSyncInProgress = false;
|
||||
$scope.deepSync = function (theme) {
|
||||
if (theme) {
|
||||
question = 'Faire une synchronisation intégrale du thème ' + theme.name + ' ?'
|
||||
|
|
|
|||
Reference in a new issue