mirror of
https://github.com/bcicen/ctop.git
synced 2024-08-30 18:23:19 +00:00
add runtime config param for toggling all containers
This commit is contained in:
parent
9ddc99f788
commit
5f13563b6f
@ -62,6 +62,7 @@ func NewDefaultConfig() Config {
|
|||||||
|
|
||||||
toggles := map[string]bool{
|
toggles := map[string]bool{
|
||||||
"sortReverse": false,
|
"sortReverse": false,
|
||||||
|
"allContainers": false,
|
||||||
"enableHeader": false,
|
"enableHeader": false,
|
||||||
"loggingEnabled": true,
|
"loggingEnabled": true,
|
||||||
}
|
}
|
||||||
|
7
grid.go
7
grid.go
@ -82,6 +82,9 @@ func (g *Grid) redrawRows() {
|
|||||||
}
|
}
|
||||||
ui.Body.AddRows(fieldHeader())
|
ui.Body.AddRows(fieldHeader())
|
||||||
for _, c := range g.containers {
|
for _, c := range g.containers {
|
||||||
|
if !config.GetToggle("allContainers") && c.state != "running" {
|
||||||
|
continue
|
||||||
|
}
|
||||||
ui.Body.AddRows(c.widgets.Row())
|
ui.Body.AddRows(c.widgets.Row())
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -154,6 +157,10 @@ func Display(g *Grid) bool {
|
|||||||
expand = true
|
expand = true
|
||||||
ui.StopLoop()
|
ui.StopLoop()
|
||||||
})
|
})
|
||||||
|
ui.Handle("/sys/kbd/a", func(ui.Event) {
|
||||||
|
config.Toggle("allContainers")
|
||||||
|
g.redrawRows()
|
||||||
|
})
|
||||||
ui.Handle("/sys/kbd/f", func(ui.Event) {
|
ui.Handle("/sys/kbd/f", func(ui.Event) {
|
||||||
menu = FilterMenu
|
menu = FilterMenu
|
||||||
ui.StopLoop()
|
ui.StopLoop()
|
||||||
|
Loading…
Reference in New Issue
Block a user