From b17d4741482edb32079c4c28cecc8e43c3e057b5 Mon Sep 17 00:00:00 2001 From: Daniel Dibiasi <10942109+ddibiasi@users.noreply.github.com> Date: Thu, 16 Apr 2026 09:23:12 +0200 Subject: [PATCH] Fixed forced project view --- pkg/gui/containers_panel.go | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/pkg/gui/containers_panel.go b/pkg/gui/containers_panel.go index cf4b082c..5410502d 100644 --- a/pkg/gui/containers_panel.go +++ b/pkg/gui/containers_panel.go @@ -83,21 +83,27 @@ func (gui *Gui) getContainersPanel() *panels.SideListPanel[*commands.Container] return sortContainers(a, b, gui.Config.UserConfig.Gui.LegacySortContainers) }, Filter: func(container *commands.Container) bool { - // Note that this is O(N*M) time complexity where N is the number of services - // and M is the number of containers. We expect N to be small but M may be large, - // so we will need to keep an eye on this. - if !gui.Config.UserConfig.Gui.ShowAllContainers && !isStandaloneContainer(container) { - return false - } - if !gui.State.ShowExitedContainers && container.Container.State == "exited" { return false } - // Only apply project filtering when we are inside a docker-compose - // project. Outside of a compose project all containers are shown in - // a flat list regardless of which compose project they belong to. + // Only apply project and standalone filtering when we are inside a + // docker-compose project. Outside of a compose project all + // containers are shown in a flat list regardless of which compose + // project they belong to. if gui.DockerCommand.InDockerComposeProject { + // This check must be inside the InDockerComposeProject guard: + // outside a compose project, services are still derived from + // container labels, so compose-managed containers from other + // projects would be incorrectly hidden. + // + // Note that this is O(N*M) time complexity where N is the number of services + // and M is the number of containers. We expect N to be small but M may be large, + // so we will need to keep an eye on this. + if !gui.Config.UserConfig.Gui.ShowAllContainers && !isStandaloneContainer(container) { + return false + } + // Filter by selected project. Containers with no project (truly // standalone, not from any compose project) are always shown. selectedProject := gui.getSelectedProjectName()