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

![image](be4fb69a-ea84-44bb-9606-65a0626be721)

![image](68942224-e519-43f1-87fe-f3cffef5879a)

# After

![image](b3c3b200-ad44-4163-86ec-44a76362eae6)

---------

Signed-off-by: Yarden Shoham <git@yardenshoham.com>
This commit is contained in:
Yarden Shoham 2023-05-14 19:04:24 +03:00 committed by GitHub
parent 5968c63a11
commit 6d2c63f6ff
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 1 additions and 61 deletions

View file

@ -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)