mirror of
https://github.com/jesseduffield/lazydocker.git
synced 2026-07-25 08:31:03 +00:00
Open service in browser
This commit is contained in:
parent
c88fba546f
commit
6c27cf3f32
7 changed files with 40 additions and 0 deletions
|
|
@ -42,6 +42,7 @@
|
||||||
<kbd>R</kbd>: zeige Neustartoptionen
|
<kbd>R</kbd>: zeige Neustartoptionen
|
||||||
<kbd>c</kbd>: führe vordefinierten benutzerdefinierten Befehl aus
|
<kbd>c</kbd>: führe vordefinierten benutzerdefinierten Befehl aus
|
||||||
<kbd>b</kbd>: view bulk commands
|
<kbd>b</kbd>: view bulk commands
|
||||||
|
<kbd>w</kbd>: open in browser (first port is http)
|
||||||
<kbd>enter</kbd>: fokussieren aufs Hauptpanel
|
<kbd>enter</kbd>: fokussieren aufs Hauptpanel
|
||||||
</pre>
|
</pre>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -42,6 +42,7 @@
|
||||||
<kbd>R</kbd>: view restart options
|
<kbd>R</kbd>: view restart options
|
||||||
<kbd>c</kbd>: run predefined custom command
|
<kbd>c</kbd>: run predefined custom command
|
||||||
<kbd>b</kbd>: view bulk commands
|
<kbd>b</kbd>: view bulk commands
|
||||||
|
<kbd>w</kbd>: open in browser (first port is http)
|
||||||
<kbd>enter</kbd>: focus main panel
|
<kbd>enter</kbd>: focus main panel
|
||||||
</pre>
|
</pre>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -42,6 +42,7 @@
|
||||||
<kbd>R</kbd>: bekijk 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>b</kbd>: view bulk commands
|
<kbd>b</kbd>: view bulk commands
|
||||||
|
<kbd>w</kbd>: open in browser (first port is http)
|
||||||
<kbd>enter</kbd>: focus hoofdpaneel
|
<kbd>enter</kbd>: focus hoofdpaneel
|
||||||
</pre>
|
</pre>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -42,6 +42,7 @@
|
||||||
<kbd>R</kbd>: pokaż opcje restartu
|
<kbd>R</kbd>: pokaż opcje restartu
|
||||||
<kbd>c</kbd>: wykonaj predefiniowaną własną komende
|
<kbd>c</kbd>: wykonaj predefiniowaną własną komende
|
||||||
<kbd>b</kbd>: view bulk commands
|
<kbd>b</kbd>: view bulk commands
|
||||||
|
<kbd>w</kbd>: open in browser (first port is http)
|
||||||
<kbd>enter</kbd>: skup na głównym panelu
|
<kbd>enter</kbd>: skup na głównym panelu
|
||||||
</pre>
|
</pre>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -42,6 +42,7 @@
|
||||||
<kbd>R</kbd>: yeniden başlatma seçeneklerini görüntüle
|
<kbd>R</kbd>: yeniden başlatma seçeneklerini görüntüle
|
||||||
<kbd>c</kbd>: önceden tanımlanmış özel komutu çalıştır
|
<kbd>c</kbd>: önceden tanımlanmış özel komutu çalıştır
|
||||||
<kbd>b</kbd>: view bulk commands
|
<kbd>b</kbd>: view bulk commands
|
||||||
|
<kbd>w</kbd>: open in browser (first port is http)
|
||||||
<kbd>enter</kbd>: ana panele odaklan
|
<kbd>enter</kbd>: ana panele odaklan
|
||||||
</pre>
|
</pre>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -346,6 +346,13 @@ func (gui *Gui) GetInitialKeybindings() []*Binding {
|
||||||
Handler: gui.handleServicesBulkCommand,
|
Handler: gui.handleServicesBulkCommand,
|
||||||
Description: gui.Tr.ViewBulkCommands,
|
Description: gui.Tr.ViewBulkCommands,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
ViewName: "services",
|
||||||
|
Key: 'w',
|
||||||
|
Modifier: gocui.ModNone,
|
||||||
|
Handler: gui.handleServicesOpenInBrowserCommand,
|
||||||
|
Description: gui.Tr.OpenInBrowser,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
ViewName: "images",
|
ViewName: "images",
|
||||||
Key: '[',
|
Key: '[',
|
||||||
|
|
|
||||||
|
|
@ -409,3 +409,31 @@ func (gui *Gui) handleServicesBulkCommand(g *gocui.Gui, v *gocui.View) error {
|
||||||
|
|
||||||
return gui.createBulkCommandMenu(bulkCommands, commandObject)
|
return gui.createBulkCommandMenu(bulkCommands, commandObject)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (gui *Gui) handleServicesOpenInBrowserCommand(g *gocui.Gui, v *gocui.View) error {
|
||||||
|
service, err := gui.getSelectedService()
|
||||||
|
if err != nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
container := service.Container
|
||||||
|
if container == nil {
|
||||||
|
return gui.createErrorPanel(gui.g, gui.Tr.NoContainers)
|
||||||
|
}
|
||||||
|
|
||||||
|
// skip if no any ports
|
||||||
|
if len(container.Container.Ports) == 0 {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
// skip if the first port is not published
|
||||||
|
port := container.Container.Ports[0]
|
||||||
|
if port.IP == "" {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
ip := port.IP
|
||||||
|
if ip == "0.0.0.0" {
|
||||||
|
ip = "localhost"
|
||||||
|
}
|
||||||
|
link := fmt.Sprintf("http://%s:%d/", ip, port.PublicPort)
|
||||||
|
return gui.OSCommand.OpenLink(link)
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue