mirror of
https://github.com/jesseduffield/lazydocker.git
synced 2026-07-23 23:51:03 +00:00
Support cycling the log tail count from the services panel too
The services panel's Logs tab renders the underlying container's logs through the same code path, so bind 't' there as well and include the tail value in the services context cache key so the tab re-renders when the value changes. Also switch the tail-limiting writer to SetContent so the clear+rewrite is atomic and the view never renders empty in between.
This commit is contained in:
parent
e57958fc3b
commit
d5f6eee69f
12 changed files with 24 additions and 3 deletions
|
|
@ -46,6 +46,7 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||||
<kbd>S</kbd>: start
|
<kbd>S</kbd>: start
|
||||||
<kbd>a</kbd>: anbinden
|
<kbd>a</kbd>: anbinden
|
||||||
<kbd>m</kbd>: zeige Protokolle
|
<kbd>m</kbd>: zeige Protokolle
|
||||||
|
<kbd>t</kbd>: cycle how many log lines are shown
|
||||||
<kbd>U</kbd>: up project
|
<kbd>U</kbd>: up project
|
||||||
<kbd>D</kbd>: down project
|
<kbd>D</kbd>: down project
|
||||||
<kbd>R</kbd>: zeige Neustartoptionen
|
<kbd>R</kbd>: zeige Neustartoptionen
|
||||||
|
|
|
||||||
|
|
@ -46,6 +46,7 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||||
<kbd>S</kbd>: start
|
<kbd>S</kbd>: start
|
||||||
<kbd>a</kbd>: attach
|
<kbd>a</kbd>: attach
|
||||||
<kbd>m</kbd>: view logs
|
<kbd>m</kbd>: view logs
|
||||||
|
<kbd>t</kbd>: cycle how many log lines are shown
|
||||||
<kbd>U</kbd>: up project
|
<kbd>U</kbd>: up project
|
||||||
<kbd>D</kbd>: down project
|
<kbd>D</kbd>: down project
|
||||||
<kbd>R</kbd>: view restart options
|
<kbd>R</kbd>: view restart options
|
||||||
|
|
|
||||||
|
|
@ -46,6 +46,7 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||||
<kbd>S</kbd>: iniciar
|
<kbd>S</kbd>: iniciar
|
||||||
<kbd>a</kbd>: attach
|
<kbd>a</kbd>: attach
|
||||||
<kbd>m</kbd>: ver logs
|
<kbd>m</kbd>: ver logs
|
||||||
|
<kbd>t</kbd>: cycle how many log lines are shown
|
||||||
<kbd>U</kbd>: levantar proyecto
|
<kbd>U</kbd>: levantar proyecto
|
||||||
<kbd>D</kbd>: dar de baja el proyecto
|
<kbd>D</kbd>: dar de baja el proyecto
|
||||||
<kbd>R</kbd>: ver opciones de reinicio
|
<kbd>R</kbd>: ver opciones de reinicio
|
||||||
|
|
|
||||||
|
|
@ -46,6 +46,7 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||||
<kbd>S</kbd>: démarrer
|
<kbd>S</kbd>: démarrer
|
||||||
<kbd>a</kbd>: attacher
|
<kbd>a</kbd>: attacher
|
||||||
<kbd>m</kbd>: voir les enregistrements
|
<kbd>m</kbd>: voir les enregistrements
|
||||||
|
<kbd>t</kbd>: cycle how many log lines are shown
|
||||||
<kbd>U</kbd>: up project
|
<kbd>U</kbd>: up project
|
||||||
<kbd>D</kbd>: down project
|
<kbd>D</kbd>: down project
|
||||||
<kbd>R</kbd>: voir les options de redémarrage
|
<kbd>R</kbd>: voir les options de redémarrage
|
||||||
|
|
|
||||||
|
|
@ -46,6 +46,7 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||||
<kbd>S</kbd>: start
|
<kbd>S</kbd>: start
|
||||||
<kbd>a</kbd>: verbinden
|
<kbd>a</kbd>: verbinden
|
||||||
<kbd>m</kbd>: bekijk logs
|
<kbd>m</kbd>: bekijk logs
|
||||||
|
<kbd>t</kbd>: cycle how many log lines are shown
|
||||||
<kbd>U</kbd>: up project
|
<kbd>U</kbd>: up project
|
||||||
<kbd>D</kbd>: down project
|
<kbd>D</kbd>: down project
|
||||||
<kbd>R</kbd>: bekijk herstart opties
|
<kbd>R</kbd>: bekijk herstart opties
|
||||||
|
|
|
||||||
|
|
@ -46,6 +46,7 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||||
<kbd>S</kbd>: start
|
<kbd>S</kbd>: start
|
||||||
<kbd>a</kbd>: przyczep
|
<kbd>a</kbd>: przyczep
|
||||||
<kbd>m</kbd>: pokaż logi
|
<kbd>m</kbd>: pokaż logi
|
||||||
|
<kbd>t</kbd>: cycle how many log lines are shown
|
||||||
<kbd>U</kbd>: up project
|
<kbd>U</kbd>: up project
|
||||||
<kbd>D</kbd>: down project
|
<kbd>D</kbd>: down project
|
||||||
<kbd>R</kbd>: pokaż opcje restartu
|
<kbd>R</kbd>: pokaż opcje restartu
|
||||||
|
|
|
||||||
|
|
@ -46,6 +46,7 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||||
<kbd>S</kbd>: iniciar
|
<kbd>S</kbd>: iniciar
|
||||||
<kbd>a</kbd>: anexar
|
<kbd>a</kbd>: anexar
|
||||||
<kbd>m</kbd>: ver logs
|
<kbd>m</kbd>: ver logs
|
||||||
|
<kbd>t</kbd>: cycle how many log lines are shown
|
||||||
<kbd>U</kbd>: subir projeto
|
<kbd>U</kbd>: subir projeto
|
||||||
<kbd>D</kbd>: derrubar projeto
|
<kbd>D</kbd>: derrubar projeto
|
||||||
<kbd>R</kbd>: ver opções de reinício
|
<kbd>R</kbd>: ver opções de reinício
|
||||||
|
|
|
||||||
|
|
@ -46,6 +46,7 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||||
<kbd>S</kbd>: start
|
<kbd>S</kbd>: start
|
||||||
<kbd>a</kbd>: bağlan/iliştir
|
<kbd>a</kbd>: bağlan/iliştir
|
||||||
<kbd>m</kbd>: kayıt defterini görüntüle
|
<kbd>m</kbd>: kayıt defterini görüntüle
|
||||||
|
<kbd>t</kbd>: cycle how many log lines are shown
|
||||||
<kbd>U</kbd>: up project
|
<kbd>U</kbd>: up project
|
||||||
<kbd>D</kbd>: down project
|
<kbd>D</kbd>: down project
|
||||||
<kbd>R</kbd>: yeniden başlatma seçeneklerini görüntüle
|
<kbd>R</kbd>: yeniden başlatma seçeneklerini görüntüle
|
||||||
|
|
|
||||||
|
|
@ -46,6 +46,7 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||||
<kbd>S</kbd>: 启动项目
|
<kbd>S</kbd>: 启动项目
|
||||||
<kbd>a</kbd>: attach
|
<kbd>a</kbd>: attach
|
||||||
<kbd>m</kbd>: 查看日志
|
<kbd>m</kbd>: 查看日志
|
||||||
|
<kbd>t</kbd>: cycle how many log lines are shown
|
||||||
<kbd>U</kbd>: 创建并启动容器
|
<kbd>U</kbd>: 创建并启动容器
|
||||||
<kbd>D</kbd>: 停止并移除容器
|
<kbd>D</kbd>: 停止并移除容器
|
||||||
<kbd>R</kbd>: 查看重启选项
|
<kbd>R</kbd>: 查看重启选项
|
||||||
|
|
|
||||||
|
|
@ -44,6 +44,10 @@ func (gui *Gui) cycleContainerLogsTail(g *gocui.Gui, v *gocui.View) error {
|
||||||
|
|
||||||
gui.State.ContainerLogsTail = containerLogsTailPresets[(currentIdx+1)%len(containerLogsTailPresets)]
|
gui.State.ContainerLogsTail = containerLogsTailPresets[(currentIdx+1)%len(containerLogsTailPresets)]
|
||||||
|
|
||||||
|
if v != nil && v.Name() == "services" {
|
||||||
|
return gui.Panels.Services.HandleSelect()
|
||||||
|
}
|
||||||
|
|
||||||
return gui.Panels.Containers.HandleSelect()
|
return gui.Panels.Containers.HandleSelect()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -77,8 +81,9 @@ func (w *tailLimitingWriter) Write(p []byte) (int, error) {
|
||||||
w.lines = w.lines[excess:]
|
w.lines = w.lines[excess:]
|
||||||
}
|
}
|
||||||
|
|
||||||
w.view.Clear()
|
// SetContent clears and rewrites atomically, so the view never renders empty
|
||||||
fmt.Fprint(w.view, strings.Join(w.lines, "\n")+"\n")
|
// in between
|
||||||
|
w.view.SetContent(strings.Join(w.lines, "\n") + "\n")
|
||||||
|
|
||||||
return len(p), nil
|
return len(p), nil
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -325,6 +325,13 @@ func (gui *Gui) GetInitialKeybindings() []*Binding {
|
||||||
Handler: gui.handleServiceRenderLogsToMain,
|
Handler: gui.handleServiceRenderLogsToMain,
|
||||||
Description: gui.Tr.ViewLogs,
|
Description: gui.Tr.ViewLogs,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
ViewName: "services",
|
||||||
|
Key: 't',
|
||||||
|
Modifier: gocui.ModNone,
|
||||||
|
Handler: gui.cycleContainerLogsTail,
|
||||||
|
Description: gui.Tr.CycleContainerLogsTail,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
ViewName: "services",
|
ViewName: "services",
|
||||||
Key: 'U',
|
Key: 'U',
|
||||||
|
|
|
||||||
|
|
@ -53,7 +53,7 @@ func (gui *Gui) getServicesPanel() *panels.SideListPanel[*commands.Service] {
|
||||||
if service.Container == nil {
|
if service.Container == nil {
|
||||||
return "services-" + service.ID
|
return "services-" + service.ID
|
||||||
}
|
}
|
||||||
return "services-" + service.ID + "-" + service.Container.ID + "-" + service.Container.Container.State
|
return "services-" + service.ID + "-" + service.Container.ID + "-" + service.Container.Container.State + "-" + gui.State.ContainerLogsTail
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
ListPanel: panels.ListPanel[*commands.Service]{
|
ListPanel: panels.ListPanel[*commands.Service]{
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue