multi-container view

This commit is contained in:
Bradley Cicenas
2016-12-22 16:15:22 +00:00
parent ab56a4c4cb
commit 1c285c9e92
3 changed files with 180 additions and 49 deletions

30
container.go Normal file
View File

@@ -0,0 +1,30 @@
package main
import (
ui "github.com/gizak/termui"
)
type Container struct {
cid *ui.Par
cpu *ui.Gauge
memory *ui.Gauge
}
func (c *Container) UpdateCPU(n int) {
c.cpu.BarColor = colorScale(n)
c.cpu.Percent = n
}
func (c *Container) UpdateMem(n int) {
c.memory.Percent = n
}
func colorScale(n int) ui.Attribute {
if n > 70 {
return ui.ColorRed
}
if n > 30 {
return ui.ColorYellow
}
return ui.ColorGreen
}