func addJob(list *ui.List, job *gojenkins.Job, redbox *ui.Par, yellowbox *ui.Par, greenbox *ui.Par) { if filterBuildName == nil || (filterBuildName != nil && filterBuildName.MatchString(job.GetName())) { str := job.GetName() lastBuild, _ := job.GetLastBuild() if lastBuild != nil { isRunning, _ := job.IsRunning() if isRunning { str = "...building " + str } str += " " + " " + lastBuild.GetResult() switch lastBuild.GetResult() { case "SUCCESS": greenbox.BgColor = ui.ColorGreen case "UNSTABLE": yellowbox.BgColor = ui.ColorYellow case "FAILURE": redbox.BgColor = ui.ColorRed } } list.Items = append(list.Items, str) } }
func resetBox(infobox *ui.Par, redbox *ui.Par, yellowbox *ui.Par, greenbox *ui.Par) { redbox.BgColor = ui.ColorBlack yellowbox.BgColor = ui.ColorBlack greenbox.BgColor = ui.ColorBlack }