mirror of
https://github.com/bcicen/ctop.git
synced 2025-12-06 15:16:41 +08:00
move keybinding for single view, add single view to container menu
This commit is contained in:
@@ -70,13 +70,14 @@ Option | Description
|
|||||||
|
|
||||||
Key | Action
|
Key | Action
|
||||||
--- | ---
|
--- | ---
|
||||||
|
<enter> | Open container menu
|
||||||
a | Toggle display of all (running and non-running) containers
|
a | Toggle display of all (running and non-running) containers
|
||||||
f | Filter displayed containers (`esc` to clear when open)
|
f | Filter displayed containers (`esc` to clear when open)
|
||||||
H | Toggle ctop header
|
H | Toggle ctop header
|
||||||
h | Open help dialog
|
h | Open help dialog
|
||||||
s | Select container sort field
|
s | Select container sort field
|
||||||
r | Reverse container sort order
|
r | Reverse container sort order
|
||||||
m | Manage container (start, stop and/or remove)
|
o | Open single view
|
||||||
l | View container logs (`t` to toggle timestamp when open)
|
l | View container logs (`t` to toggle timestamp when open)
|
||||||
q | Quit ctop
|
q | Quit ctop
|
||||||
|
|
||||||
|
|||||||
4
grid.go
4
grid.go
@@ -93,7 +93,7 @@ func Display() bool {
|
|||||||
ui.StopLoop()
|
ui.StopLoop()
|
||||||
})
|
})
|
||||||
|
|
||||||
ui.Handle("/sys/kbd/m", func(ui.Event) {
|
ui.Handle("/sys/kbd/<enter>", func(ui.Event) {
|
||||||
menu = ContainerMenu
|
menu = ContainerMenu
|
||||||
ui.StopLoop()
|
ui.StopLoop()
|
||||||
})
|
})
|
||||||
@@ -101,7 +101,7 @@ func Display() bool {
|
|||||||
menu = LogMenu
|
menu = LogMenu
|
||||||
ui.StopLoop()
|
ui.StopLoop()
|
||||||
})
|
})
|
||||||
ui.Handle("/sys/kbd/<enter>", func(ui.Event) {
|
ui.Handle("/sys/kbd/o", func(ui.Event) {
|
||||||
single = true
|
single = true
|
||||||
ui.StopLoop()
|
ui.StopLoop()
|
||||||
})
|
})
|
||||||
|
|||||||
5
menus.go
5
menus.go
@@ -114,7 +114,7 @@ func ContainerMenu() {
|
|||||||
m.Selectable = true
|
m.Selectable = true
|
||||||
|
|
||||||
m.BorderLabel = "Menu"
|
m.BorderLabel = "Menu"
|
||||||
var items []menu.Item
|
items := []menu.Item{menu.Item{Val: "single", Label: "single view"}}
|
||||||
if c.Meta["state"] == "running" {
|
if c.Meta["state"] == "running" {
|
||||||
items = append(items, menu.Item{Val: "stop", Label: "stop"})
|
items = append(items, menu.Item{Val: "stop", Label: "stop"})
|
||||||
}
|
}
|
||||||
@@ -131,6 +131,9 @@ func ContainerMenu() {
|
|||||||
HandleKeys("down", m.Down)
|
HandleKeys("down", m.Down)
|
||||||
ui.Handle("/sys/kbd/<enter>", func(ui.Event) {
|
ui.Handle("/sys/kbd/<enter>", func(ui.Event) {
|
||||||
switch m.SelectedItem().Val {
|
switch m.SelectedItem().Val {
|
||||||
|
case "single":
|
||||||
|
SingleView(c)
|
||||||
|
ui.StopLoop()
|
||||||
case "start":
|
case "start":
|
||||||
c.Start()
|
c.Start()
|
||||||
ui.StopLoop()
|
ui.StopLoop()
|
||||||
|
|||||||
Reference in New Issue
Block a user