add runtime config param for toggling all containers

This commit is contained in:
Bradley Cicenas 2017-02-16 00:00:31 +00:00
parent 9ddc99f788
commit 5f13563b6f
2 changed files with 8 additions and 0 deletions

View File

@ -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,
} }

View File

@ -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()