|
|
|
@ -5,6 +5,7 @@ package actions
|
|
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
import (
|
|
|
|
"bytes"
|
|
|
|
"bytes"
|
|
|
|
|
|
|
|
"fmt"
|
|
|
|
"net/http"
|
|
|
|
"net/http"
|
|
|
|
|
|
|
|
|
|
|
|
actions_model "code.gitea.io/gitea/models/actions"
|
|
|
|
actions_model "code.gitea.io/gitea/models/actions"
|
|
|
|
@ -16,6 +17,7 @@ import (
|
|
|
|
"code.gitea.io/gitea/modules/context"
|
|
|
|
"code.gitea.io/gitea/modules/context"
|
|
|
|
"code.gitea.io/gitea/modules/git"
|
|
|
|
"code.gitea.io/gitea/modules/git"
|
|
|
|
"code.gitea.io/gitea/modules/setting"
|
|
|
|
"code.gitea.io/gitea/modules/setting"
|
|
|
|
|
|
|
|
"code.gitea.io/gitea/routers/web/repo"
|
|
|
|
"code.gitea.io/gitea/services/convert"
|
|
|
|
"code.gitea.io/gitea/services/convert"
|
|
|
|
|
|
|
|
|
|
|
|
"github.com/nektos/act/pkg/model"
|
|
|
|
"github.com/nektos/act/pkg/model"
|
|
|
|
@ -125,7 +127,16 @@ func List(ctx *context.Context) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
workflow := ctx.FormString("workflow")
|
|
|
|
workflow := ctx.FormString("workflow")
|
|
|
|
|
|
|
|
actorID := ctx.FormInt64("actor")
|
|
|
|
|
|
|
|
status := ctx.FormInt("status")
|
|
|
|
ctx.Data["CurWorkflow"] = workflow
|
|
|
|
ctx.Data["CurWorkflow"] = workflow
|
|
|
|
|
|
|
|
// if status or actor query param is not given to frontend href, (href="/<repoLink>/actions")
|
|
|
|
|
|
|
|
// they will be 0 by default, which indicates get all status or actors
|
|
|
|
|
|
|
|
ctx.Data["CurActor"] = actorID
|
|
|
|
|
|
|
|
ctx.Data["CurStatus"] = status
|
|
|
|
|
|
|
|
if actorID > 0 || status > int(actions_model.StatusUnknown) {
|
|
|
|
|
|
|
|
ctx.Data["IsFiltered"] = true
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
opts := actions_model.FindRunOptions{
|
|
|
|
opts := actions_model.FindRunOptions{
|
|
|
|
ListOptions: db.ListOptions{
|
|
|
|
ListOptions: db.ListOptions{
|
|
|
|
@ -134,6 +145,8 @@ func List(ctx *context.Context) {
|
|
|
|
},
|
|
|
|
},
|
|
|
|
RepoID: ctx.Repo.Repository.ID,
|
|
|
|
RepoID: ctx.Repo.Repository.ID,
|
|
|
|
WorkflowFileName: workflow,
|
|
|
|
WorkflowFileName: workflow,
|
|
|
|
|
|
|
|
TriggerUserID: actorID,
|
|
|
|
|
|
|
|
Status: actions_model.Status(status),
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
runs, total, err := actions_model.FindRuns(ctx, opts)
|
|
|
|
runs, total, err := actions_model.FindRuns(ctx, opts)
|
|
|
|
@ -153,9 +166,20 @@ func List(ctx *context.Context) {
|
|
|
|
|
|
|
|
|
|
|
|
ctx.Data["Runs"] = runs
|
|
|
|
ctx.Data["Runs"] = runs
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
actors, err := actions_model.GetActors(ctx, ctx.Repo.Repository.ID)
|
|
|
|
|
|
|
|
if err != nil {
|
|
|
|
|
|
|
|
ctx.Error(http.StatusInternalServerError, err.Error())
|
|
|
|
|
|
|
|
return
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
ctx.Data["Actors"] = repo.MakeSelfOnTop(ctx, actors)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ctx.Data["StatusInfoList"] = actions_model.GetStatusInfoList(ctx)
|
|
|
|
|
|
|
|
|
|
|
|
pager := context.NewPagination(int(total), opts.PageSize, opts.Page, 5)
|
|
|
|
pager := context.NewPagination(int(total), opts.PageSize, opts.Page, 5)
|
|
|
|
pager.SetDefaultParams(ctx)
|
|
|
|
pager.SetDefaultParams(ctx)
|
|
|
|
pager.AddParamString("workflow", workflow)
|
|
|
|
pager.AddParamString("workflow", workflow)
|
|
|
|
|
|
|
|
pager.AddParamString("actor", fmt.Sprint(actorID))
|
|
|
|
|
|
|
|
pager.AddParamString("status", fmt.Sprint(status))
|
|
|
|
ctx.Data["Page"] = pager
|
|
|
|
ctx.Data["Page"] = pager
|
|
|
|
|
|
|
|
|
|
|
|
ctx.HTML(http.StatusOK, tplListActions)
|
|
|
|
ctx.HTML(http.StatusOK, tplListActions)
|
|
|
|
|