mirror of
https://github.com/bcicen/ctop.git
synced 2024-08-30 18:23:19 +00:00
Merge pull request #220 from stokito/single_view_trunc_id
Single Container View: truncate ID
This commit is contained in:
commit
73a976c6fe
@ -34,7 +34,7 @@ func New(id string, collector collector.Collector, manager manager.Manager) *Con
|
|||||||
return &Container{
|
return &Container{
|
||||||
Metrics: models.NewMetrics(),
|
Metrics: models.NewMetrics(),
|
||||||
Id: id,
|
Id: id,
|
||||||
Meta: models.NewMeta("id", id),
|
Meta: models.NewMeta("id", id[:12]),
|
||||||
Widgets: widgets,
|
Widgets: widgets,
|
||||||
updater: widgets,
|
updater: widgets,
|
||||||
collector: collector,
|
collector: collector,
|
||||||
|
@ -13,14 +13,13 @@ type Info struct {
|
|||||||
data map[string]string
|
data map[string]string
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewInfo(id string) *Info {
|
func NewInfo() *Info {
|
||||||
p := ui.NewTable()
|
p := ui.NewTable()
|
||||||
p.Height = 4
|
p.Height = 4
|
||||||
p.Width = colWidth[0]
|
p.Width = colWidth[0]
|
||||||
p.FgColor = ui.ThemeAttr("par.text.fg")
|
p.FgColor = ui.ThemeAttr("par.text.fg")
|
||||||
p.Separator = false
|
p.Separator = false
|
||||||
i := &Info{p, make(map[string]string)}
|
i := &Info{p, make(map[string]string)}
|
||||||
i.Set("id", id)
|
|
||||||
return i
|
return i
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -23,12 +23,9 @@ type Single struct {
|
|||||||
Width int
|
Width int
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewSingle(id string) *Single {
|
func NewSingle() *Single {
|
||||||
if len(id) > 12 {
|
|
||||||
id = id[:12]
|
|
||||||
}
|
|
||||||
return &Single{
|
return &Single{
|
||||||
Info: NewInfo(id),
|
Info: NewInfo(),
|
||||||
Net: NewNet(),
|
Net: NewNet(),
|
||||||
Cpu: NewCpu(),
|
Cpu: NewCpu(),
|
||||||
Mem: NewMem(),
|
Mem: NewMem(),
|
||||||
|
2
grid.go
2
grid.go
@ -83,7 +83,7 @@ func SingleView() MenuFn {
|
|||||||
ui.DefaultEvtStream.ResetHandlers()
|
ui.DefaultEvtStream.ResetHandlers()
|
||||||
defer ui.DefaultEvtStream.ResetHandlers()
|
defer ui.DefaultEvtStream.ResetHandlers()
|
||||||
|
|
||||||
ex := single.NewSingle(c.Id)
|
ex := single.NewSingle()
|
||||||
c.SetUpdater(ex)
|
c.SetUpdater(ex)
|
||||||
|
|
||||||
ex.Align()
|
ex.Align()
|
||||||
|
Loading…
Reference in New Issue
Block a user