mirror of
https://github.com/taigrr/wtf
synced 2025-01-18 04:03:14 -08:00
WTF-400 Move jobNameRegex setting into Jenkins settings
This commit is contained in:
commit
2ed3c087b8
@ -2,6 +2,10 @@
|
||||
|
||||
## Unreleased
|
||||
|
||||
### ⚡️ Added
|
||||
|
||||
* Jenkins now supports coloured balls, [#358](https://github.com/wtfutil/wtf/issues/358) by [@rudolphjacksonm](https://github.com/rudolphjacksonm)
|
||||
|
||||
## 0.6.0
|
||||
|
||||
### ⚡️ Added
|
||||
|
@ -13,6 +13,7 @@ type Settings struct {
|
||||
common *cfg.Common
|
||||
|
||||
apiKey string
|
||||
jobNameRegex string
|
||||
successBallColor string
|
||||
url string
|
||||
user string
|
||||
@ -26,6 +27,7 @@ func NewSettingsFromYAML(name string, ymlConfig *config.Config) *Settings {
|
||||
common: cfg.NewCommonSettingsFromYAML(name, configKey, ymlConfig),
|
||||
|
||||
apiKey: localConfig.UString("apiKey", os.Getenv("WTF_JENKINS_API_KEY")),
|
||||
jobNameRegex: localConfig.UString("jobNameRegex", ".*"),
|
||||
successBallColor: localConfig.UString("successBallColor", "blue"),
|
||||
url: localConfig.UString("url"),
|
||||
user: localConfig.UString("user"),
|
||||
|
@ -7,6 +7,7 @@ import (
|
||||
"github.com/gdamore/tcell"
|
||||
"github.com/rivo/tview"
|
||||
"github.com/wtfutil/wtf/wtf"
|
||||
"regexp"
|
||||
)
|
||||
|
||||
const HelpText = `
|
||||
@ -91,15 +92,19 @@ func (widget *Widget) display() {
|
||||
func (widget *Widget) contentFrom(view *View) string {
|
||||
var str string
|
||||
for idx, job := range view.Jobs {
|
||||
str = str + fmt.Sprintf(
|
||||
`["%d"][""][%s] [%s]%-6s[white]`,
|
||||
idx,
|
||||
widget.rowColor(idx),
|
||||
widget.jobColor(&job),
|
||||
job.Name,
|
||||
)
|
||||
var validID = regexp.MustCompile(widget.settings.jobNameRegex)
|
||||
|
||||
str = str + "\n"
|
||||
if validID.MatchString(job.Name) {
|
||||
str = str + fmt.Sprintf(
|
||||
`["%d"][""][%s] [%s]%-6s[white]`,
|
||||
idx,
|
||||
widget.rowColor(idx),
|
||||
widget.jobColor(&job),
|
||||
job.Name,
|
||||
)
|
||||
|
||||
str = str + "\n"
|
||||
}
|
||||
}
|
||||
|
||||
return str
|
||||
|
Loading…
x
Reference in New Issue
Block a user