mirror of
https://github.com/bcicen/ctop.git
synced 2025-12-06 15:16:41 +08:00
add ContainerWidgets interface, config channel
This commit is contained in:
@@ -7,6 +7,15 @@ import (
|
||||
ui "github.com/gizak/termui"
|
||||
)
|
||||
|
||||
type ContainerWidgets interface {
|
||||
Row() *ui.Row
|
||||
Highlight()
|
||||
UnHighlight()
|
||||
SetCPU(int)
|
||||
SetNet(int64, int64)
|
||||
SetMem(int64, int64, int)
|
||||
}
|
||||
|
||||
type Compact struct {
|
||||
Cid *ui.Par
|
||||
Net *ui.Par
|
||||
@@ -35,6 +44,16 @@ func (w *Compact) Row() *ui.Row {
|
||||
)
|
||||
}
|
||||
|
||||
func (w *Compact) Highlight() {
|
||||
w.Name.TextFgColor = ui.ColorDefault
|
||||
w.Name.TextBgColor = ui.ColorWhite
|
||||
}
|
||||
|
||||
func (w *Compact) UnHighlight() {
|
||||
w.Name.TextFgColor = ui.ColorWhite
|
||||
w.Name.TextBgColor = ui.ColorDefault
|
||||
}
|
||||
|
||||
func (w *Compact) SetCPU(val int) {
|
||||
w.Cpu.BarColor = colorScale(val)
|
||||
w.Cpu.Label = fmt.Sprintf("%s%%", strconv.Itoa(val))
|
||||
|
||||
Reference in New Issue
Block a user