From 5f13563b6fdf9e0cb1392ba0d33c97d71bdbb559 Mon Sep 17 00:00:00 2001 From: Bradley Cicenas Date: Thu, 16 Feb 2017 00:00:31 +0000 Subject: [PATCH] add runtime config param for toggling all containers --- config/main.go | 1 + grid.go | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/config/main.go b/config/main.go index bd9cd89..1f8b082 100644 --- a/config/main.go +++ b/config/main.go @@ -62,6 +62,7 @@ func NewDefaultConfig() Config { toggles := map[string]bool{ "sortReverse": false, + "allContainers": false, "enableHeader": false, "loggingEnabled": true, } diff --git a/grid.go b/grid.go index c77dcb5..98cd657 100644 --- a/grid.go +++ b/grid.go @@ -82,6 +82,9 @@ func (g *Grid) redrawRows() { } ui.Body.AddRows(fieldHeader()) for _, c := range g.containers { + if !config.GetToggle("allContainers") && c.state != "running" { + continue + } ui.Body.AddRows(c.widgets.Row()) } @@ -154,6 +157,10 @@ func Display(g *Grid) bool { expand = true ui.StopLoop() }) + ui.Handle("/sys/kbd/a", func(ui.Event) { + config.Toggle("allContainers") + g.redrawRows() + }) ui.Handle("/sys/kbd/f", func(ui.Event) { menu = FilterMenu ui.StopLoop()