Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
derailed committed Nov 16, 2024
1 parent e544500 commit da9f0a8
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 6 deletions.
3 changes: 3 additions & 0 deletions internal/client/helper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,9 @@ func TestIsNamespaced(t *testing.T) {
"all": {
ns: client.NamespaceAll,
},
"cluster": {
ns: client.ClusterScope,
},
"none": {
ns: client.BlankNamespace,
},
Expand Down
2 changes: 1 addition & 1 deletion internal/client/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ func IsAllNamespaces(ns string) bool {

// IsNamespaced returns true if a specific ns is given.
func IsNamespaced(ns string) bool {
return !IsAllNamespaces(ns)
return !IsAllNamespaces(ns) && !IsClusterScoped(ns)
}

// IsClusterScoped returns true if resource is not namespaced.
Expand Down
2 changes: 1 addition & 1 deletion internal/color/colorize.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ func Highlight(bb []byte, ii []int, c int) []byte {
b := make([]byte, 0, len(bb))
for i, j := 0, 0; i < len(bb); i++ {
if j < len(ii) && ii[j] == i {
b = append(b, colorizeByte(bb[i], 209)...)
b = append(b, colorizeByte(bb[i], c)...)
j++
} else {
b = append(b, bb[i])
Expand Down
7 changes: 3 additions & 4 deletions internal/model1/table_data.go
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ func (t *TableData) rxFilter(q string, inverse bool) (*RowEvents, error) {
if _, ok := t.header.IndexOf("NAMESPACE", true); ok && client.IsNamespaced(t.namespace) {
startIndex = 1
}
rr := NewRowEvents(50)
rr := NewRowEvents(t.RowCount() / 2)
ageIndex, _ := t.header.IndexOf("AGE", true)
t.rowEvents.Range(func(_ int, re RowEvent) bool {
ff := re.Row.Fields[startIndex:]
Expand Down Expand Up @@ -212,12 +212,11 @@ func (t *TableData) fuzzyFilter(q string) *RowEvents {
}

func (t *TableData) filterToast() *RowEvents {
rr := NewRowEvents(10)
idx, ok := t.header.IndexOf("VALID", true)
if !ok {
return nil
return rr
}

rr := NewRowEvents(10)
t.rowEvents.Range(func(_ int, re RowEvent) bool {
if re.Row.Fields[idx] != "" {
rr.Add(re)
Expand Down

0 comments on commit da9f0a8

Please sign in to comment.