mirror of
https://github.com/jesseduffield/lazydocker.git
synced 2026-07-25 08:31:03 +00:00
fix some things
This commit is contained in:
parent
52040d1d99
commit
7f38cf2ab2
3 changed files with 11 additions and 11 deletions
|
|
@ -21,8 +21,9 @@ func (gui *Gui) renderContainerLogsToMain(container *commands.Container) tasks.T
|
||||||
Func: func(stop, notifyStopped chan struct{}) {
|
Func: func(stop, notifyStopped chan struct{}) {
|
||||||
gui.renderContainerLogsToMainAux(container, stop, notifyStopped)
|
gui.renderContainerLogsToMainAux(container, stop, notifyStopped)
|
||||||
},
|
},
|
||||||
Duration: time.Millisecond * 200,
|
Duration: time.Millisecond * 200,
|
||||||
Before: nil,
|
// TODO: see why this isn't working (when switching from Top tab to Logs tab in the services panel, the tops tab's content isn't removed)
|
||||||
|
Before: func(stop chan struct{}) { gui.clearMainView() },
|
||||||
Wrap: gui.Config.UserConfig.Gui.WrapMainPanel,
|
Wrap: gui.Config.UserConfig.Gui.WrapMainPanel,
|
||||||
Autoscroll: true,
|
Autoscroll: true,
|
||||||
})
|
})
|
||||||
|
|
@ -34,11 +35,7 @@ func (gui *Gui) renderContainerLogsToMainAux(container *commands.Container, stop
|
||||||
notifyStopped <- struct{}{}
|
notifyStopped <- struct{}{}
|
||||||
}()
|
}()
|
||||||
|
|
||||||
ctx, ctxCancel := context.WithCancel(context.Background())
|
ctx := stopIntoCtx(stop)
|
||||||
go func() {
|
|
||||||
<-stop
|
|
||||||
ctxCancel()
|
|
||||||
}()
|
|
||||||
|
|
||||||
mainView := gui.Views.Main
|
mainView := gui.Views.Main
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@ import (
|
||||||
|
|
||||||
"github.com/go-errors/errors"
|
"github.com/go-errors/errors"
|
||||||
"github.com/jesseduffield/gocui"
|
"github.com/jesseduffield/gocui"
|
||||||
|
"github.com/jesseduffield/lazydocker/pkg/tasks"
|
||||||
"github.com/jesseduffield/lazydocker/pkg/utils"
|
"github.com/jesseduffield/lazydocker/pkg/utils"
|
||||||
"github.com/samber/lo"
|
"github.com/samber/lo"
|
||||||
)
|
)
|
||||||
|
|
@ -63,7 +64,7 @@ var _ ISideListPanel = &SideListPanel[int]{}
|
||||||
|
|
||||||
type IGui interface {
|
type IGui interface {
|
||||||
HandleClick(v *gocui.View, itemCount int, selectedLine *int, handleSelect func() error) error
|
HandleClick(v *gocui.View, itemCount int, selectedLine *int, handleSelect func() error) error
|
||||||
RenderStringMain(message string)
|
NewSimpleRenderStringTask(getContent func() string) tasks.TaskFunc
|
||||||
FocusY(selectedLine int, itemCount int, view *gocui.View)
|
FocusY(selectedLine int, itemCount int, view *gocui.View)
|
||||||
ShouldRefresh(contextKey string) bool
|
ShouldRefresh(contextKey string) bool
|
||||||
GetMainView() *gocui.View
|
GetMainView() *gocui.View
|
||||||
|
|
@ -107,8 +108,7 @@ func (self *SideListPanel[T]) HandleSelect() error {
|
||||||
}
|
}
|
||||||
|
|
||||||
if self.NoItemsMessage != "" {
|
if self.NoItemsMessage != "" {
|
||||||
// TODO: use task for this
|
self.Gui.NewSimpleRenderStringTask(func() string { return self.NoItemsMessage })
|
||||||
self.Gui.RenderStringMain(self.NoItemsMessage)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
|
|
|
||||||
|
|
@ -35,6 +35,9 @@ func (gui *Gui) NewRenderStringTask(opts RenderStringTaskOpts) tasks.TaskFunc {
|
||||||
Autoscroll: opts.Autoscroll,
|
Autoscroll: opts.Autoscroll,
|
||||||
Wrap: opts.Wrap,
|
Wrap: opts.Wrap,
|
||||||
Func: func(stop chan struct{}) {
|
Func: func(stop chan struct{}) {
|
||||||
|
// GetStrContent may be a slow function, so we clear the main view first
|
||||||
|
// so that we're not seeing the previous tab's content appear.
|
||||||
|
gui.clearMainView()
|
||||||
gui.RenderStringMain(opts.GetStrContent())
|
gui.RenderStringMain(opts.GetStrContent())
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
@ -81,7 +84,7 @@ func (gui *Gui) NewTickerTask(opts TickerTaskOpts) tasks.TaskFunc {
|
||||||
gui.Log.Info("exiting ticker task due to notifyStopped channel")
|
gui.Log.Info("exiting ticker task due to notifyStopped channel")
|
||||||
return
|
return
|
||||||
case <-stop:
|
case <-stop:
|
||||||
gui.Log.Info("exiting ticker task due to stopped cahnnel")
|
gui.Log.Info("exiting ticker task due to stopped channel")
|
||||||
return
|
return
|
||||||
case <-tickChan.C:
|
case <-tickChan.C:
|
||||||
gui.Log.Info("running ticker task again")
|
gui.Log.Info("running ticker task again")
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue