mirror of
https://github.com/taigrr/wtf
synced 2026-03-22 20:32:18 -07:00
Display OpsGenie oncall data for one specific schedule
This commit is contained in:
committed by
Chris Cummer
parent
62502c24d0
commit
945dfc8db7
@@ -1,7 +1,8 @@
|
||||
package opsgenie
|
||||
|
||||
import (
|
||||
//"fmt"
|
||||
"fmt"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/rivo/tview"
|
||||
@@ -31,13 +32,13 @@ func NewWidget() *Widget {
|
||||
/* -------------------- Exported Functions -------------------- */
|
||||
|
||||
func (widget *Widget) Refresh() {
|
||||
//data := Fetch()
|
||||
data := Fetch()
|
||||
|
||||
widget.View.SetTitle(" OpsGenie ")
|
||||
widget.RefreshedAt = time.Now()
|
||||
|
||||
widget.View.Clear()
|
||||
//fmt.Fprintf(widget.View, "%s", widget.contentFrom(data))
|
||||
fmt.Fprintf(widget.View, "%s", widget.contentFrom(data))
|
||||
}
|
||||
|
||||
/* -------------------- Unexported Functions -------------------- */
|
||||
@@ -52,6 +53,10 @@ func (widget *Widget) addView() {
|
||||
widget.View = view
|
||||
}
|
||||
|
||||
func (widget *Widget) contentFrom(data string) string {
|
||||
return data
|
||||
func (widget *Widget) contentFrom(onCallData *OnCallData) string {
|
||||
str := "\n"
|
||||
str = str + fmt.Sprintf(" [red]%s[white]\n", onCallData.Data.Parent.Name)
|
||||
str = str + fmt.Sprintf(" %s\n", strings.Join(onCallData.Data.OnCallRecipients, ", "))
|
||||
|
||||
return str
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user