From a4c87b92a52e95ab245573dcaea65032edd81d2c Mon Sep 17 00:00:00 2001 From: Pierre-Olivier Mercier Date: Mon, 20 Jan 2020 08:41:36 +0100 Subject: [PATCH] admin: introducing speedy deep sync and themed deep sync --- admin/api/theme.go | 13 +++ admin/static/check_import.html | 4 +- admin/static/js/app.js | 26 +++++- admin/static/views/settings.html | 11 ++- admin/sync/full.go | 147 +++++++++++++++++++++++++------ 5 files changed, 170 insertions(+), 31 deletions(-) diff --git a/admin/api/theme.go b/admin/api/theme.go index 3caf2e98..97832c77 100644 --- a/admin/api/theme.go +++ b/admin/api/theme.go @@ -52,10 +52,23 @@ func init() { return map[string]interface{}{"progress": sync.DeepSyncProgress}, nil } })) + router.POST("/api/sync/speed", apiHandler( + func(_ httprouter.Params, _ []byte) (interface{}, error) { + st := sync.SpeedySyncDeep(sync.GlobalImporter) + sync.EditDeepReport(st, false) + return st, nil + })) router.POST("/api/sync/deep", apiHandler( func(_ httprouter.Params, _ []byte) (interface{}, error) { return sync.SyncDeep(sync.GlobalImporter), nil })) + router.POST("/api/sync/deep/:thid", apiHandler(themeHandler( + func(theme fic.Theme, _ []byte) (interface{}, error) { + st := sync.SyncThemeDeep(sync.GlobalImporter, theme, 0, 250) + sync.EditDeepReport(map[string][]string{theme.Name: st}, false) + sync.DeepSyncProgress = 255 + return st, nil + }))) router.POST("/api/sync/themes", apiHandler( func(_ httprouter.Params, _ []byte) (interface{}, error) { return sync.SyncThemes(sync.GlobalImporter), nil diff --git a/admin/static/check_import.html b/admin/static/check_import.html index 25787ade..f6720e61 100644 --- a/admin/static/check_import.html +++ b/admin/static/check_import.html @@ -8,8 +8,8 @@