mirror of
https://github.com/jesseduffield/lazydocker.git
synced 2026-07-25 00:21:04 +00:00
Merge pull request #111 from mjarkk/f110
Added `e` keybinding for toggling visibility stopped containers
This commit is contained in:
commit
cca69e64f3
10 changed files with 41 additions and 6 deletions
|
|
@ -17,6 +17,7 @@
|
||||||
<kbd>[</kbd>: vorheriges Tab
|
<kbd>[</kbd>: vorheriges Tab
|
||||||
<kbd>]</kbd>: nächstes Tab
|
<kbd>]</kbd>: nächstes Tab
|
||||||
<kbd>d</kbd>: entfernen
|
<kbd>d</kbd>: entfernen
|
||||||
|
<kbd>e</kbd>: Hide/Show stopped containers
|
||||||
<kbd>s</kbd>: anhalten
|
<kbd>s</kbd>: anhalten
|
||||||
<kbd>r</kbd>: neustarten
|
<kbd>r</kbd>: neustarten
|
||||||
<kbd>a</kbd>: anbinden
|
<kbd>a</kbd>: anbinden
|
||||||
|
|
|
||||||
|
|
@ -17,6 +17,7 @@
|
||||||
<kbd>[</kbd>: previous tab
|
<kbd>[</kbd>: previous tab
|
||||||
<kbd>]</kbd>: next tab
|
<kbd>]</kbd>: next tab
|
||||||
<kbd>d</kbd>: remove
|
<kbd>d</kbd>: remove
|
||||||
|
<kbd>e</kbd>: Hide/Show stopped containers
|
||||||
<kbd>s</kbd>: stop
|
<kbd>s</kbd>: stop
|
||||||
<kbd>r</kbd>: restart
|
<kbd>r</kbd>: restart
|
||||||
<kbd>a</kbd>: attach
|
<kbd>a</kbd>: attach
|
||||||
|
|
|
||||||
|
|
@ -17,6 +17,7 @@
|
||||||
<kbd>[</kbd>: vorige tab
|
<kbd>[</kbd>: vorige tab
|
||||||
<kbd>]</kbd>: volgende tab
|
<kbd>]</kbd>: volgende tab
|
||||||
<kbd>d</kbd>: verwijder
|
<kbd>d</kbd>: verwijder
|
||||||
|
<kbd>e</kbd>: Verberg gestopte containers
|
||||||
<kbd>s</kbd>: stop
|
<kbd>s</kbd>: stop
|
||||||
<kbd>r</kbd>: herstart
|
<kbd>r</kbd>: herstart
|
||||||
<kbd>a</kbd>: verbinden
|
<kbd>a</kbd>: verbinden
|
||||||
|
|
@ -36,7 +37,7 @@
|
||||||
<kbd>m</kbd>: bekijk logs
|
<kbd>m</kbd>: bekijk logs
|
||||||
<kbd>[</kbd>: vorige tab
|
<kbd>[</kbd>: vorige tab
|
||||||
<kbd>]</kbd>: volgende tab
|
<kbd>]</kbd>: volgende tab
|
||||||
<kbd>R</kbd>: beijk herstart opties
|
<kbd>R</kbd>: bekijk herstart opties
|
||||||
<kbd>c</kbd>: draai een vooraf bedacht aangepaste opdracht
|
<kbd>c</kbd>: draai een vooraf bedacht aangepaste opdracht
|
||||||
<kbd>enter</kbd>: focus hooft panneel
|
<kbd>enter</kbd>: focus hooft panneel
|
||||||
</pre>
|
</pre>
|
||||||
|
|
|
||||||
|
|
@ -17,6 +17,7 @@
|
||||||
<kbd>[</kbd>: poprzednia zakładka
|
<kbd>[</kbd>: poprzednia zakładka
|
||||||
<kbd>]</kbd>: następna zakładka
|
<kbd>]</kbd>: następna zakładka
|
||||||
<kbd>d</kbd>: usuń
|
<kbd>d</kbd>: usuń
|
||||||
|
<kbd>e</kbd>: Hide/Show stopped containers
|
||||||
<kbd>s</kbd>: zatrzymaj
|
<kbd>s</kbd>: zatrzymaj
|
||||||
<kbd>r</kbd>: restartuj
|
<kbd>r</kbd>: restartuj
|
||||||
<kbd>a</kbd>: przyczep
|
<kbd>a</kbd>: przyczep
|
||||||
|
|
|
||||||
|
|
@ -17,6 +17,7 @@
|
||||||
<kbd>[</kbd>: önceki sekme
|
<kbd>[</kbd>: önceki sekme
|
||||||
<kbd>]</kbd>: sonraki sekme
|
<kbd>]</kbd>: sonraki sekme
|
||||||
<kbd>d</kbd>: kaldır
|
<kbd>d</kbd>: kaldır
|
||||||
|
<kbd>e</kbd>: Hide/Show stopped containers
|
||||||
<kbd>s</kbd>: durdur
|
<kbd>s</kbd>: durdur
|
||||||
<kbd>r</kbd>: yeniden başlat
|
<kbd>r</kbd>: yeniden başlat
|
||||||
<kbd>a</kbd>: bağlan/iliştir
|
<kbd>a</kbd>: bağlan/iliştir
|
||||||
|
|
|
||||||
|
|
@ -29,6 +29,7 @@ type DockerCommand struct {
|
||||||
Config *config.AppConfig
|
Config *config.AppConfig
|
||||||
Client *client.Client
|
Client *client.Client
|
||||||
InDockerComposeProject bool
|
InDockerComposeProject bool
|
||||||
|
ShowExited bool
|
||||||
ErrorChan chan error
|
ErrorChan chan error
|
||||||
ContainerMutex sync.Mutex
|
ContainerMutex sync.Mutex
|
||||||
ServiceMutex sync.Mutex
|
ServiceMutex sync.Mutex
|
||||||
|
|
@ -73,6 +74,7 @@ func NewDockerCommand(log *logrus.Entry, osCommand *OSCommand, tr *i18n.Translat
|
||||||
Config: config,
|
Config: config,
|
||||||
Client: cli,
|
Client: cli,
|
||||||
ErrorChan: errorChan,
|
ErrorChan: errorChan,
|
||||||
|
ShowExited: true,
|
||||||
InDockerComposeProject: true,
|
InDockerComposeProject: true,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -213,10 +215,8 @@ func (c *DockerCommand) RefreshContainersAndServices() error {
|
||||||
|
|
||||||
c.assignContainersToServices(containers, services)
|
c.assignContainersToServices(containers, services)
|
||||||
|
|
||||||
var displayContainers []*Container
|
var displayContainers = containers
|
||||||
if c.Config.UserConfig.Gui.ShowAllContainers {
|
if !c.Config.UserConfig.Gui.ShowAllContainers {
|
||||||
displayContainers = containers
|
|
||||||
} else {
|
|
||||||
displayContainers = c.obtainStandaloneContainers(containers, services)
|
displayContainers = c.obtainStandaloneContainers(containers, services)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -235,7 +235,7 @@ func (c *DockerCommand) RefreshContainersAndServices() error {
|
||||||
|
|
||||||
c.Containers = containers
|
c.Containers = containers
|
||||||
c.Services = services
|
c.Services = services
|
||||||
c.DisplayContainers = displayContainers
|
c.DisplayContainers = c.filterOutExited(displayContainers)
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
@ -253,6 +253,20 @@ L:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// filterOutExited filters out the exited containers if c.ShowExited is false
|
||||||
|
func (c *DockerCommand) filterOutExited(containers []*Container) []*Container {
|
||||||
|
if c.ShowExited {
|
||||||
|
return containers
|
||||||
|
}
|
||||||
|
toReturn := []*Container{}
|
||||||
|
for _, container := range containers {
|
||||||
|
if container.Container.State != "exited" {
|
||||||
|
toReturn = append(toReturn, container)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return toReturn
|
||||||
|
}
|
||||||
|
|
||||||
// obtainStandaloneContainers returns standalone containers. Standalone containers are containers which are either one-off containers, or whose service is not part of this docker-compose context
|
// obtainStandaloneContainers returns standalone containers. Standalone containers are containers which are either one-off containers, or whose service is not part of this docker-compose context
|
||||||
func (c *DockerCommand) obtainStandaloneContainers(containers []*Container, services []*Service) []*Container {
|
func (c *DockerCommand) obtainStandaloneContainers(containers []*Container, services []*Service) []*Container {
|
||||||
standaloneContainers := []*Container{}
|
standaloneContainers := []*Container{}
|
||||||
|
|
|
||||||
|
|
@ -277,6 +277,7 @@ func (gui *Gui) refreshContainersAndServices() error {
|
||||||
gui.g.Update(func(g *gocui.Gui) error {
|
gui.g.Update(func(g *gocui.Gui) error {
|
||||||
containersView.Clear()
|
containersView.Clear()
|
||||||
isFocused := gui.g.CurrentView().Name() == "containers"
|
isFocused := gui.g.CurrentView().Name() == "containers"
|
||||||
|
|
||||||
list, err := utils.RenderList(gui.DockerCommand.DisplayContainers, utils.IsFocused(isFocused))
|
list, err := utils.RenderList(gui.DockerCommand.DisplayContainers, utils.IsFocused(isFocused))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
|
@ -371,6 +372,11 @@ func (r *removeContainerOption) GetDisplayStrings(isFocused bool) []string {
|
||||||
return []string{r.description, color.New(color.FgRed).Sprint(r.command)}
|
return []string{r.description, color.New(color.FgRed).Sprint(r.command)}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (gui *Gui) handleHideStoppedContainers(g *gocui.Gui, v *gocui.View) error {
|
||||||
|
gui.DockerCommand.ShowExited = !gui.DockerCommand.ShowExited
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
func (gui *Gui) handleContainersRemoveMenu(g *gocui.Gui, v *gocui.View) error {
|
func (gui *Gui) handleContainersRemoveMenu(g *gocui.Gui, v *gocui.View) error {
|
||||||
container, err := gui.getSelectedContainer()
|
container, err := gui.getSelectedContainer()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
||||||
|
|
@ -211,6 +211,13 @@ func (gui *Gui) GetInitialKeybindings() []*Binding {
|
||||||
Handler: gui.handleContainersRemoveMenu,
|
Handler: gui.handleContainersRemoveMenu,
|
||||||
Description: gui.Tr.Remove,
|
Description: gui.Tr.Remove,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
ViewName: "containers",
|
||||||
|
Key: 'e',
|
||||||
|
Modifier: gocui.ModNone,
|
||||||
|
Handler: gui.handleHideStoppedContainers,
|
||||||
|
Description: gui.Tr.HideStopped,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
ViewName: "containers",
|
ViewName: "containers",
|
||||||
Key: 's',
|
Key: 's',
|
||||||
|
|
|
||||||
|
|
@ -31,6 +31,7 @@ func dutchSet() TranslationSet {
|
||||||
EditConfig: "verander de lazydocker configuratie",
|
EditConfig: "verander de lazydocker configuratie",
|
||||||
Cancel: "annuleren",
|
Cancel: "annuleren",
|
||||||
Remove: "verwijder",
|
Remove: "verwijder",
|
||||||
|
HideStopped: "Verberg gestopte containers",
|
||||||
ForceRemove: "geforceerd verwijderen",
|
ForceRemove: "geforceerd verwijderen",
|
||||||
RemoveWithVolumes: "verwijder met volumes",
|
RemoveWithVolumes: "verwijder met volumes",
|
||||||
RemoveService: "verwijder containers",
|
RemoveService: "verwijder containers",
|
||||||
|
|
|
||||||
|
|
@ -29,6 +29,7 @@ type TranslationSet struct {
|
||||||
Cancel string
|
Cancel string
|
||||||
CustomCommandTitle string
|
CustomCommandTitle string
|
||||||
Remove string
|
Remove string
|
||||||
|
HideStopped string
|
||||||
ForceRemove string
|
ForceRemove string
|
||||||
RemoveWithVolumes string
|
RemoveWithVolumes string
|
||||||
MustForceToRemoveContainer string
|
MustForceToRemoveContainer string
|
||||||
|
|
@ -113,6 +114,7 @@ func englishSet() TranslationSet {
|
||||||
EditConfig: "edit lazydocker config",
|
EditConfig: "edit lazydocker config",
|
||||||
Cancel: "cancel",
|
Cancel: "cancel",
|
||||||
Remove: "remove",
|
Remove: "remove",
|
||||||
|
HideStopped: "Hide/Show stopped containers",
|
||||||
ForceRemove: "force remove",
|
ForceRemove: "force remove",
|
||||||
RemoveWithVolumes: "remove with volumes",
|
RemoveWithVolumes: "remove with volumes",
|
||||||
RemoveService: "remove containers",
|
RemoveService: "remove containers",
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue