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
|
@ -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
|
||||
|
|
Reference in a new issue