diff --git a/pkg/commands/container.go b/pkg/commands/container.go index 9c4b9d7a..a6c8b8db 100644 --- a/pkg/commands/container.go +++ b/pkg/commands/container.go @@ -298,6 +298,8 @@ func (c *Container) GetColor() color.Attribute { return color.FgRed case "restarting": return color.FgBlue + case "removing": + return color.FgMagenta default: return color.FgWhite } diff --git a/pkg/commands/container_stats.go b/pkg/commands/container_stats.go index e15e2856..fc7f7161 100644 --- a/pkg/commands/container_stats.go +++ b/pkg/commands/container_stats.go @@ -238,7 +238,7 @@ func (c *Container) PlotGraph(spec config.GraphConfig, width int) (string, error asciigraph.Width(width), asciigraph.Min(min), asciigraph.Max(max), - asciigraph.Caption(spec.Caption), + asciigraph.Caption(fmt.Sprintf("%s: %0.2f (%v)", spec.Caption, data[len(data)-1], time.Since(c.StatHistory[0].RecordedAt))), ), nil } diff --git a/pkg/commands/docker.go b/pkg/commands/docker.go index c53e4585..15407318 100644 --- a/pkg/commands/docker.go +++ b/pkg/commands/docker.go @@ -168,11 +168,17 @@ func (c *DockerCommand) GetContainersAndServices() error { // find out which services have corresponding containers and assign them for _, service := range services { + foundMatch := false for _, container := range containers { if container.ServiceID != "" && container.ServiceID == service.ID { + foundMatch = true service.Container = container + break } } + if !foundMatch { + service.Container = nil + } } // sort services first by whether they have a linked container, and second by alphabetical order diff --git a/pkg/gui/keybindings.go b/pkg/gui/keybindings.go index 6e36d6b6..f0437046 100644 --- a/pkg/gui/keybindings.go +++ b/pkg/gui/keybindings.go @@ -201,6 +201,20 @@ func (gui *Gui) GetInitialKeybindings() []*Binding { Handler: gui.handleServiceAttach, Description: gui.Tr.SLocalize("attach"), }, + { + ViewName: "services", + Key: '[', + Modifier: gocui.ModNone, + Handler: gui.handleServicesPrevContext, + Description: gui.Tr.SLocalize("previousContext"), + }, + { + ViewName: "services", + Key: ']', + Modifier: gocui.ModNone, + Handler: gui.handleServicesNextContext, + Description: gui.Tr.SLocalize("nextContext"), + }, { ViewName: "images", Key: '[', diff --git a/pkg/gui/services_panel.go b/pkg/gui/services_panel.go index 4ba62f01..6b72e587 100644 --- a/pkg/gui/services_panel.go +++ b/pkg/gui/services_panel.go @@ -115,7 +115,11 @@ func (gui *Gui) renderServiceConfig(mainView *gocui.View, service *commands.Serv } func (gui *Gui) renderServiceStats(mainView *gocui.View, service *commands.Service) error { - return nil + if service.Container == nil { + return nil + } + + return gui.renderContainerStats(mainView, service.Container) } func (gui *Gui) renderServiceLogs(mainView *gocui.View, service *commands.Service) error {