mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-06-02 12:52:12 +00:00
Don't filter action runs based on state (#24711)
We should just show all runs. This removes the filtering altogether. - Replaces https://github.com/go-gitea/gitea/pull/24553 # Before   # After  --------- Signed-off-by: Yarden Shoham <git@yardenshoham.com>
This commit is contained in:
parent
5968c63a11
commit
6d2c63f6ff
6 changed files with 1 additions and 61 deletions
|
@ -16,7 +16,6 @@ import (
|
|||
"code.gitea.io/gitea/modules/context"
|
||||
"code.gitea.io/gitea/modules/git"
|
||||
"code.gitea.io/gitea/modules/setting"
|
||||
"code.gitea.io/gitea/modules/util"
|
||||
"code.gitea.io/gitea/services/convert"
|
||||
|
||||
"github.com/nektos/act/pkg/model"
|
||||
|
@ -138,37 +137,6 @@ func List(ctx *context.Context) {
|
|||
WorkflowFileName: workflow,
|
||||
}
|
||||
|
||||
// open counts
|
||||
opts.IsClosed = util.OptionalBoolFalse
|
||||
numOpenRuns, err := actions_model.CountRuns(ctx, opts)
|
||||
if err != nil {
|
||||
ctx.Error(http.StatusInternalServerError, err.Error())
|
||||
return
|
||||
}
|
||||
ctx.Data["NumOpenActionRuns"] = numOpenRuns
|
||||
|
||||
// closed counts
|
||||
opts.IsClosed = util.OptionalBoolTrue
|
||||
numClosedRuns, err := actions_model.CountRuns(ctx, opts)
|
||||
if err != nil {
|
||||
ctx.Error(http.StatusInternalServerError, err.Error())
|
||||
return
|
||||
}
|
||||
ctx.Data["NumClosedActionRuns"] = numClosedRuns
|
||||
|
||||
opts.IsClosed = util.OptionalBoolNone
|
||||
isShowClosed := ctx.FormString("state") == "closed"
|
||||
if len(ctx.FormString("state")) == 0 && numOpenRuns == 0 && numClosedRuns != 0 {
|
||||
isShowClosed = true
|
||||
}
|
||||
|
||||
if isShowClosed {
|
||||
opts.IsClosed = util.OptionalBoolTrue
|
||||
ctx.Data["IsShowClosed"] = true
|
||||
} else {
|
||||
opts.IsClosed = util.OptionalBoolFalse
|
||||
}
|
||||
|
||||
runs, total, err := actions_model.FindRuns(ctx, opts)
|
||||
if err != nil {
|
||||
ctx.Error(http.StatusInternalServerError, err.Error())
|
||||
|
@ -189,7 +157,6 @@ func List(ctx *context.Context) {
|
|||
pager := context.NewPagination(int(total), opts.PageSize, opts.Page, 5)
|
||||
pager.SetDefaultParams(ctx)
|
||||
pager.AddParamString("workflow", workflow)
|
||||
pager.AddParamString("state", ctx.FormString("state"))
|
||||
ctx.Data["Page"] = pager
|
||||
|
||||
ctx.HTML(http.StatusOK, tplListActions)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue