Skip to content

Commit b17d474

Browse files
committed
Fixed forced project view
1 parent e3c1c86 commit b17d474

1 file changed

Lines changed: 16 additions & 10 deletions

File tree

pkg/gui/containers_panel.go

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -83,21 +83,27 @@ func (gui *Gui) getContainersPanel() *panels.SideListPanel[*commands.Container]
8383
return sortContainers(a, b, gui.Config.UserConfig.Gui.LegacySortContainers)
8484
},
8585
Filter: func(container *commands.Container) bool {
86-
// Note that this is O(N*M) time complexity where N is the number of services
87-
// and M is the number of containers. We expect N to be small but M may be large,
88-
// so we will need to keep an eye on this.
89-
if !gui.Config.UserConfig.Gui.ShowAllContainers && !isStandaloneContainer(container) {
90-
return false
91-
}
92-
9386
if !gui.State.ShowExitedContainers && container.Container.State == "exited" {
9487
return false
9588
}
9689

97-
// Only apply project filtering when we are inside a docker-compose
98-
// project. Outside of a compose project all containers are shown in
99-
// a flat list regardless of which compose project they belong to.
90+
// Only apply project and standalone filtering when we are inside a
91+
// docker-compose project. Outside of a compose project all
92+
// containers are shown in a flat list regardless of which compose
93+
// project they belong to.
10094
if gui.DockerCommand.InDockerComposeProject {
95+
// This check must be inside the InDockerComposeProject guard:
96+
// outside a compose project, services are still derived from
97+
// container labels, so compose-managed containers from other
98+
// projects would be incorrectly hidden.
99+
//
100+
// Note that this is O(N*M) time complexity where N is the number of services
101+
// and M is the number of containers. We expect N to be small but M may be large,
102+
// so we will need to keep an eye on this.
103+
if !gui.Config.UserConfig.Gui.ShowAllContainers && !isStandaloneContainer(container) {
104+
return false
105+
}
106+
101107
// Filter by selected project. Containers with no project (truly
102108
// standalone, not from any compose project) are always shown.
103109
selectedProject := gui.getSelectedProjectName()

0 commit comments

Comments
 (0)