admin: introducing speedy deep sync and themed deep sync

This commit is contained in:
nemunaire 2020-01-20 08:41:36 +01:00
commit a4c87b92a5
5 changed files with 159 additions and 20 deletions

View file

@ -8,8 +8,8 @@
</style>
<script type="text/javascript">
function disp(data) {
if (data["_date"] && data["_date"].length == 2) {
document.getElementById("date_imp").innerHTML = data["_date"][1];
if (data["_date"]) {
document.getElementById("date_imp").innerHTML = data["_date"][data["_date"].length - 1];
}
Object.keys(data).map(function(theme) {
if (data[theme] != null && theme != "_date") {

View file

@ -554,11 +554,18 @@ angular.module("FICApp")
});
};
$scope.deepSyncInProgress = false;
$scope.deepSync = function(type) {
$rootScope.newYesNoBox('warning', 'Faire une synchronisation intégrale ?', '',
$scope.deepSync = function(theme) {
if (theme) {
question = 'Faire une synchronisation intégrale du thème ' + theme.name + ' ?'
url = "/api/sync/deep/" + theme.id
} else {
question = 'Faire une synchronisation intégrale ?'
url = "/api/sync/deep"
}
$rootScope.newYesNoBox('warning', question, '',
function() {
$scope.deepSyncInProgress = true;
$http.post("/api/sync/deep").then(function() {
$http.post(url).then(function() {
$scope.deepSyncInProgress = false;
$rootScope.newBox('success', 'Synchronisation intégrale terminée.', '<a href="check_import.html">Voir le rapport</a>.', 15000);
}, function(response) {
@ -567,6 +574,19 @@ angular.module("FICApp")
});
});
};
$scope.speedyDeepSync = function() {
$rootScope.newYesNoBox('warning', 'Faire une synchronisation profonde rapide, sans s\'occuper des fichiers ?', '',
function() {
$scope.deepSyncInProgress = true;
$http.post("/api/sync/speed").then(function() {
$scope.deepSyncInProgress = false;
$rootScope.newBox('success', 'Synchronisation profonde rapide terminée.', '<a href="check_import.html">Voir le rapport</a>.', 15000);
}, function(response) {
$scope.deepSyncInProgress = false;
$rootScope.newBox('warning', 'Synchronisation profinde rapide terminée.', '<a href="check_import.html">Voir le rapport</a>.', 15000);
});
});
};
})
.controller("PKIController", function($scope, $rootScope, Certificate, CACertificate, Team, $location, $http) {

View file

@ -204,7 +204,16 @@
Dernier import&nbsp;: {{ syncReport._date[1] }}
</div>
<div class="text-left" ng-if="configro.sync">
<button type="button" class="btn btn-secondary" ng-click="deepSync()" ng-disabled="deepSyncInProgress"><span class="glyphicon glyphicon-import" aria-hidden="true"></span> Synchronisation intégrale</button>
<div class="btn-group">
<button type="button" class="btn btn-secondary" ng-click="deepSync()" ng-disabled="deepSyncInProgress"><span class="glyphicon glyphicon-import" aria-hidden="true"></span> Synchronisation intégrale</button>
<button type="button" class="btn btn-secondary dropdown-toggle dropdown-toggle-split" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" ng-disabled="deepSyncInProgress">
<span class="sr-only">Toggle Dropdown</span>
</button>
<div class="dropdown-menu" ng-controller="ThemesListController">
<a class="dropdown-item" ng-click="deepSync(theme)" ng-repeat="theme in themes" ng-bind="theme.name"></a>
</div>
</div>
<button type="button" class="btn btn-secondary" ng-click="speedyDeepSync()" ng-disabled="deepSyncInProgress"><span class="glyphicon glyphicon-import" aria-hidden="true"></span> Synchronisation sans fichiers</button>
<a href="check_import.html" class="btn btn-success" target="_self" ng-if="syncReport">Voir le rapport</a>
</div>
</div>