repos / pico

pico services mono repo
git clone https://github.com/picosh/pico.git

commit
5a8cfee
parent
cf2f80c
author
Eric Bower
date
2025-03-19 11:24:42 -0400 EDT
fix(tui.tuns): filter by user
1 files changed,  +13, -10
M pkg/tui/tuns.go
+13, -10
 1@@ -161,11 +161,11 @@ func (m *TunsPage) connectToLogs() error {
 2 			continue
 3 		}
 4 
 5-		// user := parsedData.User
 6-		// userId := parsedData.UserId
 7-		// if user == m.shared.User.Name || userId == m.shared.User.ID {
 8-		m.shared.App.PostEvent(ResultLogLineLoaded{parsedData})
 9-		// }
10+		user := parsedData.User
11+		userId := parsedData.UserId
12+		if user == m.shared.User.Name || userId == m.shared.User.ID {
13+			m.shared.App.PostEvent(ResultLogLineLoaded{parsedData})
14+		}
15 	}
16 
17 	return nil
18@@ -175,7 +175,6 @@ func (m *TunsPage) Footer() []Shortcut {
19 	short := []Shortcut{
20 		{Shortcut: "j/k", Text: "choose"},
21 		{Shortcut: "tab", Text: "focus"},
22-		{Shortcut: "r", Text: "reload"},
23 	}
24 	return short
25 }
26@@ -211,10 +210,6 @@ func (m *TunsPage) HandleEvent(ev vaxis.Event, ph vxfw.EventPhase) (vxfw.Command
27 			m.selected = m.tuns[m.leftPane.Cursor()].TunAddress
28 			return vxfw.RedrawCmd{}, nil
29 		}
30-		if msg.Matches('r') {
31-			go m.fetchTuns()
32-			return nil, nil
33-		}
34 		if msg.Matches(vaxis.KeyTab) {
35 			var cmd vxfw.Widget
36 			if m.focus == "tuns" && m.selected != "" {
37@@ -381,6 +376,10 @@ func (m *TunsPage) fetchTuns() {
38 
39 	ls := []TunsClientSimple{}
40 	for _, val := range tMap {
41+		if val.User != m.shared.User.Name {
42+			continue
43+		}
44+
45 		for k := range val.RouteListeners.HttpListeners {
46 			ls = append(ls, TunsClientSimple{
47 				TunType:           "http",
48@@ -413,6 +412,10 @@ func (m *TunsPage) fetchTuns() {
49 	}
50 
51 	for _, val := range nMap {
52+		if val.User != m.shared.User.Name {
53+			continue
54+		}
55+
56 		for k := range val.RouteListeners.HttpListeners {
57 			ls = append(ls, TunsClientSimple{
58 				TunType:           "http",