Skip to content

Commit 6d2c63f

Browse files
authored
Don't filter action runs based on state (#24711)
We should just show all runs. This removes the filtering altogether. - Replaces #24553 # Before ![image](https://github.com/go-gitea/gitea/assets/20454870/be4fb69a-ea84-44bb-9606-65a0626be721) ![image](https://github.com/go-gitea/gitea/assets/20454870/68942224-e519-43f1-87fe-f3cffef5879a) # After ![image](https://github.com/go-gitea/gitea/assets/20454870/b3c3b200-ad44-4163-86ec-44a76362eae6) --------- Signed-off-by: Yarden Shoham <[email protected]>
1 parent 5968c63 commit 6d2c63f

File tree

6 files changed

+1
-61
lines changed

6 files changed

+1
-61
lines changed

models/actions/run_list.go

-10
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import (
1010
repo_model "code.gitea.io/gitea/models/repo"
1111
user_model "code.gitea.io/gitea/models/user"
1212
"code.gitea.io/gitea/modules/container"
13-
"code.gitea.io/gitea/modules/util"
1413

1514
"xorm.io/builder"
1615
)
@@ -69,7 +68,6 @@ type FindRunOptions struct {
6968
db.ListOptions
7069
RepoID int64
7170
OwnerID int64
72-
IsClosed util.OptionalBool
7371
WorkflowFileName string
7472
TriggerUserID int64
7573
Approved bool // not util.OptionalBool, it works only when it's true
@@ -83,14 +81,6 @@ func (opts FindRunOptions) toConds() builder.Cond {
8381
if opts.OwnerID > 0 {
8482
cond = cond.And(builder.Eq{"owner_id": opts.OwnerID})
8583
}
86-
if opts.IsClosed.IsFalse() {
87-
cond = cond.And(builder.Eq{"status": StatusWaiting}.Or(
88-
builder.Eq{"status": StatusRunning}))
89-
} else if opts.IsClosed.IsTrue() {
90-
cond = cond.And(
91-
builder.Neq{"status": StatusWaiting}.And(
92-
builder.Neq{"status": StatusRunning}))
93-
}
9484
if opts.WorkflowFileName != "" {
9585
cond = cond.And(builder.Eq{"workflow_id": opts.WorkflowFileName})
9686
}

options/locale/locale_en-US.ini

-2
Original file line numberDiff line numberDiff line change
@@ -3421,8 +3421,6 @@ runners.version = Version
34213421
runners.reset_registration_token_success = Runner registration token reset successfully
34223422
34233423
runs.all_workflows = All Workflows
3424-
runs.open_tab = %d Open
3425-
runs.closed_tab = %d Closed
34263424
runs.commit = Commit
34273425
runs.pushed_by = Pushed by
34283426
runs.invalid_workflow_helper = Workflow config file is invalid. Please check your config file: %s

routers/web/repo/actions/actions.go

-33
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ import (
1616
"code.gitea.io/gitea/modules/context"
1717
"code.gitea.io/gitea/modules/git"
1818
"code.gitea.io/gitea/modules/setting"
19-
"code.gitea.io/gitea/modules/util"
2019
"code.gitea.io/gitea/services/convert"
2120

2221
"github.com/nektos/act/pkg/model"
@@ -138,37 +137,6 @@ func List(ctx *context.Context) {
138137
WorkflowFileName: workflow,
139138
}
140139

141-
// open counts
142-
opts.IsClosed = util.OptionalBoolFalse
143-
numOpenRuns, err := actions_model.CountRuns(ctx, opts)
144-
if err != nil {
145-
ctx.Error(http.StatusInternalServerError, err.Error())
146-
return
147-
}
148-
ctx.Data["NumOpenActionRuns"] = numOpenRuns
149-
150-
// closed counts
151-
opts.IsClosed = util.OptionalBoolTrue
152-
numClosedRuns, err := actions_model.CountRuns(ctx, opts)
153-
if err != nil {
154-
ctx.Error(http.StatusInternalServerError, err.Error())
155-
return
156-
}
157-
ctx.Data["NumClosedActionRuns"] = numClosedRuns
158-
159-
opts.IsClosed = util.OptionalBoolNone
160-
isShowClosed := ctx.FormString("state") == "closed"
161-
if len(ctx.FormString("state")) == 0 && numOpenRuns == 0 && numClosedRuns != 0 {
162-
isShowClosed = true
163-
}
164-
165-
if isShowClosed {
166-
opts.IsClosed = util.OptionalBoolTrue
167-
ctx.Data["IsShowClosed"] = true
168-
} else {
169-
opts.IsClosed = util.OptionalBoolFalse
170-
}
171-
172140
runs, total, err := actions_model.FindRuns(ctx, opts)
173141
if err != nil {
174142
ctx.Error(http.StatusInternalServerError, err.Error())
@@ -189,7 +157,6 @@ func List(ctx *context.Context) {
189157
pager := context.NewPagination(int(total), opts.PageSize, opts.Page, 5)
190158
pager.SetDefaultParams(ctx)
191159
pager.AddParamString("workflow", workflow)
192-
pager.AddParamString("state", ctx.FormString("state"))
193160
ctx.Data["Page"] = pager
194161

195162
ctx.HTML(http.StatusOK, tplListActions)

templates/repo/actions/list.tmpl

-5
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,6 @@
1919
</div>
2020
</div>
2121
<div class="twelve wide column content">
22-
<div class="ui stackable grid">
23-
<div class="six wide column">
24-
{{template "repo/actions/openclose" .}}
25-
</div>
26-
</div>
2722
{{template "repo/actions/runs_list" .}}
2823
</div>
2924
</div>

templates/repo/actions/openclose.tmpl

-10
This file was deleted.

templates/repo/actions/runs_list.tmpl

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<div class="issue list">
1+
<div class="issue list gt-m-0">
22
{{range .Runs}}
33
<li class="item gt-df gt-py-3 gt-ab">
44
<div class="issue-item-left gt-df gt-mr-2">

0 commit comments

Comments
 (0)