use the view list to build the view

Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
This commit is contained in:
Sven Dowideit 2019-08-17 15:57:46 +10:00
parent 28150dcb6d
commit 069c7fb669
2 changed files with 9 additions and 8 deletions

View file

@ -147,7 +147,7 @@ func NewGui(log *logrus.Entry, dockerCommand *commands.DockerCommand, oSCommand
SessionIndex: 0,
}
cyclableViews := []string{"project", "containers", "images"}
cyclableViews := []string{"project", "containers", "images", "volumes"}
if dockerCommand.InDockerComposeProject || config.DockerSwarm {
cyclableViews = []string{"project", "services", "containers", "images", "volumes"}
}

View file

@ -204,15 +204,16 @@ func (gui *Gui) layout(g *gocui.Gui) error {
}
aboveContainersView := "project"
if showServicesPanel {
aboveContainersView = "services"
addView(g, "services", "project", titles["services"], vHeights["services"])
for _, view := range gui.CyclableViews {
if view == aboveContainersView {
continue
}
if err = addView(g, view, aboveContainersView, titles[view], vHeights[view]); err != nil {
return err
}
aboveContainersView = view
}
addView(g, "containers", aboveContainersView, titles["containers"], vHeights["containers"])
addView(g, "images", "containers", titles["images"], vHeights["images"])
addView(g, "volumes", "images", titles["volumes"], vHeights["volumes"])
if v, err := g.SetView("options", appStatusOptionsBoundary-1, height-2, optionsVersionBoundary-1, height, 0); err != nil {
if err.Error() != "unknown view" {
return err