mirror of
https://github.com/taigrr/wtf
synced 2025-01-18 04:03:14 -08:00
WTF-400 Fix missed wtf.Config occurrances
This commit is contained in:
parent
6f98ecccf7
commit
2807a2200e
@ -3,16 +3,14 @@ package clocks
|
|||||||
import (
|
import (
|
||||||
"sort"
|
"sort"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/wtfutil/wtf/wtf"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type ClockCollection struct {
|
type ClockCollection struct {
|
||||||
Clocks []Clock
|
Clocks []Clock
|
||||||
}
|
}
|
||||||
|
|
||||||
func (clocks *ClockCollection) Sorted() []Clock {
|
func (clocks *ClockCollection) Sorted(sortOrder string) []Clock {
|
||||||
if "chronological" == wtf.Config.UString("wtf.mods.clocks.sort", "alphabetical") {
|
if sortOrder == "chronological" {
|
||||||
clocks.SortedChronologically()
|
clocks.SortedChronologically()
|
||||||
} else {
|
} else {
|
||||||
clocks.SortedAlphabetically()
|
clocks.SortedAlphabetically()
|
||||||
|
@ -34,7 +34,7 @@ func NewWidget(app *tview.Application, settings *Settings) *Widget {
|
|||||||
/* -------------------- Exported Functions -------------------- */
|
/* -------------------- Exported Functions -------------------- */
|
||||||
|
|
||||||
func (widget *Widget) Refresh() {
|
func (widget *Widget) Refresh() {
|
||||||
widget.display(widget.clockColl.Sorted(), widget.dateFormat, widget.timeFormat)
|
widget.display(widget.clockColl.Sorted(widget.settings.sort), widget.dateFormat, widget.timeFormat)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------- Unexported Functions -------------------- */
|
/* -------------------- Unexported Functions -------------------- */
|
||||||
|
@ -19,7 +19,7 @@ func NewSettingsFromYAML(ymlConfig *config.Config) *Settings {
|
|||||||
settings := Settings{
|
settings := Settings{
|
||||||
common: cfg.NewCommonSettingsFromYAML(ymlConfig),
|
common: cfg.NewCommonSettingsFromYAML(ymlConfig),
|
||||||
|
|
||||||
args: wtf.ToStrs(wtf.Config.UList("args")),
|
args: wtf.ToStrs(localConfig.UList("args")),
|
||||||
cmd: localConfig.UString("cmd"),
|
cmd: localConfig.UString("cmd"),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -8,16 +8,14 @@ import (
|
|||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"net/http"
|
"net/http"
|
||||||
"net/url"
|
"net/url"
|
||||||
|
|
||||||
"github.com/wtfutil/wtf/wtf"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func CurrentActiveItems(accessToken string) (*ActiveItems, error) {
|
func CurrentActiveItems(accessToken, assignedToName string, activeOnly bool) (*ActiveItems, error) {
|
||||||
items := &ActiveItems{}
|
items := &ActiveItems{}
|
||||||
|
|
||||||
rollbarAPIURL.Host = "api.rollbar.com"
|
rollbarAPIURL.Host = "api.rollbar.com"
|
||||||
rollbarAPIURL.Path = "/api/1/items"
|
rollbarAPIURL.Path = "/api/1/items"
|
||||||
resp, err := rollbarItemRequest(accessToken)
|
resp, err := rollbarItemRequest(accessToken, assignedToName, activeOnly)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return items, err
|
return items, err
|
||||||
}
|
}
|
||||||
@ -33,13 +31,11 @@ var (
|
|||||||
rollbarAPIURL = &url.URL{Scheme: "https"}
|
rollbarAPIURL = &url.URL{Scheme: "https"}
|
||||||
)
|
)
|
||||||
|
|
||||||
func rollbarItemRequest(accessToken string) (*http.Response, error) {
|
func rollbarItemRequest(accessToken, assignedToName string, activeOnly bool) (*http.Response, error) {
|
||||||
params := url.Values{}
|
params := url.Values{}
|
||||||
params.Add("access_token", accessToken)
|
params.Add("access_token", accessToken)
|
||||||
userName := wtf.Config.UString("wtf.mods.rollbar.assignedToName", "")
|
params.Add("assigned_user", assignedToName)
|
||||||
params.Add("assigned_user", userName)
|
if activeOnly {
|
||||||
active := wtf.Config.UBool("wtf.mods.rollbar.activeOnly", false)
|
|
||||||
if active {
|
|
||||||
params.Add("status", "active")
|
params.Add("status", "active")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@ func NewSettingsFromYAML(ymlConfig *config.Config) *Settings {
|
|||||||
common: cfg.NewCommonSettingsFromYAML(ymlConfig),
|
common: cfg.NewCommonSettingsFromYAML(ymlConfig),
|
||||||
|
|
||||||
accessToken: localConfig.UString("accessToken"),
|
accessToken: localConfig.UString("accessToken"),
|
||||||
activeOnly: localConfig.UBool("activeOnly"),
|
activeOnly: localConfig.UBool("activeOnly", false),
|
||||||
assignedToName: localConfig.UString("assignedToName"),
|
assignedToName: localConfig.UString("assignedToName"),
|
||||||
count: localConfig.UInt("count", 10),
|
count: localConfig.UInt("count", 10),
|
||||||
projectName: localConfig.UString("projectName", "Items"),
|
projectName: localConfig.UString("projectName", "Items"),
|
||||||
|
@ -55,7 +55,11 @@ func (widget *Widget) Refresh() {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
items, err := CurrentActiveItems(widget.settings.accessToken)
|
items, err := CurrentActiveItems(
|
||||||
|
widget.settings.accessToken,
|
||||||
|
widget.settings.assignedToName,
|
||||||
|
widget.settings.activeOnly,
|
||||||
|
)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
widget.View.SetWrap(true)
|
widget.View.SetWrap(true)
|
||||||
|
@ -150,7 +150,7 @@ func (widget *Widget) openBuild() {
|
|||||||
sel := widget.selected
|
sel := widget.selected
|
||||||
if sel >= 0 && widget.builds != nil && sel < len(widget.builds.Builds) {
|
if sel >= 0 && widget.builds != nil && sel < len(widget.builds.Builds) {
|
||||||
build := &widget.builds.Builds[widget.selected]
|
build := &widget.builds.Builds[widget.selected]
|
||||||
travisHost := TRAVIS_HOSTS[wtf.Config.UBool("wtf.mods.travisci.pro", false)]
|
travisHost := TRAVIS_HOSTS[widget.settings.pro]
|
||||||
wtf.OpenFile(fmt.Sprintf("https://%s/%s/%s/%d", travisHost, build.Repository.Slug, "builds", build.ID))
|
wtf.OpenFile(fmt.Sprintf("https://%s/%s/%s/%d", travisHost, build.Repository.Slug, "builds", build.ID))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user