#135 Add uptime column

This commit is contained in:
Sergey Ponomarev
2020-10-26 16:32:51 +02:00
parent c5038e2edd
commit c984b270db
7 changed files with 42 additions and 5 deletions

View File

@@ -17,6 +17,7 @@ var (
"net": NewNetCol,
"io": NewIOCol,
"pids": NewPIDCol,
"uptime": NewUptimeCol,
}
)

View File

@@ -80,6 +80,18 @@ func (w *PIDCol) SetMetrics(m models.Metrics) {
w.Text = fmt.Sprintf("%d", m.Pids)
}
type UptimeCol struct {
*TextCol
}
func NewUptimeCol() CompactCol {
return &UptimeCol{NewTextCol("UPTIME")}
}
func (w *UptimeCol) SetMeta(m models.Meta) {
w.Text = m.Get("uptime")
}
type TextCol struct {
*ui.Par
header string

View File

@@ -6,7 +6,7 @@ import (
ui "github.com/gizak/termui"
)
var displayInfo = []string{"id", "name", "image", "ports", "IPs", "state", "created", "health"}
var displayInfo = []string{"id", "name", "image", "ports", "IPs", "state", "created", "uptime", "health"}
type Info struct {
*ui.Table