diff --git a/pkg/gui/arrangement.go b/pkg/gui/arrangement.go index 6671a0d7..955831a5 100644 --- a/pkg/gui/arrangement.go +++ b/pkg/gui/arrangement.go @@ -129,11 +129,13 @@ func (gui *Gui) infoSectionChildren(informationStr string, appStatus string) []* } func (gui *Gui) sideViewNames() []string { - if gui.DockerCommand.InDockerComposeProject { - return []string{"project", "services", "containers", "images", "volumes"} - } else { - return []string{"project", "containers", "images", "volumes"} - } + visibleSidePanels := lo.Filter(gui.allSidePanels(), func(panel ISideListPanel, _ int) bool { + return !panel.IsHidden() + }) + + return lo.Map(visibleSidePanels, func(panel ISideListPanel, _ int) string { + return panel.View().Name() + }) } func (gui *Gui) sidePanelChildren(width int, height int) []*boxlayout.Box { diff --git a/pkg/gui/list_panel.go b/pkg/gui/list_panel.go index 76bbc2dd..5c20b3a7 100644 --- a/pkg/gui/list_panel.go +++ b/pkg/gui/list_panel.go @@ -76,6 +76,9 @@ type SideListPanel[T comparable] struct { // set this to true if you don't want to allow manual filtering via '/' disableFilter bool + + // This can be nil if you want to always show the panel + hide func() bool } type ISideListPanel interface { @@ -85,6 +88,7 @@ type ISideListPanel interface { Refocus() RerenderList() error IsFilterDisabled() bool + IsHidden() bool OnNextLine() error OnPrevLine() error OnClick() error @@ -307,3 +311,11 @@ func (self *SideListPanel[T]) SetContextIndex(index int) { func (self *SideListPanel[T]) IsFilterDisabled() bool { return self.disableFilter } + +func (self *SideListPanel[T]) IsHidden() bool { + if self.hide == nil { + return false + } + + return self.hide() +} diff --git a/pkg/gui/services_panel.go b/pkg/gui/services_panel.go index 0dfebfd6..6fc71e9d 100644 --- a/pkg/gui/services_panel.go +++ b/pkg/gui/services_panel.go @@ -90,6 +90,9 @@ func (gui *Gui) getServicesPanel() *SideListPanel[*commands.Service] { utils.ColoredString(cont.DisplayPorts(), color.FgYellow), } }, + hide: func() bool { + return !gui.DockerCommand.InDockerComposeProject + }, } }