diff options
author | Kerwin Bryant <kerwin612@qq.com> | 2023-08-04 10:21:32 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-08-04 10:21:32 +0800 |
commit | 865d2221c0f4b2a8623ff9299930c9bab0da2c78 (patch) | |
tree | d399ccbbee5a91be67f9d955e1f2845c9341cf76 /routers/web | |
parent | 907bedaad0301730ee2fbab1f18b54b155dad088 (diff) | |
download | gitea-865d2221c0f4b2a8623ff9299930c9bab0da2c78.tar.gz gitea-865d2221c0f4b2a8623ff9299930c9bab0da2c78.zip |
Add `Retry` button when creating a mirror-repo fails (#26228)
fixed #26156
* Added a retry button in the frontend (only displayed when the status
is abnormal)
* After clicking Retry, the backend adds the task back to the task queue
![7UJDNM671RI})EA8~~XPL39](https://github.com/go-gitea/gitea/assets/3371163/e088fd63-5dcc-4bc6-8849-7db3086511b7)
![T83F1WL9)VGHR@MB956$VT9](https://github.com/go-gitea/gitea/assets/3371163/744425bb-dde1-4315-be2e-5c99ac3a44d4)
---------
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Diffstat (limited to 'routers/web')
-rw-r--r-- | routers/web/repo/migrate.go | 9 | ||||
-rw-r--r-- | routers/web/web.go | 6 |
2 files changed, 14 insertions, 1 deletions
diff --git a/routers/web/repo/migrate.go b/routers/web/repo/migrate.go index b918650d1d..a6125a1a58 100644 --- a/routers/web/repo/migrate.go +++ b/routers/web/repo/migrate.go @@ -259,6 +259,15 @@ func setMigrationContextData(ctx *context.Context, serviceType structs.GitServic ctx.Data["service"] = serviceType } +func MigrateRetryPost(ctx *context.Context) { + if err := task.RetryMigrateTask(ctx.Repo.Repository.ID); err != nil { + log.Error("Retry task failed: %v", err) + ctx.ServerError("task.RetryMigrateTask", err) + return + } + ctx.JSONOK() +} + func MigrateCancelPost(ctx *context.Context) { migratingTask, err := admin_model.GetMigratingTask(ctx.Repo.Repository.ID) if err != nil { diff --git a/routers/web/web.go b/routers/web/web.go index ca75bd5967..aa3d830f94 100644 --- a/routers/web/web.go +++ b/routers/web/web.go @@ -953,7 +953,11 @@ func registerRoutes(m *web.Route) { addSettingsSecretsRoutes() addSettingVariablesRoutes() }, actions.MustEnableActions) - m.Post("/migrate/cancel", repo.MigrateCancelPost) // this handler must be under "settings", otherwise this incomplete repo can't be accessed + // the follow handler must be under "settings", otherwise this incomplete repo can't be accessed + m.Group("/migrate", func() { + m.Post("/retry", repo.MigrateRetryPost) + m.Post("/cancel", repo.MigrateCancelPost) + }) }, ctxDataSet("PageIsRepoSettings", true, "LFSStartServer", setting.LFS.StartServer)) }, reqSignIn, context.RepoAssignment, context.UnitTypes(), reqRepoAdmin, context.RepoRef()) |