mirror of
https://github.com/jesseduffield/lazydocker.git
synced 2026-07-25 08:31:03 +00:00
use the cyclableViewsList to determine what views to show
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
This commit is contained in:
parent
ec76d0ed6f
commit
601f178b0d
2 changed files with 13 additions and 9 deletions
|
|
@ -148,11 +148,7 @@ func NewGui(log *logrus.Entry, dockerCommand *commands.DockerCommand, oSCommand
|
||||||
}
|
}
|
||||||
|
|
||||||
cyclableViews := []string{"project", "containers", "images"}
|
cyclableViews := []string{"project", "containers", "images"}
|
||||||
if config.DockerSwarm {
|
if dockerCommand.InDockerComposeProject || config.DockerSwarm {
|
||||||
dockerCommand.InDockerComposeProject = true
|
|
||||||
}
|
|
||||||
if dockerCommand.InDockerComposeProject {
|
|
||||||
// Frustratingly, this is not actually the driver for what views are shown - the InDOckerComposeProject var is used inside the gui code
|
|
||||||
cyclableViews = []string{"project", "services", "containers", "images", "volumes"}
|
cyclableViews = []string{"project", "services", "containers", "images", "volumes"}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -93,6 +93,14 @@ func (gui *Gui) layout(g *gocui.Gui) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: should do this once only..
|
||||||
|
showServicesPanel := false
|
||||||
|
for _, view := range gui.CyclableViews {
|
||||||
|
if view == "services" {
|
||||||
|
showServicesPanel = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
currView := gui.g.CurrentView()
|
currView := gui.g.CurrentView()
|
||||||
currentCyclebleView := gui.State.PreviousView
|
currentCyclebleView := gui.State.PreviousView
|
||||||
if currView != nil {
|
if currView != nil {
|
||||||
|
|
@ -114,7 +122,7 @@ func (gui *Gui) layout(g *gocui.Gui) error {
|
||||||
|
|
||||||
tallPanels := 3
|
tallPanels := 3
|
||||||
var vHeights map[string]int
|
var vHeights map[string]int
|
||||||
if gui.DockerCommand.InDockerComposeProject {
|
if showServicesPanel {
|
||||||
tallPanels++
|
tallPanels++
|
||||||
vHeights = map[string]int{
|
vHeights = map[string]int{
|
||||||
"project": 3,
|
"project": 3,
|
||||||
|
|
@ -146,7 +154,7 @@ func (gui *Gui) layout(g *gocui.Gui) error {
|
||||||
"volumes": defaultHeight,
|
"volumes": defaultHeight,
|
||||||
"options": defaultHeight,
|
"options": defaultHeight,
|
||||||
}
|
}
|
||||||
if gui.DockerCommand.InDockerComposeProject {
|
if showServicesPanel {
|
||||||
vHeights["services"] = defaultHeight
|
vHeights["services"] = defaultHeight
|
||||||
}
|
}
|
||||||
vHeights[currentCyclebleView] = height - defaultHeight*tallPanels - 1
|
vHeights[currentCyclebleView] = height - defaultHeight*tallPanels - 1
|
||||||
|
|
@ -186,7 +194,7 @@ func (gui *Gui) layout(g *gocui.Gui) error {
|
||||||
|
|
||||||
var servicesView *gocui.View
|
var servicesView *gocui.View
|
||||||
aboveContainersView := "project"
|
aboveContainersView := "project"
|
||||||
if gui.DockerCommand.InDockerComposeProject {
|
if showServicesPanel {
|
||||||
aboveContainersView = "services"
|
aboveContainersView = "services"
|
||||||
servicesView, err = g.SetViewBeneath("services", "project", vHeights["services"])
|
servicesView, err = g.SetViewBeneath("services", "project", vHeights["services"])
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
@ -205,7 +213,7 @@ func (gui *Gui) layout(g *gocui.Gui) error {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
containersView.Highlight = true
|
containersView.Highlight = true
|
||||||
if gui.Config.UserConfig.Gui.ShowAllContainers || !gui.DockerCommand.InDockerComposeProject {
|
if gui.Config.UserConfig.Gui.ShowAllContainers || !showServicesPanel {
|
||||||
containersView.Title = gui.Tr.ContainersTitle
|
containersView.Title = gui.Tr.ContainersTitle
|
||||||
} else {
|
} else {
|
||||||
containersView.Title = gui.Tr.StandaloneContainersTitle
|
containersView.Title = gui.Tr.StandaloneContainersTitle
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue