ensure the correct active ns is listed when in node view

mine
derailed 2019-10-03 14:23:47 -06:00
parent 11a0d1bb28
commit 332b62f4c1
3 changed files with 9 additions and 3 deletions

View File

@ -35,8 +35,8 @@ func (v *nodeView) sortColCmd(col int, asc bool) func(evt *tcell.EventKey) *tcel
}
}
func (v *nodeView) showPods(app *appView, _, res, sel string) {
showPods(app, "", "", "spec.nodeName="+sel, v.backCmd)
func (v *nodeView) showPods(app *appView, _, _, sel string) {
showPods(app, app.Config.ActiveNamespace(), "", "spec.nodeName="+sel, v.backCmd)
}
func (v *nodeView) backCmd(evt *tcell.EventKey) *tcell.EventKey {
@ -46,6 +46,8 @@ func (v *nodeView) backCmd(evt *tcell.EventKey) *tcell.EventKey {
}
func showPods(app *appView, ns, labelSel, fieldSel string, a ui.ActionHandler) {
app.switchNS(ns)
list := resource.NewPodList(app.Conn(), ns)
list.SetLabelSelector(labelSel)
list.SetFieldSelector(fieldSel)

View File

@ -313,6 +313,7 @@ func (v *resourceView) switchNamespaceCmd(evt *tcell.EventKey) *tcell.EventKey {
return nil
}
v.app.switchNS(ns)
v.setNamespace(ns)
v.app.Flash().Infof("Viewing `%s` namespace...", ns)
v.refresh()

View File

@ -63,7 +63,10 @@ type Informer struct {
// NewInformer creates a new cluster resource informer
func NewInformer(client k8s.Connection, ns string) (*Informer, error) {
i := Informer{client: client, informers: map[string]StoreInformer{}}
i := Informer{
client: client,
informers: map[string]StoreInformer{},
}
if err := client.CheckNSAccess(ns); err != nil {
log.Error().Err(err).Msg("Checking NS Access")
return nil, err