You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

task.go 729B

123456789101112131415161718192021222324252627282930
  1. // Copyright 2020 The Gitea Authors. All rights reserved.
  2. // Use of this source code is governed by a MIT-style
  3. // license that can be found in the LICENSE file.
  4. package user
  5. import (
  6. "code.gitea.io/gitea/models"
  7. "code.gitea.io/gitea/modules/context"
  8. )
  9. // TaskStatus returns task's status
  10. func TaskStatus(ctx *context.Context) {
  11. task, opts, err := models.GetMigratingTaskByID(ctx.ParamsInt64("task"), ctx.User.ID)
  12. if err != nil {
  13. ctx.JSON(500, map[string]interface{}{
  14. "err": err,
  15. })
  16. return
  17. }
  18. ctx.JSON(200, map[string]interface{}{
  19. "status": task.Status,
  20. "err": task.Errors,
  21. "repo-id": task.RepoID,
  22. "repo-name": opts.RepoName,
  23. "start": task.StartTime,
  24. "end": task.EndTime,
  25. })
  26. }