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 779B

1234567891011121314151617181920212223242526272829303132
  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. "net/http"
  7. "code.gitea.io/gitea/models"
  8. "code.gitea.io/gitea/modules/context"
  9. )
  10. // TaskStatus returns task's status
  11. func TaskStatus(ctx *context.Context) {
  12. task, opts, err := models.GetMigratingTaskByID(ctx.ParamsInt64("task"), ctx.User.ID)
  13. if err != nil {
  14. ctx.JSON(http.StatusInternalServerError, map[string]interface{}{
  15. "err": err,
  16. })
  17. return
  18. }
  19. ctx.JSON(http.StatusOK, map[string]interface{}{
  20. "status": task.Status,
  21. "err": task.Errors,
  22. "repo-id": task.RepoID,
  23. "repo-name": opts.RepoName,
  24. "start": task.StartTime,
  25. "end": task.EndTime,
  26. })
  27. }