status.go: use more clear status marks

This commit is contained in:
Sergey Ponomarev 2020-11-25 22:29:10 +02:00
parent 10c49018a6
commit 4850f817f3

View File

@ -6,12 +6,6 @@ import (
ui "github.com/gizak/termui" ui "github.com/gizak/termui"
) )
const (
mark = "◉"
healthMark = "✚"
vBar = string('\u25AE') + string('\u25AE')
)
// Status indicator // Status indicator
type Status struct { type Status struct {
*ui.Block *ui.Block
@ -52,27 +46,27 @@ func (s *Status) FixedWidth() int { return 3 }
func (s *Status) setState(val string) { func (s *Status) setState(val string) {
color := ui.ColorDefault color := ui.ColorDefault
var text string var mark string
switch val { switch val {
case "": case "":
return return
case "created": case "created":
text = mark mark = "◉"
case "running": case "running":
text = mark mark = "⏵"
color = ui.ThemeAttr("status.ok") color = ui.ThemeAttr("status.ok")
case "exited": case "exited":
text = mark mark = "⏹"
color = ui.ThemeAttr("status.danger") color = ui.ThemeAttr("status.danger")
case "paused": case "paused":
text = vBar mark = "⏸"
default: default:
text = " " mark = " "
log.Warningf("unknown status string: \"%v\"", val) log.Warningf("unknown status string: \"%v\"", val)
} }
s.status = ui.TextCells(text, color, ui.ColorDefault) s.status = ui.TextCells(mark, color, ui.ColorDefault)
} }
func (s *Status) setHealth(val string) { func (s *Status) setHealth(val string) {
@ -83,13 +77,13 @@ func (s *Status) setHealth(val string) {
case "": case "":
return return
case "healthy": case "healthy":
mark = healthMark mark = "☼"
color = ui.ThemeAttr("status.ok") color = ui.ThemeAttr("status.ok")
case "unhealthy": case "unhealthy":
mark = healthMark mark = "⚠"
color = ui.ThemeAttr("status.danger") color = ui.ThemeAttr("status.danger")
case "starting": case "starting":
mark = healthMark mark = "◌"
color = ui.ThemeAttr("status.warn") color = ui.ThemeAttr("status.warn")
default: default:
mark = " " mark = " "