allow viewing container config in services panel

This commit is contained in:
Jesse Duffield 2019-06-09 12:07:01 +10:00
parent 816eb3f55f
commit da645cf173
2 changed files with 17 additions and 6 deletions

View file

@ -14,11 +14,11 @@ import (
// list panel functions // list panel functions
func (gui *Gui) getServiceContexts() []string { func (gui *Gui) getServiceContexts() []string {
return []string{"logs", "stats", "config"} return []string{"logs", "stats", "config", "container-config"}
} }
func (gui *Gui) getServiceContextTitles() []string { func (gui *Gui) getServiceContextTitles() []string {
return []string{gui.Tr.LogsTitle, gui.Tr.StatsTitle, gui.Tr.ConfigTitle} return []string{gui.Tr.LogsTitle, gui.Tr.StatsTitle, gui.Tr.ConfigTitle, gui.Tr.ContainerConfigTitle}
} }
func (gui *Gui) getSelectedService() (*commands.Service, error) { func (gui *Gui) getSelectedService() (*commands.Service, error) {
@ -93,6 +93,13 @@ func (gui *Gui) handleServiceSelect(g *gocui.Gui, v *gocui.View) error {
if err := gui.renderServiceStats(service); err != nil { if err := gui.renderServiceStats(service); err != nil {
return err return err
} }
case "container-config":
if service.Container == nil {
return gui.renderString(gui.g, "main", gui.Tr.NoContainer)
}
if err := gui.renderContainerConfig(service.Container); err != nil {
return err
}
default: default:
return errors.New("Unknown context for services panel") return errors.New("Unknown context for services panel")
} }

View file

@ -44,6 +44,7 @@ type TranslationSet struct {
StandaloneContainersTitle string StandaloneContainersTitle string
ImagesTitle string ImagesTitle string
NoContainers string NoContainers string
NoContainer string
NoImages string NoImages string
RemoveImage string RemoveImage string
RemoveWithoutPrune string RemoveWithoutPrune string
@ -56,10 +57,11 @@ type TranslationSet struct {
PressEnterToReturn string PressEnterToReturn string
ViewRestartOptions string ViewRestartOptions string
LogsTitle string LogsTitle string
ConfigTitle string ConfigTitle string
StatsTitle string StatsTitle string
CreditsTitle string CreditsTitle string
ContainerConfigTitle string
} }
func englishSet() TranslationSet { func englishSet() TranslationSet {
@ -114,8 +116,10 @@ func englishSet() TranslationSet {
ConfigTitle: "Config", ConfigTitle: "Config",
StatsTitle: "Stats", StatsTitle: "Stats",
CreditsTitle: "About", CreditsTitle: "About",
ContainerConfigTitle: "Container Config",
NoContainers: "No containers", NoContainers: "No containers",
NoContainer: "No container",
NoImages: "No images", NoImages: "No images",
ConfirmQuit: "Are you sure you want to quit?", ConfirmQuit: "Are you sure you want to quit?",