mirror of
https://github.com/go-gitea/gitea.git
synced 2025-07-23 05:46:09 +02:00
UI improvement
This commit is contained in:
parent
7c40b1ee8d
commit
d69423a3b0
@ -56,27 +56,6 @@ func (run *Run) HTMLURL() string {
|
|||||||
return fmt.Sprintf("%s/builds/run/%d", run.Repo.HTMLURL(), run.Index)
|
return fmt.Sprintf("%s/builds/run/%d", run.Repo.HTMLURL(), run.Index)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (run *Run) IsPending() bool {
|
|
||||||
return run.Status == core.StatusWaiting || run.Status == core.StatusPending
|
|
||||||
}
|
|
||||||
|
|
||||||
func (run *Run) IsRunning() bool {
|
|
||||||
return run.Status == core.StatusRunning
|
|
||||||
}
|
|
||||||
|
|
||||||
func (run *Run) IsSuccess() bool {
|
|
||||||
return run.Status == core.StatusPassing
|
|
||||||
}
|
|
||||||
|
|
||||||
func (run *Run) IsFailed() bool {
|
|
||||||
return run.Status == core.StatusFailing ||
|
|
||||||
run.Status == core.StatusKilled ||
|
|
||||||
run.Status == core.StatusError ||
|
|
||||||
run.Status == core.StatusSkipped ||
|
|
||||||
run.Status == core.StatusBlocked ||
|
|
||||||
run.Status == core.StatusDeclined
|
|
||||||
}
|
|
||||||
|
|
||||||
// LoadAttributes load Repo TriggerUser if not loaded
|
// LoadAttributes load Repo TriggerUser if not loaded
|
||||||
func (r *Run) LoadAttributes(ctx context.Context) error {
|
func (r *Run) LoadAttributes(ctx context.Context) error {
|
||||||
if r == nil {
|
if r == nil {
|
||||||
|
@ -7,6 +7,7 @@ package bots
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
|
||||||
|
"code.gitea.io/gitea/core"
|
||||||
"code.gitea.io/gitea/models/db"
|
"code.gitea.io/gitea/models/db"
|
||||||
user_model "code.gitea.io/gitea/models/user"
|
user_model "code.gitea.io/gitea/models/user"
|
||||||
"code.gitea.io/gitea/modules/util"
|
"code.gitea.io/gitea/modules/util"
|
||||||
@ -42,8 +43,9 @@ func (runs RunList) LoadTriggerUser() error {
|
|||||||
|
|
||||||
type FindRunOptions struct {
|
type FindRunOptions struct {
|
||||||
db.ListOptions
|
db.ListOptions
|
||||||
RepoID int64
|
RepoID int64
|
||||||
IsClosed util.OptionalBool
|
IsClosed util.OptionalBool
|
||||||
|
WorkflowFileName string
|
||||||
}
|
}
|
||||||
|
|
||||||
func (opts FindRunOptions) toConds() builder.Cond {
|
func (opts FindRunOptions) toConds() builder.Cond {
|
||||||
@ -52,7 +54,16 @@ func (opts FindRunOptions) toConds() builder.Cond {
|
|||||||
cond = cond.And(builder.Eq{"repo_id": opts.RepoID})
|
cond = cond.And(builder.Eq{"repo_id": opts.RepoID})
|
||||||
}
|
}
|
||||||
if opts.IsClosed.IsFalse() {
|
if opts.IsClosed.IsFalse() {
|
||||||
|
cond = cond.And(builder.Eq{"status": core.StatusPending}.Or(
|
||||||
|
builder.Eq{"status": core.StatusWaiting}.Or(
|
||||||
|
builder.Eq{"status": core.StatusRunning})))
|
||||||
} else if opts.IsClosed.IsTrue() {
|
} else if opts.IsClosed.IsTrue() {
|
||||||
|
cond = cond.And(builder.Neq{"status": core.StatusPending}.And(
|
||||||
|
builder.Neq{"status": core.StatusWaiting}.And(
|
||||||
|
builder.Neq{"status": core.StatusRunning})))
|
||||||
|
}
|
||||||
|
if opts.WorkflowFileName != "" {
|
||||||
|
cond = cond.And(builder.Eq{"workflow_id": opts.WorkflowFileName})
|
||||||
}
|
}
|
||||||
return cond
|
return cond
|
||||||
}
|
}
|
||||||
@ -63,6 +74,6 @@ func FindRuns(ctx context.Context, opts FindRunOptions) (RunList, int64, error)
|
|||||||
e.Limit(opts.PageSize, (opts.Page-1)*opts.PageSize)
|
e.Limit(opts.PageSize, (opts.Page-1)*opts.PageSize)
|
||||||
}
|
}
|
||||||
var runs RunList
|
var runs RunList
|
||||||
total, err := e.FindAndCount(&runs)
|
total, err := e.Desc("id").FindAndCount(&runs)
|
||||||
return runs, total, err
|
return runs, total, err
|
||||||
}
|
}
|
||||||
|
@ -1222,6 +1222,8 @@ projects.board.assigned_to = Assigned to
|
|||||||
builds = Builds
|
builds = Builds
|
||||||
builds.desc = Manage builds
|
builds.desc = Manage builds
|
||||||
builds.opened_by = opened %[1]s by %[2]s
|
builds.opened_by = opened %[1]s by %[2]s
|
||||||
|
builds.open_tab = %d Open
|
||||||
|
builds.closed_tab = %d Closed
|
||||||
|
|
||||||
issues.desc = Organize bug reports, tasks and milestones.
|
issues.desc = Organize bug reports, tasks and milestones.
|
||||||
issues.filter_assignees = Filter Assignee
|
issues.filter_assignees = Filter Assignee
|
||||||
|
@ -70,7 +70,8 @@ func List(ctx *context.Context) {
|
|||||||
Page: page,
|
Page: page,
|
||||||
PageSize: convert.ToCorrectPageSize(ctx.FormInt("limit")),
|
PageSize: convert.ToCorrectPageSize(ctx.FormInt("limit")),
|
||||||
},
|
},
|
||||||
RepoID: ctx.Repo.Repository.ID,
|
RepoID: ctx.Repo.Repository.ID,
|
||||||
|
WorkflowFileName: ctx.FormString("workflow"),
|
||||||
}
|
}
|
||||||
if ctx.FormString("state") == "closed" {
|
if ctx.FormString("state") == "closed" {
|
||||||
opts.IsClosed = util.OptionalBoolTrue
|
opts.IsClosed = util.OptionalBoolTrue
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
<div class="ui compact tiny menu">
|
<div class="ui compact tiny menu">
|
||||||
<a class="{{if not .IsShowClosed}}active{{end}} item" href="{{$.Link}}?q={{$.Keyword}}&type={{$.ViewType}}&sort={{$.SortType}}&state=open&labels={{.SelectLabels}}&milestone={{.MilestoneID}}&assignee={{.AssigneeID}}">
|
<a class="{{if not .IsShowClosed}}active{{end}} item" href="{{$.Link}}?q={{$.Keyword}}&type={{$.ViewType}}&sort={{$.SortType}}&state=open&labels={{.SelectLabels}}&milestone={{.MilestoneID}}&assignee={{.AssigneeID}}">
|
||||||
{{svg "octicon-issue-opened" 16 "mr-3"}}
|
{{svg "octicon-issue-opened" 16 "mr-3"}}
|
||||||
{{.locale.Tr "repo.issues.open_tab" .Repository.NumOpenRuns}}
|
{{.locale.Tr "repo.builds.open_tab" .Repository.NumOpenRuns}}
|
||||||
</a>
|
</a>
|
||||||
<a class="{{if .IsShowClosed}}active{{end}} item" href="{{$.Link}}?q={{$.Keyword}}&type={{.ViewType}}&sort={{$.SortType}}&state=closed&labels={{.SelectLabels}}&milestone={{.MilestoneID}}&assignee={{.AssigneeID}}">
|
<a class="{{if .IsShowClosed}}active{{end}} item" href="{{$.Link}}?q={{$.Keyword}}&type={{.ViewType}}&sort={{$.SortType}}&state=closed&labels={{.SelectLabels}}&milestone={{.MilestoneID}}&assignee={{.AssigneeID}}">
|
||||||
{{svg "octicon-issue-closed" 16 "mr-3"}}
|
{{svg "octicon-issue-closed" 16 "mr-3"}}
|
||||||
{{.locale.Tr "repo.issues.close_tab" .Repository.NumClosedRuns}}
|
{{.locale.Tr "repo.builds.closed_tab" .Repository.NumClosedRuns}}
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user