mirror of
https://github.com/bcicen/ctop.git
synced 2024-08-30 18:23:19 +00:00
status.go: use more clear status marks
This commit is contained in:
parent
10c49018a6
commit
4850f817f3
@ -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 = " "
|
||||||
|
Loading…
Reference in New Issue
Block a user