mirror of
https://github.com/bcicen/ctop.git
synced 2025-12-06 15:16:41 +08:00
add redraw handler to reorder rows
This commit is contained in:
6
sort.go
6
sort.go
@@ -10,7 +10,7 @@ import (
|
||||
func NewContainerMap() *ContainerMap {
|
||||
return &ContainerMap{
|
||||
containers: make(map[string]*Container),
|
||||
sortField: "id",
|
||||
sortField: "cpu",
|
||||
}
|
||||
}
|
||||
|
||||
@@ -54,9 +54,9 @@ func (cm *ContainerMap) Sorted() []*Container {
|
||||
case "name":
|
||||
sort.Sort(ByName(containers))
|
||||
case "cpu":
|
||||
sort.Sort(ByCPU(containers))
|
||||
sort.Sort(sort.Reverse(ByCPU(containers)))
|
||||
case "mem":
|
||||
sort.Sort(ByMem(containers))
|
||||
sort.Sort(sort.Reverse(ByMem(containers)))
|
||||
default:
|
||||
sort.Sort(ByID(containers))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user