Commit 4dce36e
Eric Bower
·
2026-01-16 22:41:06 -0500 EST
parent 2340a56
fix(tui.access_logs): start at last access with cmds to go to top or bot list
1 files changed,
+17,
-1
+17,
-1
| ... | ... | @@ -40,6 +40,8 @@ func (m *AccessLogsPage) Footer() []Shortcut { | |
| 40 | 40 | return []Shortcut{ | |
| 41 | 41 | {Shortcut: "tab", Text: "focus"}, | |
| 42 | 42 | {Shortcut: "^r", Text: "refresh"}, | |
| 43 | + | {Shortcut: "g", Text: "top"}, | |
| 44 | + | {Shortcut: "G", Text: "bottom"}, | |
| 43 | 45 | } | |
| 44 | 46 | } | |
| 45 | 47 |
| ... | ... | @@ -72,7 +74,7 @@ func (m *AccessLogsPage) filterLogs() { | |
| 72 | 74 | m.filtered = filtered | |
| 73 | 75 | ||
| 74 | 76 | if len(filtered) > 0 { | |
| 75 | - | m.list.SetCursor(0) | |
| 77 | + | m.list.SetCursor(uint(len(filtered) - 1)) | |
| 76 | 78 | } | |
| 77 | 79 | } | |
| 78 | 80 |
| ... | ... | @@ -121,6 +123,20 @@ func (m *AccessLogsPage) HandleEvent(ev vaxis.Event, phase vxfw.EventPhase) (vxf | |
| 121 | 123 | go m.fetchLogs() | |
| 122 | 124 | return vxfw.RedrawCmd{}, nil | |
| 123 | 125 | } | |
| 126 | + | if msg.Matches('g') { | |
| 127 | + | // Go to top | |
| 128 | + | if len(m.filtered) > 0 { | |
| 129 | + | m.list.SetCursor(0) | |
| 130 | + | return vxfw.RedrawCmd{}, nil | |
| 131 | + | } | |
| 132 | + | } | |
| 133 | + | if msg.Matches('G') { | |
| 134 | + | // Go to bottom | |
| 135 | + | if len(m.filtered) > 0 { | |
| 136 | + | m.list.SetCursor(uint(len(m.filtered) - 1)) | |
| 137 | + | return vxfw.RedrawCmd{}, nil | |
| 138 | + | } | |
| 139 | + | } | |
| 124 | 140 | } | |
| 125 | 141 | return nil, nil | |
| 126 | 142 | } |