mirror of
https://github.com/jesseduffield/lazydocker.git
synced 2026-07-25 08:31:03 +00:00
Add services pause functionality
This commit is contained in:
parent
badc92f192
commit
0ced576d9c
2 changed files with 31 additions and 0 deletions
|
|
@ -297,6 +297,13 @@ func (gui *Gui) GetInitialKeybindings() []*Binding {
|
||||||
Handler: gui.handleServiceStop,
|
Handler: gui.handleServiceStop,
|
||||||
Description: gui.Tr.Stop,
|
Description: gui.Tr.Stop,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
ViewName: "services",
|
||||||
|
Key: 'p',
|
||||||
|
Modifier: gocui.ModNone,
|
||||||
|
Handler: gui.handleServicePause,
|
||||||
|
Description: gui.Tr.Pause,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
ViewName: "services",
|
ViewName: "services",
|
||||||
Key: 'r',
|
Key: 'r',
|
||||||
|
|
|
||||||
|
|
@ -219,6 +219,30 @@ func (gui *Gui) handleServiceRemoveMenu(g *gocui.Gui, v *gocui.View) error {
|
||||||
return gui.createServiceCommandMenu(options, gui.Tr.RemovingStatus)
|
return gui.createServiceCommandMenu(options, gui.Tr.RemovingStatus)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (gui *Gui) handleServicePause(g *gocui.Gui, v *gocui.View) error {
|
||||||
|
service, err := gui.getSelectedService()
|
||||||
|
if err != nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
if service.Container == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
return gui.WithWaitingStatus(gui.Tr.PausingStatus, func() error {
|
||||||
|
if service.Container.Details.State.Paused {
|
||||||
|
err = service.Container.Unpause()
|
||||||
|
} else {
|
||||||
|
err = service.Container.Pause()
|
||||||
|
}
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
return gui.createErrorPanel(gui.g, err.Error())
|
||||||
|
}
|
||||||
|
|
||||||
|
return gui.refreshContainersAndServices()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
func (gui *Gui) handleServiceStop(g *gocui.Gui, v *gocui.View) error {
|
func (gui *Gui) handleServiceStop(g *gocui.Gui, v *gocui.View) error {
|
||||||
service, err := gui.getSelectedService()
|
service, err := gui.getSelectedService()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue