Fixed forced project view

This commit is contained in:
Daniel Dibiasi 2026-04-16 09:23:12 +02:00
parent e3c1c8630a
commit b17d474148
No known key found for this signature in database
GPG key ID: ED24CD017E91FF3D

View file

@ -83,6 +83,20 @@ func (gui *Gui) getContainersPanel() *panels.SideListPanel[*commands.Container]
return sortContainers(a, b, gui.Config.UserConfig.Gui.LegacySortContainers) return sortContainers(a, b, gui.Config.UserConfig.Gui.LegacySortContainers)
}, },
Filter: func(container *commands.Container) bool { Filter: func(container *commands.Container) bool {
if !gui.State.ShowExitedContainers && container.Container.State == "exited" {
return false
}
// 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 // 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, // 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. // so we will need to keep an eye on this.
@ -90,14 +104,6 @@ func (gui *Gui) getContainersPanel() *panels.SideListPanel[*commands.Container]
return false 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.
if gui.DockerCommand.InDockerComposeProject {
// Filter by selected project. Containers with no project (truly // Filter by selected project. Containers with no project (truly
// standalone, not from any compose project) are always shown. // standalone, not from any compose project) are always shown.
selectedProject := gui.getSelectedProjectName() selectedProject := gui.getSelectedProjectName()