admin: add a progression indicator for the deep synchronization

This commit is contained in:
nemunaire 2019-01-18 15:39:58 +01:00
parent d9fb261232
commit 7227c7109e
4 changed files with 43 additions and 3 deletions

View file

@ -44,6 +44,14 @@ func init() {
router.GET("/api/remote/themes/:thid/exercices", apiHandler(themeHandler(sync.ApiListRemoteExercices)))
// Synchronize
router.GET("/api/sync/deep", apiHandler(
func(_ httprouter.Params, _ []byte) (interface{}, error) {
if sync.DeepSyncProgress == 0 {
return nil, errors.New("Pas de synchronisation en cours")
} else {
return map[string]interface{}{"progress": sync.DeepSyncProgress}, nil
}
}))
router.POST("/api/sync/deep", apiHandler(
func(_ httprouter.Params, _ []byte) (interface{}, error) {
return sync.SyncDeep(sync.GlobalImporter), nil