1
0
mirror of https://github.com/taigrr/wtf synced 2025-01-18 04:03:14 -08:00

WTF-730 Fix missing color key config error (#738)

* WTF-730 Fix missing color key config error

Signed-off-by: Chris Cummer <chriscummer@me.com>

* WTF-730 Add Subheading color formatting to modules

Users can now set a `subheading` color in their config to change the
color of subheadings in widget display.

Defaults to `red`.

Signed-off-by: Chris Cummer <chriscummer@me.com>

* WTF-730 Fix oustanding color issues

Clean up missing color config changes not addressed in earlier commits.

Signed-off-by: Chris Cummer <chriscummer@me.com>

* Remove unused dependency

Signed-off-by: Chris Cummer <chriscummer@me.com>

* WTF-730 Base cleanup

Signed-off-by: Chris Cummer <chriscummer@me.com>

* WTF-730 Fix a few bugs related to color config changes

Signed-off-by: Chris Cummer <chriscummer@me.com>

* WTF-730 Fix issues with PagerDuty subheading display

Signed-off-by: Chris Cummer <chriscummer@me.com>

* WTF-730 Fix bug with Todo list colour rendering

Signed-off-by: Chris Cummer <chriscummer@me.com>
This commit is contained in:
Chris Cummer
2019-11-09 11:21:45 -08:00
committed by GitHub
parent 1bfca29d17
commit 200dbcc03c
33 changed files with 366 additions and 137 deletions

View File

@@ -70,7 +70,7 @@ func (widget *Widget) contentFrom(onCalls []pagerduty.OnCall, incidents []pagerd
if len(incidents) > 0 {
str += "[yellow]Incidents[white]\n"
for _, incident := range incidents {
str += fmt.Sprintf("[red]%s[white]\n", incident.Summary)
str += fmt.Sprintf("[%s]%s[white]\n", widget.settings.common.Colors.Subheading, incident.Summary)
str += fmt.Sprintf("Status: %s\n", incident.Status)
str += fmt.Sprintf("Service: %s\n", incident.Service.Summary)
str += fmt.Sprintf("Escalation: %s\n", incident.EscalationPolicy.Summary)
@@ -100,14 +100,26 @@ func (widget *Widget) contentFrom(onCalls []pagerduty.OnCall, incidents []pagerd
sort.Strings(keys)
if len(keys) > 0 {
str += "[red] Schedules[white]\n"
str += fmt.Sprintf("[%s] Schedules[white]\n", widget.settings.common.Colors.Subheading)
// Print out policies, and escalation order of users
for _, key := range keys {
str += fmt.Sprintf("\n [green::b]%s\n", key)
str += fmt.Sprintf(
"\n [%s]%s\n",
widget.settings.common.Colors.Subheading,
key,
)
values := tree[key]
sort.Sort(ByEscalationLevel(values))
for _, item := range values {
str += fmt.Sprintf(" [white]%d - %s\n", item.EscalationLevel, item.User.Summary)
str += fmt.Sprintf(
" [%s]%d - %s\n",
widget.settings.common.Colors.Text,
item.EscalationLevel,
item.User.Summary,
)
}
}
}