From db7e4b960cc35bfe78b73148408c1fa36022706c Mon Sep 17 00:00:00 2001 From: Jack Morris Date: Mon, 15 Apr 2019 12:06:37 +0100 Subject: [PATCH 1/2] Jenkins Green Balls Plugin Support Adds support for a 'greenBalls' boolean parameter in the config file which overrides the default value of "blue" with "green". --- modules/jenkins/widget.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/modules/jenkins/widget.go b/modules/jenkins/widget.go index 23e6d16e6..707d0b806 100644 --- a/modules/jenkins/widget.go +++ b/modules/jenkins/widget.go @@ -120,7 +120,12 @@ func (widget *Widget) rowColor(idx int) string { func (widget *Widget) jobColor(job *Job) string { switch job.Color { case "blue": - return "blue" + // Override color if greenBalls boolean param provided in config + if wtf.Config.UString("wtf.mods.jenkins.greenBalls") == "true" { + return "green" + } else { + return "blue" + } case "red": return "red" default: From 58228834fc2aa12643dedf73168e48b688b44d4a Mon Sep 17 00:00:00 2001 From: Jack Morris Date: Mon, 15 Apr 2019 17:03:49 +0100 Subject: [PATCH 2/2] Allow users to choose color Change boolean in config yaml to 'successBallColor' which allows users to choose their own if they wish --- modules/jenkins/widget.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/modules/jenkins/widget.go b/modules/jenkins/widget.go index 707d0b806..c44467446 100644 --- a/modules/jenkins/widget.go +++ b/modules/jenkins/widget.go @@ -120,9 +120,10 @@ func (widget *Widget) rowColor(idx int) string { func (widget *Widget) jobColor(job *Job) string { switch job.Color { case "blue": - // Override color if greenBalls boolean param provided in config - if wtf.Config.UString("wtf.mods.jenkins.greenBalls") == "true" { - return "green" + // Override color if successBallColor boolean param provided in config + ballColor := wtf.Config.UString("wtf.mods.jenkins.successBallColor", "blue") + if ballColor != "blue" { + return ballColor } else { return "blue" }