mirror of
https://github.com/bcicen/ctop.git
synced 2024-08-30 18:23:19 +00:00
Open in browser: show menu item only if web port is published
This commit is contained in:
parent
dd92e85d45
commit
8dce3ece2b
4
menus.go
4
menus.go
@ -223,8 +223,10 @@ func ContainerMenu() MenuFn {
|
||||
items = append(items, menu.Item{Val: "pause", Label: "[p] pause"})
|
||||
items = append(items, menu.Item{Val: "restart", Label: "[r] restart"})
|
||||
items = append(items, menu.Item{Val: "exec", Label: "[e] exec shell"})
|
||||
if c.Meta["Web Port"] != "" {
|
||||
items = append(items, menu.Item{Val: "browser", Label: "[w] open in browser"})
|
||||
}
|
||||
}
|
||||
if c.Meta["state"] == "exited" || c.Meta["state"] == "created" {
|
||||
items = append(items, menu.Item{Val: "start", Label: "[s] start"})
|
||||
items = append(items, menu.Item{Val: "remove", Label: "[R] remove"})
|
||||
@ -280,10 +282,12 @@ func ContainerMenu() MenuFn {
|
||||
selected = "restart"
|
||||
ui.StopLoop()
|
||||
})
|
||||
if c.Meta["Web Port"] != "" {
|
||||
ui.Handle("/sys/kbd/w", func(ui.Event) {
|
||||
selected = "browser"
|
||||
})
|
||||
}
|
||||
}
|
||||
ui.Handle("/sys/kbd/R", func(ui.Event) {
|
||||
selected = "remove"
|
||||
ui.StopLoop()
|
||||
|
Loading…
Reference in New Issue
Block a user