clean up type assertions
parent
d89a641225
commit
be4f3f7222
|
|
@ -3,9 +3,9 @@ package views
|
|||
import (
|
||||
"strings"
|
||||
|
||||
"github.com/derailed/k9s/config"
|
||||
"github.com/derailed/k9s/resource"
|
||||
"github.com/derailed/k9s/resource/k8s"
|
||||
"github.com/derailed/k9s/config"
|
||||
"github.com/gdamore/tcell"
|
||||
)
|
||||
|
||||
|
|
@ -46,8 +46,9 @@ func (v *contextView) useContext(*tcell.EventKey) {
|
|||
|
||||
v.app.flash(flashInfo, "Switching context to", ctx)
|
||||
v.refresh()
|
||||
tv := v.GetPrimitive("ctx").(*tableView)
|
||||
tv.table.Select(0, 0)
|
||||
if tv, ok := v.GetPrimitive("ctx").(*tableView); ok {
|
||||
tv.table.Select(0, 0)
|
||||
}
|
||||
}
|
||||
|
||||
func (v *contextView) extraActions(aa keyActions) {
|
||||
|
|
|
|||
|
|
@ -102,7 +102,9 @@ func (v *resourceView) init(ctx context.Context, ns string) {
|
|||
}
|
||||
}(ctx)
|
||||
v.refreshActions()
|
||||
v.CurrentPage().Item.(*tableView).table.Select(0, 0)
|
||||
if tv, ok := v.CurrentPage().Item.(*tableView); ok {
|
||||
tv.table.Select(0, 0)
|
||||
}
|
||||
}
|
||||
|
||||
func (v *resourceView) getTitle() string {
|
||||
|
|
@ -247,7 +249,10 @@ func (v *resourceView) refresh() {
|
|||
}
|
||||
|
||||
func (v *resourceView) getTV() *tableView {
|
||||
return v.GetPrimitive(v.list.GetName()).(*tableView)
|
||||
if tv, ok := v.GetPrimitive(v.list.GetName()).(*tableView); ok {
|
||||
return tv
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (v *resourceView) getSelectedItem() string {
|
||||
|
|
|
|||
Loading…
Reference in New Issue