mirror of
https://github.com/taigrr/wtf
synced 2025-01-18 04:03:14 -08:00
Enabled half-measure: widgets won't run if disabled (still need to not display)
This commit is contained in:
parent
b4bc6d4509
commit
ae13d52665
@ -29,6 +29,10 @@ func NewWidget() *Widget {
|
|||||||
/* -------------------- Exported Functions -------------------- */
|
/* -------------------- Exported Functions -------------------- */
|
||||||
|
|
||||||
func (widget *Widget) Refresh() {
|
func (widget *Widget) Refresh() {
|
||||||
|
if widget.Enabled == false {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
url, _ := Config.String("wtf.bamboohr.url")
|
url, _ := Config.String("wtf.bamboohr.url")
|
||||||
|
|
||||||
client := NewClient(url)
|
client := NewClient(url)
|
||||||
|
@ -68,7 +68,7 @@ wtf:
|
|||||||
height:
|
height:
|
||||||
refreshInterval: 21600
|
refreshInterval: 21600
|
||||||
security:
|
security:
|
||||||
enabled: true
|
enabled: false
|
||||||
position:
|
position:
|
||||||
top:
|
top:
|
||||||
left:
|
left:
|
||||||
|
@ -31,6 +31,10 @@ func NewWidget() *Widget {
|
|||||||
/* -------------------- Exported Functions -------------------- */
|
/* -------------------- Exported Functions -------------------- */
|
||||||
|
|
||||||
func (widget *Widget) Refresh() {
|
func (widget *Widget) Refresh() {
|
||||||
|
if widget.Enabled == false {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
events, _ := Fetch()
|
events, _ := Fetch()
|
||||||
|
|
||||||
widget.View.SetTitle(" 🍿 Calendar ")
|
widget.View.SetTitle(" 🍿 Calendar ")
|
||||||
|
@ -31,6 +31,10 @@ func NewWidget() *Widget {
|
|||||||
/* -------------------- Exported Functions -------------------- */
|
/* -------------------- Exported Functions -------------------- */
|
||||||
|
|
||||||
func (widget *Widget) Refresh() {
|
func (widget *Widget) Refresh() {
|
||||||
|
if widget.Enabled == false {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
data := Fetch()
|
data := Fetch()
|
||||||
|
|
||||||
title := fmt.Sprintf("[green]%s[white]\n", data["repo"][0])
|
title := fmt.Sprintf("[green]%s[white]\n", data["repo"][0])
|
||||||
|
@ -30,6 +30,10 @@ func NewWidget() *Widget {
|
|||||||
/* -------------------- Exported Functions -------------------- */
|
/* -------------------- Exported Functions -------------------- */
|
||||||
|
|
||||||
func (widget *Widget) Refresh() {
|
func (widget *Widget) Refresh() {
|
||||||
|
if widget.Enabled == false {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
client := NewClient()
|
client := NewClient()
|
||||||
|
|
||||||
repo, _ := client.Repository(Config.UString("wtf.github.organization"), Config.UString("wtf.github.repo"))
|
repo, _ := client.Repository(Config.UString("wtf.github.organization"), Config.UString("wtf.github.repo"))
|
||||||
|
@ -29,6 +29,10 @@ func NewWidget() *Widget {
|
|||||||
/* -------------------- Exported Functions -------------------- */
|
/* -------------------- Exported Functions -------------------- */
|
||||||
|
|
||||||
func (widget *Widget) Refresh() {
|
func (widget *Widget) Refresh() {
|
||||||
|
if widget.Enabled == false {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
widget.View.SetTitle(fmt.Sprintf(" %s ", widget.Name))
|
widget.View.SetTitle(fmt.Sprintf(" %s ", widget.Name))
|
||||||
widget.RefreshedAt = time.Now()
|
widget.RefreshedAt = time.Now()
|
||||||
|
|
||||||
|
@ -30,6 +30,10 @@ func NewWidget() *Widget {
|
|||||||
/* -------------------- Exported Functions -------------------- */
|
/* -------------------- Exported Functions -------------------- */
|
||||||
|
|
||||||
func (widget *Widget) Refresh() {
|
func (widget *Widget) Refresh() {
|
||||||
|
if widget.Enabled == false {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
app, _ := Application()
|
app, _ := Application()
|
||||||
deploys, _ := Deployments()
|
deploys, _ := Deployments()
|
||||||
|
|
||||||
|
@ -30,6 +30,10 @@ func NewWidget() *Widget {
|
|||||||
/* -------------------- Exported Functions -------------------- */
|
/* -------------------- Exported Functions -------------------- */
|
||||||
|
|
||||||
func (widget *Widget) Refresh() {
|
func (widget *Widget) Refresh() {
|
||||||
|
if widget.Enabled == false {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
data := Fetch()
|
data := Fetch()
|
||||||
|
|
||||||
widget.View.SetTitle(" ⏰ On Call ")
|
widget.View.SetTitle(" ⏰ On Call ")
|
||||||
|
@ -30,6 +30,10 @@ func NewWidget() *Widget {
|
|||||||
/* -------------------- Exported Functions -------------------- */
|
/* -------------------- Exported Functions -------------------- */
|
||||||
|
|
||||||
func (widget *Widget) Refresh() {
|
func (widget *Widget) Refresh() {
|
||||||
|
if widget.Enabled == false {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
data := Fetch()
|
data := Fetch()
|
||||||
|
|
||||||
widget.View.SetTitle(" 🤺 Security ")
|
widget.View.SetTitle(" 🤺 Security ")
|
||||||
|
@ -32,6 +32,10 @@ func NewWidget() *Widget {
|
|||||||
/* -------------------- Exported Functions -------------------- */
|
/* -------------------- Exported Functions -------------------- */
|
||||||
|
|
||||||
func (widget *Widget) Refresh() {
|
func (widget *Widget) Refresh() {
|
||||||
|
if widget.Enabled == false {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
widget.View.SetTitle(" 🎉 Status ")
|
widget.View.SetTitle(" 🎉 Status ")
|
||||||
widget.RefreshedAt = time.Now()
|
widget.RefreshedAt = time.Now()
|
||||||
|
|
||||||
|
@ -31,6 +31,10 @@ func NewWidget() *Widget {
|
|||||||
/* -------------------- Exported Functions -------------------- */
|
/* -------------------- Exported Functions -------------------- */
|
||||||
|
|
||||||
func (widget *Widget) Refresh() {
|
func (widget *Widget) Refresh() {
|
||||||
|
if widget.Enabled == false {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
data := Fetch(Config.UInt("wtf.weather.cityId", 6176823))
|
data := Fetch(Config.UInt("wtf.weather.cityId", 6176823))
|
||||||
|
|
||||||
widget.View.SetTitle(fmt.Sprintf(" %s Weather - %s ", icon(data), data.Name))
|
widget.View.SetTitle(fmt.Sprintf(" %s Weather - %s ", icon(data), data.Name))
|
||||||
|
@ -28,7 +28,7 @@ type TextWidget struct {
|
|||||||
|
|
||||||
func NewTextWidget(name string, configKey string) TextWidget {
|
func NewTextWidget(name string, configKey string) TextWidget {
|
||||||
widget := TextWidget{
|
widget := TextWidget{
|
||||||
Enabled: Config.UBool(fmt.Sprintf("wtf.%s.refreshInterval", configKey), false),
|
Enabled: Config.UBool(fmt.Sprintf("wtf.%s.enabled", configKey), false),
|
||||||
Name: name,
|
Name: name,
|
||||||
RefreshInt: Config.UInt(fmt.Sprintf("wtf.%s.refreshInterval", configKey)),
|
RefreshInt: Config.UInt(fmt.Sprintf("wtf.%s.refreshInterval", configKey)),
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user