fix pulses resource traversal
parent
5bbc159df9
commit
809b4554cb
|
|
@ -83,7 +83,6 @@ func (t *Table) RemoveListener(l TableListener) {
|
|||
|
||||
// Watch initiates model updates.
|
||||
func (t *Table) Watch(ctx context.Context) {
|
||||
log.Debug().Msgf("TABLE-WATCH %q", t.gvr)
|
||||
t.refresh(ctx)
|
||||
go t.updater(ctx)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -111,7 +111,7 @@ func (s *SparkLine) Draw(screen tcell.Screen) {
|
|||
if rect.Dx() > 0 && rect.Dy() > 0 && s.legend != "" {
|
||||
legend := s.legend
|
||||
if s.HasFocus() {
|
||||
legend = "[:aqua:]" + s.legend + "[::]"
|
||||
legend = fmt.Sprintf("[%s:%s:]", s.focusFgColor, s.focusBgColor) + s.legend + "[::]"
|
||||
}
|
||||
tview.Print(screen, legend, rect.Min.X, rect.Max.Y, rect.Dx(), tview.AlignCenter, tcell.ColorWhite)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -564,7 +564,9 @@ func (a *App) gotoResource(cmd, path string, clearStack bool) error {
|
|||
|
||||
c := NewMeow(a, err.Error())
|
||||
_ = c.Init(context.Background())
|
||||
a.Content.Stack.Clear()
|
||||
if clearStack {
|
||||
a.Content.Stack.Clear()
|
||||
}
|
||||
a.Content.Push(c)
|
||||
|
||||
return nil
|
||||
|
|
|
|||
|
|
@ -130,13 +130,13 @@ func (b *Browser) Start() {
|
|||
|
||||
// Stop terminates browser updates.
|
||||
func (b *Browser) Stop() {
|
||||
b.GetModel().RemoveListener(b)
|
||||
b.CmdBuff().RemoveListener(b)
|
||||
b.Table.Stop()
|
||||
if b.cancelFn != nil {
|
||||
b.cancelFn()
|
||||
b.cancelFn = nil
|
||||
}
|
||||
b.GetModel().RemoveListener(b)
|
||||
b.CmdBuff().RemoveListener(b)
|
||||
b.Table.Stop()
|
||||
}
|
||||
|
||||
// BufferChanged indicates the buffer was changed.
|
||||
|
|
@ -198,9 +198,10 @@ func (b *Browser) Aliases() []string {
|
|||
|
||||
// TableDataChanged notifies view new data is available.
|
||||
func (b *Browser) TableDataChanged(data render.TableData) {
|
||||
if !b.app.ConOK() {
|
||||
if !b.app.ConOK() || b.cancelFn == nil {
|
||||
return
|
||||
}
|
||||
|
||||
b.app.QueueUpdateDraw(func() {
|
||||
b.refreshActions()
|
||||
b.Update(data)
|
||||
|
|
@ -418,6 +419,9 @@ func (b *Browser) defaultContext() context.Context {
|
|||
}
|
||||
|
||||
func (b *Browser) refreshActions() {
|
||||
if b.App().Content.Top().Name() != b.Name() {
|
||||
return
|
||||
}
|
||||
aa := ui.KeyActions{
|
||||
ui.KeyC: ui.NewKeyAction("Copy", b.cpCmd, false),
|
||||
tcell.KeyEnter: ui.NewKeyAction("View", b.enterCmd, false),
|
||||
|
|
|
|||
|
|
@ -16,7 +16,6 @@ import (
|
|||
"github.com/derailed/k9s/internal/ui"
|
||||
"github.com/derailed/tview"
|
||||
"github.com/gdamore/tcell"
|
||||
"github.com/rs/zerolog/log"
|
||||
)
|
||||
|
||||
// Grapheable represents a graphic component.
|
||||
|
|
@ -286,10 +285,6 @@ func (p *Pulse) Actions() ui.KeyActions {
|
|||
|
||||
// Hints returns the view hints.
|
||||
func (p *Pulse) Hints() model.MenuHints {
|
||||
log.Debug().Msgf("PULSES -- HINTS!!")
|
||||
for k := range p.actions {
|
||||
log.Debug().Msgf("KEY %v", p.actions[k].Description)
|
||||
}
|
||||
return p.actions.Hints()
|
||||
}
|
||||
|
||||
|
|
@ -311,8 +306,11 @@ func (p *Pulse) enterCmd(evt *tcell.EventKey) *tcell.EventKey {
|
|||
if !ok {
|
||||
return nil
|
||||
}
|
||||
gvr := client.NewGVR(s.ID())
|
||||
if err := p.App().gotoResource(gvr.R()+" all", "", false); err != nil {
|
||||
res := client.NewGVR(s.ID()).R()
|
||||
if res == "cpu" || res == "mem" {
|
||||
res = "pod"
|
||||
}
|
||||
if err := p.App().gotoResource(res+" all", "", false); err != nil {
|
||||
p.App().Flash().Err(err)
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue