mirror of
https://github.com/bcicen/ctop.git
synced 2024-08-30 18:23:19 +00:00
parent
eb8237cbb1
commit
54fc5ac5c6
10
cursor.go
10
cursor.go
@ -17,16 +17,6 @@ type GridCursor struct {
|
|||||||
|
|
||||||
func (gc *GridCursor) Len() int { return len(gc.filtered) }
|
func (gc *GridCursor) Len() int { return len(gc.filtered) }
|
||||||
|
|
||||||
func (gc *GridCursor) MemoryUsage() int64 {
|
|
||||||
var size int64
|
|
||||||
size = 0
|
|
||||||
for _, c := range gc.filtered {
|
|
||||||
size += c.MemUsage
|
|
||||||
}
|
|
||||||
gc.Reset()
|
|
||||||
return size
|
|
||||||
}
|
|
||||||
|
|
||||||
func (gc *GridCursor) Selected() *container.Container {
|
func (gc *GridCursor) Selected() *container.Container {
|
||||||
idx := gc.Idx()
|
idx := gc.Idx()
|
||||||
if idx < gc.Len() {
|
if idx < gc.Len() {
|
||||||
|
1
grid.go
1
grid.go
@ -52,7 +52,6 @@ func RedrawRows(clr bool) {
|
|||||||
y := 1
|
y := 1
|
||||||
if config.GetSwitchVal("enableHeader") {
|
if config.GetSwitchVal("enableHeader") {
|
||||||
header.SetCount(cursor.Len())
|
header.SetCount(cursor.Len())
|
||||||
header.SetMemoryUsage(cursor.MemoryUsage())
|
|
||||||
header.SetFilter(config.GetVal("filterStr"))
|
header.SetFilter(config.GetVal("filterStr"))
|
||||||
y += header.Height()
|
y += header.Height()
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,7 @@ package widgets
|
|||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"time"
|
"time"
|
||||||
"github.com/bcicen/ctop/cwidgets"
|
|
||||||
ui "github.com/gizak/termui"
|
ui "github.com/gizak/termui"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -11,7 +11,6 @@ type CTopHeader struct {
|
|||||||
Time *ui.Par
|
Time *ui.Par
|
||||||
Count *ui.Par
|
Count *ui.Par
|
||||||
Filter *ui.Par
|
Filter *ui.Par
|
||||||
Mem *ui.Par
|
|
||||||
bg *ui.Par
|
bg *ui.Par
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -20,7 +19,6 @@ func NewCTopHeader() *CTopHeader {
|
|||||||
Time: headerPar(2, ""),
|
Time: headerPar(2, ""),
|
||||||
Count: headerPar(24, "-"),
|
Count: headerPar(24, "-"),
|
||||||
Filter: headerPar(40, ""),
|
Filter: headerPar(40, ""),
|
||||||
Mem: headerPar(70, ""),
|
|
||||||
bg: headerBg(),
|
bg: headerBg(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -32,7 +30,6 @@ func (c *CTopHeader) Buffer() ui.Buffer {
|
|||||||
buf.Merge(c.Time.Buffer())
|
buf.Merge(c.Time.Buffer())
|
||||||
buf.Merge(c.Count.Buffer())
|
buf.Merge(c.Count.Buffer())
|
||||||
buf.Merge(c.Filter.Buffer())
|
buf.Merge(c.Filter.Buffer())
|
||||||
buf.Merge(c.Mem.Buffer())
|
|
||||||
return buf
|
return buf
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -61,10 +58,6 @@ func headerBg() *ui.Par {
|
|||||||
return bg
|
return bg
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *CTopHeader) SetMemoryUsage(val int64) {
|
|
||||||
c.Mem.Text = cwidgets.ByteFormat(val)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *CTopHeader) SetCount(val int) {
|
func (c *CTopHeader) SetCount(val int) {
|
||||||
c.Count.Text = fmt.Sprintf("%d containers", val)
|
c.Count.Text = fmt.Sprintf("%d containers", val)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user