cleaning up
parent
80278ca107
commit
3d128d42e0
|
|
@ -53,7 +53,7 @@ Feeling like you want to be able to quickly switch around your favorite resource
|
|||
command: statefulsets
|
||||
```
|
||||
|
||||
Not feeling so hot? Your custom hotkeys list will be listed in the help view.`<?>`.
|
||||
Not feeling too `Hot`? No worried, your custom hotkeys list will be listed in the help view.`<?>`.
|
||||
|
||||
You can choose any keyboard shotcuts that make sense to you, provided they are not part of the standard K9s shortcuts list.
|
||||
|
||||
|
|
|
|||
|
|
@ -186,13 +186,15 @@ func loadPreferred(f Factory, m ResourceMetas) error {
|
|||
|
||||
func loadCRDs(f Factory, m ResourceMetas) error {
|
||||
log.Debug().Msgf("Loading CRDs...")
|
||||
oo, err := f.List("apiextensions.k8s.io/v1beta1/customresourcedefinitions", "", labels.Everything())
|
||||
const crdGVR = "apiextensions.k8s.io/v1beta1/customresourcedefinitions"
|
||||
_ = f.ForResource("", crdGVR)
|
||||
f.WaitForCacheSync()
|
||||
oo, err := f.List(crdGVR, "", labels.Everything())
|
||||
if err != nil {
|
||||
log.Error().Err(err).Msgf("Fail CRDs load")
|
||||
return nil
|
||||
}
|
||||
f.WaitForCacheSync()
|
||||
log.Debug().Msgf("CRDS count %d", len(oo))
|
||||
log.Debug().Msgf(">>> CRDS count %d", len(oo))
|
||||
|
||||
for _, o := range oo {
|
||||
meta, errs := extractMeta(o)
|
||||
|
|
@ -201,7 +203,6 @@ func loadCRDs(f Factory, m ResourceMetas) error {
|
|||
continue
|
||||
}
|
||||
gvr := client.NewGVR(meta.Group, meta.Version, meta.Name)
|
||||
log.Debug().Msgf("CRD %q", gvr)
|
||||
m[gvr] = meta
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -53,23 +53,28 @@ func NewTable(gvr string) *Table {
|
|||
}
|
||||
|
||||
func (t *Table) Init(ctx context.Context) {
|
||||
t.styles = mustExtractSyles(ctx)
|
||||
|
||||
t.SetFixed(1, 0)
|
||||
t.SetBorder(true)
|
||||
t.SetBackgroundColor(config.AsColor(t.styles.GetTable().BgColor))
|
||||
t.SetBorderColor(config.AsColor(t.styles.GetTable().FgColor))
|
||||
t.SetBorderFocusColor(config.AsColor(t.styles.Frame().Border.FocusColor))
|
||||
t.SetBorderAttributes(tcell.AttrBold)
|
||||
t.SetBorderPadding(0, 0, 1, 1)
|
||||
t.SetSelectable(true, false)
|
||||
t.SetSelectionChangedFunc(t.selectionChanged)
|
||||
t.SetInputCapture(t.keyboard)
|
||||
t.StylesChanged(mustExtractSyles(ctx))
|
||||
}
|
||||
|
||||
func (t *Table) StylesChanged(s *config.Styles) {
|
||||
t.styles = s
|
||||
t.SetBackgroundColor(config.AsColor(t.styles.GetTable().BgColor))
|
||||
t.SetBorderColor(config.AsColor(t.styles.GetTable().FgColor))
|
||||
t.SetBorderFocusColor(config.AsColor(t.styles.Frame().Border.FocusColor))
|
||||
t.SetSelectedStyle(
|
||||
tcell.ColorBlack,
|
||||
config.AsColor(t.styles.GetTable().CursorColor),
|
||||
tcell.AttrBold,
|
||||
)
|
||||
t.SetSelectionChangedFunc(t.selectionChanged)
|
||||
t.SetInputCapture(t.keyboard)
|
||||
t.Refresh()
|
||||
}
|
||||
|
||||
// Actions returns active menu bindings.
|
||||
|
|
@ -77,6 +82,11 @@ func (t *Table) Actions() KeyActions {
|
|||
return t.actions
|
||||
}
|
||||
|
||||
// Styles returns styling configurator.
|
||||
func (t *Table) Styles() *config.Styles {
|
||||
return t.styles
|
||||
}
|
||||
|
||||
// SendKey sends an keyboard event (testing only!).
|
||||
func (t *Table) SendKey(evt *tcell.EventKey) {
|
||||
t.keyboard(evt)
|
||||
|
|
|
|||
|
|
@ -348,6 +348,7 @@ func (a *App) Status(l ui.FlashLevel, msg string) {
|
|||
// StatusReset reset log back to normal.
|
||||
func (a *App) ClearStatus() {
|
||||
a.Logo().Reset()
|
||||
a.Flash().Clear()
|
||||
a.Draw()
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -42,12 +42,9 @@ func (d *Details) Init(_ context.Context) error {
|
|||
if d.title != "" {
|
||||
d.SetBorder(true)
|
||||
}
|
||||
d.SetBackgroundColor(d.app.Styles.BgColor())
|
||||
d.SetTextColor(d.app.Styles.FgColor())
|
||||
d.SetScrollable(true)
|
||||
d.SetWrap(true)
|
||||
d.SetDynamicColors(true)
|
||||
d.SetBorderFocusColor(config.AsColor(d.app.Styles.Frame().Border.FocusColor))
|
||||
d.SetHighlightColor(tcell.ColorOrange)
|
||||
d.SetTitleColor(tcell.ColorAqua)
|
||||
d.SetInputCapture(d.keyboard)
|
||||
|
|
@ -57,6 +54,7 @@ func (d *Details) Init(_ context.Context) error {
|
|||
})
|
||||
d.updateTitle()
|
||||
d.app.Styles.AddListener(d)
|
||||
d.StylesChanged(d.app.Styles)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
|
@ -64,6 +62,8 @@ func (d *Details) Init(_ context.Context) error {
|
|||
func (d *Details) StylesChanged(s *config.Styles) {
|
||||
d.SetBackgroundColor(d.app.Styles.BgColor())
|
||||
d.SetTextColor(d.app.Styles.FgColor())
|
||||
d.SetBorderFocusColor(config.AsColor(d.app.Styles.Frame().Border.FocusColor))
|
||||
|
||||
d.Update(d.buff)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -64,7 +64,6 @@ func (l *Log) Init(ctx context.Context) (err error) {
|
|||
}
|
||||
|
||||
l.SetBorder(true)
|
||||
l.SetBackgroundColor(config.AsColor(l.app.Styles.Views().Log.BgColor))
|
||||
l.SetBorderPadding(0, 0, 1, 1)
|
||||
l.SetDirection(tview.FlexRow)
|
||||
|
||||
|
|
@ -77,17 +76,24 @@ func (l *Log) Init(ctx context.Context) (err error) {
|
|||
}
|
||||
l.logs.SetWrap(false)
|
||||
l.logs.SetMaxBuffer(l.app.Config.K9s.LogBufferSize)
|
||||
l.logs.SetTextColor(config.AsColor(l.app.Styles.Views().Log.FgColor))
|
||||
l.logs.SetBackgroundColor(config.AsColor(l.app.Styles.Views().Log.BgColor))
|
||||
|
||||
l.ansiWriter = tview.ANSIWriter(l.logs, l.app.Styles.Views().Log.FgColor, l.app.Styles.Views().Log.BgColor)
|
||||
l.AddItem(l.logs, 0, 1, true)
|
||||
l.bindKeys()
|
||||
l.logs.SetInputCapture(l.keyboard)
|
||||
|
||||
l.StylesChanged(l.app.Styles)
|
||||
l.app.Styles.AddListener(l)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (l *Log) StylesChanged(s *config.Styles) {
|
||||
l.SetBackgroundColor(config.AsColor(s.Views().Log.BgColor))
|
||||
l.logs.SetTextColor(config.AsColor(s.Views().Log.FgColor))
|
||||
l.logs.SetBackgroundColor(config.AsColor(s.Views().Log.BgColor))
|
||||
}
|
||||
|
||||
// Hints returns a collection of menu hints.
|
||||
func (l *Log) Hints() model.MenuHints {
|
||||
return l.logs.Actions().Hints()
|
||||
|
|
@ -111,6 +117,7 @@ func (l *Log) Stop() {
|
|||
l.cancelFn()
|
||||
l.cancelFn = nil
|
||||
}
|
||||
l.app.Styles.RemoveListener(l)
|
||||
}
|
||||
|
||||
func (l *Log) Name() string { return logTitle }
|
||||
|
|
|
|||
|
|
@ -49,12 +49,14 @@ func (t *Table) Start() {
|
|||
t.Stop()
|
||||
t.SearchBuff().AddListener(t.app.Cmd())
|
||||
t.SearchBuff().AddListener(t)
|
||||
t.Styles().AddListener(t.Table)
|
||||
}
|
||||
|
||||
// Stop terminates the component.
|
||||
func (t *Table) Stop() {
|
||||
t.SearchBuff().RemoveListener(t.app.Cmd())
|
||||
t.SearchBuff().RemoveListener(t)
|
||||
t.Styles().RemoveListener(t.Table)
|
||||
}
|
||||
|
||||
// SetEnterFn specifies the default enter behavior.
|
||||
|
|
|
|||
Loading…
Reference in New Issue