mirror of
https://github.com/jesseduffield/lazydocker.git
synced 2026-07-21 23:01:03 +00:00
more use of waiting statuses
This commit is contained in:
parent
1ed796eb32
commit
2f57561c40
4 changed files with 38 additions and 22 deletions
|
|
@ -330,11 +330,15 @@ func (c *DockerCommand) GetImages() ([]*Image, error) {
|
|||
}
|
||||
|
||||
nameParts := strings.Split(name, ":")
|
||||
tag := ""
|
||||
if len(nameParts) > 1 {
|
||||
tag = nameParts[1]
|
||||
}
|
||||
|
||||
ownImages[i] = &Image{
|
||||
ID: image.ID,
|
||||
Name: nameParts[0],
|
||||
Tag: nameParts[1],
|
||||
Tag: tag,
|
||||
Image: image,
|
||||
Client: c.Client,
|
||||
OSCommand: c.OSCommand,
|
||||
|
|
|
|||
|
|
@ -355,24 +355,30 @@ func (gui *Gui) handleContainersRemoveMenu(g *gocui.Gui, v *gocui.View) error {
|
|||
return nil
|
||||
}
|
||||
configOptions := options[index].configOptions
|
||||
if cerr := container.Remove(configOptions); cerr != nil {
|
||||
var originalErr commands.ComplexError
|
||||
if xerrors.As(cerr, &originalErr) {
|
||||
if originalErr.Code == commands.MustStopContainer {
|
||||
return gui.createConfirmationPanel(gui.g, v, gui.Tr.SLocalize("Confirm"), gui.Tr.SLocalize("mustForceToRemoveContainer"), func(g *gocui.Gui, v *gocui.View) error {
|
||||
configOptions.Force = true
|
||||
if err := container.Remove(configOptions); err != nil {
|
||||
return err
|
||||
}
|
||||
return gui.refreshContainersAndServices()
|
||||
}, nil)
|
||||
}
|
||||
} else {
|
||||
return gui.createErrorPanel(gui.g, cerr.Error())
|
||||
}
|
||||
}
|
||||
|
||||
return gui.refreshContainersAndServices()
|
||||
return gui.WithWaitingStatus(gui.Tr.SLocalize("RemovingStatus"), func() error {
|
||||
if cerr := container.Remove(configOptions); cerr != nil {
|
||||
var originalErr commands.ComplexError
|
||||
if xerrors.As(cerr, &originalErr) {
|
||||
if originalErr.Code == commands.MustStopContainer {
|
||||
return gui.createConfirmationPanel(gui.g, v, gui.Tr.SLocalize("Confirm"), gui.Tr.SLocalize("mustForceToRemoveContainer"), func(g *gocui.Gui, v *gocui.View) error {
|
||||
return gui.WithWaitingStatus(gui.Tr.SLocalize("RemovingStatus"), func() error {
|
||||
configOptions.Force = true
|
||||
if err := container.Remove(configOptions); err != nil {
|
||||
return err
|
||||
}
|
||||
return gui.refreshContainersAndServices()
|
||||
})
|
||||
}, nil)
|
||||
}
|
||||
} else {
|
||||
return gui.createErrorPanel(gui.g, cerr.Error())
|
||||
}
|
||||
}
|
||||
|
||||
return gui.refreshContainersAndServices()
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
return gui.createMenu("", options, len(options), handleMenuPress)
|
||||
|
|
|
|||
|
|
@ -219,11 +219,13 @@ func (gui *Gui) handleServiceRemoveMenu(g *gocui.Gui, v *gocui.View) error {
|
|||
if options[index].command == "" {
|
||||
return nil
|
||||
}
|
||||
if err := gui.OSCommand.RunCommand(options[index].command); err != nil {
|
||||
return gui.createErrorPanel(gui.g, err.Error())
|
||||
}
|
||||
return gui.WithWaitingStatus(gui.Tr.SLocalize("RemovingStatus"), func() error {
|
||||
if err := gui.OSCommand.RunCommand(options[index].command); err != nil {
|
||||
return gui.createErrorPanel(gui.g, err.Error())
|
||||
}
|
||||
|
||||
return gui.refreshContainersAndServices()
|
||||
return gui.refreshContainersAndServices()
|
||||
})
|
||||
}
|
||||
|
||||
return gui.createMenu("", options, len(options), handleMenuPress)
|
||||
|
|
|
|||
|
|
@ -784,6 +784,10 @@ func addEnglish(i18nObject *i18n.Bundle) error {
|
|||
ID: "StoppingStatus",
|
||||
Other: "stopping",
|
||||
},
|
||||
&i18n.Message{
|
||||
ID: "RemovingStatus",
|
||||
Other: "removing",
|
||||
},
|
||||
&i18n.Message{
|
||||
ID: "remove",
|
||||
Other: "remove",
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue