summaryrefslogtreecommitdiff
path: root/internal/tui/eventstream
diff options
context:
space:
mode:
Diffstat (limited to 'internal/tui/eventstream')
-rw-r--r--internal/tui/eventstream/filter.go9
-rw-r--r--internal/tui/eventstream/filter_test.go8
-rw-r--r--internal/tui/eventstream/render.go3
3 files changed, 14 insertions, 6 deletions
diff --git a/internal/tui/eventstream/filter.go b/internal/tui/eventstream/filter.go
index 61d8c33..801b8ba 100644
--- a/internal/tui/eventstream/filter.go
+++ b/internal/tui/eventstream/filter.go
@@ -1,6 +1,9 @@
package eventstream
-import "ior/internal/globalfilter"
+import (
+ "ior/internal/globalfilter"
+ "ior/internal/globalfilter/parser"
+)
type CompareOp = globalfilter.CompareOp
type NumericFilter = globalfilter.NumericFilter
@@ -16,6 +19,8 @@ const (
OpLte = globalfilter.OpLte
)
+// ParseDurationNs delegates to parser.ParseDurationNs, re-exporting the
+// duration parsing helper for eventstream callers.
func ParseDurationNs(input string) (int64, error) {
- return globalfilter.ParseDurationNs(input)
+ return parser.ParseDurationNs(input)
}
diff --git a/internal/tui/eventstream/filter_test.go b/internal/tui/eventstream/filter_test.go
index 0413904..efedbe4 100644
--- a/internal/tui/eventstream/filter_test.go
+++ b/internal/tui/eventstream/filter_test.go
@@ -3,6 +3,8 @@ package eventstream
import (
"strings"
"testing"
+
+ "ior/internal/globalfilter/presenter"
)
func sampleEvent() StreamEvent {
@@ -31,8 +33,8 @@ func TestFilterZeroValueMatchesAll(t *testing.T) {
if f.IsActive() {
t.Fatalf("zero-value filter should be inactive")
}
- if got := f.Summary(); got != "all" {
- t.Fatalf("Summary() = %q, want all", got)
+ if got := presenter.FilterSummary(f); got != "all" {
+ t.Fatalf("FilterSummary() = %q, want all", got)
}
}
@@ -120,7 +122,7 @@ func TestFilterSummaryIncludesActivePredicates(t *testing.T) {
PID: &NumericFilter{Op: OpEq, Value: 1234},
LatencyNs: &NumericFilter{Op: OpGt, Value: 1000000},
}
- got := f.Summary()
+ got := presenter.FilterSummary(f)
for _, wantPart := range []string{"errors", "syscall~read", "pid=1234", "latency>1ms"} {
if !strings.Contains(got, wantPart) {
t.Fatalf("Summary() = %q, missing %q", got, wantPart)
diff --git a/internal/tui/eventstream/render.go b/internal/tui/eventstream/render.go
index 4d7970b..cd4d528 100644
--- a/internal/tui/eventstream/render.go
+++ b/internal/tui/eventstream/render.go
@@ -5,6 +5,7 @@ import (
"strconv"
"strings"
+ "ior/internal/globalfilter/presenter"
"ior/internal/tui/common"
"charm.land/lipgloss/v2"
@@ -75,7 +76,7 @@ func renderStatusLine(paused bool, totalCount, filteredCount, bufferLen, bufferC
}
func renderFilterLine(filter Filter) string {
- summary := filter.Summary()
+ summary := presenter.FilterSummary(filter)
if summary == "all" {
summary = common.HighlightStyle.Render(summary)
}