summaryrefslogtreecommitdiff
path: root/internal/tui/dashboard/model.go
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2026-03-08 20:33:41 +0200
committerPaul Buetow <paul@buetow.org>2026-03-08 20:33:41 +0200
commit4ca02bb88cffb28bb000326688c6e8e7c1cbe8a9 (patch)
tree4c74aaaaa2c96c3a694a09c511836e485e3eeffc /internal/tui/dashboard/model.go
parent8236891a2c3a774a3eee2401980c10080aa85da6 (diff)
task 372: restart tracing when filters change
Diffstat (limited to 'internal/tui/dashboard/model.go')
-rw-r--r--internal/tui/dashboard/model.go21
1 files changed, 21 insertions, 0 deletions
diff --git a/internal/tui/dashboard/model.go b/internal/tui/dashboard/model.go
index a7d415d..5c3f690 100644
--- a/internal/tui/dashboard/model.go
+++ b/internal/tui/dashboard/model.go
@@ -4,6 +4,7 @@ import (
"strings"
"time"
+ "ior/internal/globalfilter"
"ior/internal/statsengine"
common "ior/internal/tui/common"
"ior/internal/tui/eventstream"
@@ -512,6 +513,11 @@ func (m Model) LatestSnapshot() *statsengine.Snapshot {
return m.latest
}
+// ActiveTab returns the currently selected dashboard tab.
+func (m Model) ActiveTab() Tab {
+ return m.activeTab
+}
+
// BlocksGlobalShortcuts reports whether the active tab should suppress a
// top-level shortcut for the given key press.
func (m Model) BlocksGlobalShortcuts(msg tea.KeyPressMsg) bool {
@@ -529,6 +535,12 @@ func (m *Model) SetStreamSource(source eventstream.Source) {
m.streamModel.SetSource(source)
}
+// SetGlobalFilter forwards the shared TUI filter into the stream tab so
+// buffered rows can be re-filtered immediately.
+func (m *Model) SetGlobalFilter(filter globalfilter.Filter) {
+ m.streamModel.SetFilter(eventstream.Filter(filter))
+}
+
// SetLiveTrie updates the live trie source used by the flamegraph tab.
func (m *Model) SetLiveTrie(liveTrie flamegraphtui.LiveTrieSource) {
m.liveTrie = liveTrie
@@ -539,6 +551,15 @@ func (m *Model) SetLiveTrie(liveTrie flamegraphtui.LiveTrieSource) {
m.flamegraphModel.RefreshFromLiveTrie()
}
+// PrepareForTraceRestart clears aggregate state while keeping the current tab
+// and retained stream rows intact for the next trace session.
+func (m *Model) PrepareForTraceRestart() {
+ m.latest = nil
+ m.liveTrie = nil
+ m.flamegraphModel.SetLiveTrie(nil)
+ m.refreshBubbleData()
+}
+
// SetDarkMode updates dashboard child models for the active theme.
func (m *Model) SetDarkMode(isDark bool) {
m.isDark = isDark