Merge pull request #795 from ddibiasi/copilot/disable-forced-project-view

Fixed forced project view
This commit is contained in:
Jesse Duffield 2026-04-19 11:55:00 +10:00 committed by GitHub
commit 8106125441
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

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