improve UI

This commit is contained in:
Lunny Xiao
2022-10-19 18:19:57 +08:00
committed by Jason Song
parent dcc552011e
commit 57cc7bf823
3 changed files with 60 additions and 30 deletions

View File

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