From 16473cb1c582581c57ce8ee5362c1da6e399606e Mon Sep 17 00:00:00 2001 From: derailed Date: Sat, 4 Jan 2020 14:12:37 -0700 Subject: [PATCH] checkpoint --- internal/dao/generic.go | 6 +++--- internal/dao/resource.go | 2 +- internal/ui/flash.go | 3 +-- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/internal/dao/generic.go b/internal/dao/generic.go index df22b44f..4739fc88 100644 --- a/internal/dao/generic.go +++ b/internal/dao/generic.go @@ -21,7 +21,7 @@ type Generic struct { NonResource } -// Describe describes a k8s resource. +// Describe describes a resource. func (g *Generic) Describe(path string) (string, error) { return Describe(g.Client(), g.gvr, path) } @@ -40,7 +40,7 @@ func (g *Generic) ToYAML(path string) (string, error) { return raw, nil } -// List returns a collection of nodes. +// List returns a collection of resources. func (g *Generic) List(ctx context.Context, ns string) ([]runtime.Object, error) { labelSel, ok := ctx.Value(internal.KeyLabels).(string) if !ok { @@ -72,7 +72,7 @@ func (g *Generic) List(ctx context.Context, ns string) ([]runtime.Object, error) return oo, nil } -// List returns a collection of node resources. +// Get returns a given resource. func (g *Generic) Get(ctx context.Context, path string) (runtime.Object, error) { var opts metav1.GetOptions diff --git a/internal/dao/resource.go b/internal/dao/resource.go index 0736c9f2..dc012d98 100644 --- a/internal/dao/resource.go +++ b/internal/dao/resource.go @@ -39,7 +39,7 @@ func (r *Resource) Get(ctx context.Context, path string) (runtime.Object, error) return r.Factory.Get(r.gvr.String(), path, true, labels.Everything()) } -// List returns a collection of nodes. +// List returns a collection of resources. func (r *Resource) List(ctx context.Context, ns string) ([]runtime.Object, error) { strLabel, ok := ctx.Value(internal.KeyLabels).(string) lsel := labels.Everything() diff --git a/internal/ui/flash.go b/internal/ui/flash.go index 8a6d6aef..43f091d0 100644 --- a/internal/ui/flash.go +++ b/internal/ui/flash.go @@ -101,6 +101,7 @@ func (f *Flash) Errf(fmat string, args ...interface{}) { f.SetMessage(FlashErr, fmt.Sprintf(fmat, args...)) } +// SetMessage sets flash message and level. func (f *Flash) SetMessage(level FlashLevel, msg ...string) { if f.cancel != nil { f.cancel() @@ -125,10 +126,8 @@ func (f *Flash) refresh(ctx1, ctx2 context.Context, cancel context.CancelFunc) { defer cancel() for { select { - // Timer canceled bail now case <-ctx1.Done(): return - // Timed out clear and bail case <-ctx2.Done(): f.app.QueueUpdateDraw(func() { f.Clear()