diff --git a/models/bots/run.go b/models/bots/run.go index ed8bfdd711..8a5c5efc15 100644 --- a/models/bots/run.go +++ b/models/bots/run.go @@ -56,6 +56,27 @@ func (run *Run) HTMLURL() string { 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 func (r *Run) LoadAttributes(ctx context.Context) error { if r == nil { diff --git a/templates/repo/builds/list.tmpl b/templates/repo/builds/list.tmpl index c0de57e7b3..603e07866e 100644 --- a/templates/repo/builds/list.tmpl +++ b/templates/repo/builds/list.tmpl @@ -1,40 +1,49 @@ {{template "base/head" .}}
{{template "repo/header" .}} -
- {{range .workflows}} -
  • {{.Name}}
  • - {{end}} -
    +
    -
    -
    - {{template "repo/builds/openclose" .}} -
    -
    -
    -
    - {{template "repo/builds/openclose" .}} -
    -
    - {{/* Ten wide does not cope well and makes the columns stack. - This seems to be related to jQuery's hide/show: in fact, switching - issue-actions and issue-filters and having this ten wide will show - this one correctly, but not the other one. */}} -
    -
    {{template "base/footer" .}} diff --git a/templates/repo/header.tmpl b/templates/repo/header.tmpl index f950cda65f..ca920f26b4 100644 --- a/templates/repo/header.tmpl +++ b/templates/repo/header.tmpl @@ -185,7 +185,7 @@ {{ if and (not .UnitBuildsGlobalDisabled) (.Permission.CanRead $.UnitTypeBuilds)}} - {{svg "octicon-git-builds"}} {{.locale.Tr "repo.builds"}} + {{svg "octicon-play"}} {{.locale.Tr "repo.builds"}} {{if .Repository.NumOpenRuns}} {{CountFmt .Repository.NumOpenRuns}} {{end}}