mirror of
https://github.com/bcicen/ctop.git
synced 2025-12-06 15:16:41 +08:00
move compact field header into widgets
This commit is contained in:
22
grid.go
22
grid.go
@@ -83,7 +83,7 @@ func (g *Grid) redrawRows() {
|
|||||||
} else {
|
} else {
|
||||||
ui.Body.Y = 0
|
ui.Body.Y = 0
|
||||||
}
|
}
|
||||||
ui.Body.AddRows(fieldHeader())
|
ui.Body.AddRows(widgets.CompactHeader)
|
||||||
for _, c := range g.containers {
|
for _, c := range g.containers {
|
||||||
ui.Body.AddRows(c.widgets.Row())
|
ui.Body.AddRows(c.widgets.Row())
|
||||||
}
|
}
|
||||||
@@ -117,26 +117,6 @@ func resizeIndicator() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func fieldHeader() *ui.Row {
|
|
||||||
return ui.NewRow(
|
|
||||||
ui.NewCol(1, 0, headerPar("")),
|
|
||||||
ui.NewCol(2, 0, headerPar("NAME")),
|
|
||||||
ui.NewCol(2, 0, headerPar("CID")),
|
|
||||||
ui.NewCol(2, 0, headerPar("CPU")),
|
|
||||||
ui.NewCol(2, 0, headerPar("MEM")),
|
|
||||||
ui.NewCol(2, 0, headerPar("NET RX/TX")),
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
func headerPar(s string) *ui.Par {
|
|
||||||
p := ui.NewPar(fmt.Sprintf(" %s", s))
|
|
||||||
p.Border = false
|
|
||||||
p.Height = 2
|
|
||||||
p.Width = 20
|
|
||||||
p.TextFgColor = ui.ColorWhite
|
|
||||||
return p
|
|
||||||
}
|
|
||||||
|
|
||||||
func (g *Grid) ExpandView() {
|
func (g *Grid) ExpandView() {
|
||||||
ui.Clear()
|
ui.Clear()
|
||||||
ui.DefaultEvtStream.ResetHandlers()
|
ui.DefaultEvtStream.ResetHandlers()
|
||||||
|
|||||||
5
menus.go
5
menus.go
@@ -65,11 +65,6 @@ func SortMenu() {
|
|||||||
|
|
||||||
// set cursor position to current sort field
|
// set cursor position to current sort field
|
||||||
m.SetCursor(config.GetVal("sortField"))
|
m.SetCursor(config.GetVal("sortField"))
|
||||||
//for n, item := range m.Items {
|
|
||||||
//if item.Val == current {
|
|
||||||
//m.CursorPos = n
|
|
||||||
//}
|
|
||||||
//}
|
|
||||||
|
|
||||||
ui.Render(m)
|
ui.Render(m)
|
||||||
m.NavigationHandlers()
|
m.NavigationHandlers()
|
||||||
|
|||||||
@@ -23,6 +23,15 @@ type ContainerWidgets interface {
|
|||||||
SetMem(int64, int64, int)
|
SetMem(int64, int64, int)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var CompactHeader = ui.NewRow(
|
||||||
|
ui.NewCol(1, 0, slimPar("")),
|
||||||
|
ui.NewCol(2, 0, slimPar("NAME")),
|
||||||
|
ui.NewCol(2, 0, slimPar("CID")),
|
||||||
|
ui.NewCol(2, 0, slimPar("CPU")),
|
||||||
|
ui.NewCol(2, 0, slimPar("MEM")),
|
||||||
|
ui.NewCol(2, 0, slimPar("NET RX/TX")),
|
||||||
|
)
|
||||||
|
|
||||||
type Compact struct {
|
type Compact struct {
|
||||||
Status *ui.Par
|
Status *ui.Par
|
||||||
Cid *ui.Par
|
Cid *ui.Par
|
||||||
|
|||||||
Reference in New Issue
Block a user