mirror of
https://github.com/bcicen/ctop.git
synced 2024-08-30 18:23:19 +00:00
Extract MetaCol
This commit is contained in:
parent
cdcb8b6d99
commit
9545dfba31
@ -9,34 +9,28 @@ import (
|
||||
ui "github.com/gizak/termui"
|
||||
)
|
||||
|
||||
type NameCol struct {
|
||||
// Column that shows container's meta property i.e. name, id, image tc.
|
||||
type MetaCol struct {
|
||||
*TextCol
|
||||
metaName string
|
||||
}
|
||||
|
||||
func (w *MetaCol) SetMeta(m models.Meta) {
|
||||
w.setText(m.Get(w.metaName))
|
||||
}
|
||||
|
||||
func NewNameCol() CompactCol {
|
||||
c := &NameCol{NewTextCol("NAME")}
|
||||
c := &MetaCol{NewTextCol("NAME"), "name"}
|
||||
c.fWidth = 30
|
||||
return c
|
||||
}
|
||||
|
||||
func (w *NameCol) SetMeta(m models.Meta) {
|
||||
w.setText(m.Get("name"))
|
||||
}
|
||||
|
||||
type CIDCol struct {
|
||||
*TextCol
|
||||
}
|
||||
|
||||
func NewCIDCol() CompactCol {
|
||||
c := &CIDCol{NewTextCol("CID")}
|
||||
c := &MetaCol{NewTextCol("CID"), "id"}
|
||||
c.fWidth = 12
|
||||
return c
|
||||
}
|
||||
|
||||
func (w *CIDCol) SetMeta(m models.Meta) {
|
||||
w.setText(m.Get("id"))
|
||||
}
|
||||
|
||||
type NetCol struct {
|
||||
*TextCol
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user