diff --git a/models/bots/status.go b/models/bots/status.go index 68cdc2e6b5..b80df074ee 100644 --- a/models/bots/status.go +++ b/models/bots/status.go @@ -27,6 +27,30 @@ func (s Status) IsDone() bool { return s > StatusUnknown && s <= StatusSkipped } +func (s Status) IsSuccess() bool { + return s == StatusSuccess +} + +func (s Status) IsFailure() bool { + return s == StatusFailure +} + +func (s Status) IsCancelled() bool { + return s == StatusCancelled +} + +func (s Status) IsSkipped() bool { + return s == StatusSkipped +} + +func (s Status) IsWaiting() bool { + return s == StatusWaiting +} + +func (s Status) IsRunning() bool { + return s == StatusRunning +} + var statusNames = map[Status]string{ StatusUnknown: "unknown", StatusWaiting: "waiting", diff --git a/templates/repo/builds/status.tmpl b/templates/repo/builds/status.tmpl index 454c951eb1..fd8a683bda 100644 --- a/templates/repo/builds/status.tmpl +++ b/templates/repo/builds/status.tmpl @@ -1,4 +1,4 @@ -{{if .IsPending}} +{{if .IsWaiting}} {{end}} {{if .IsRunning}} @@ -7,6 +7,6 @@ {{if .IsSuccess}} {{end}} -{{if .IsFailed}} +{{if .IsFailure}} {{end}}