summaryrefslogtreecommitdiff
path: root/internal/tui/dashboard/model.go
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2026-03-08 22:03:01 +0200
committerPaul Buetow <paul@buetow.org>2026-03-08 22:03:01 +0200
commit0d1492291a3e20665d8a3a6b16d2eb4e13938cee (patch)
treeec09f7d660403478d23841cf541bdfa7f33aa70f /internal/tui/dashboard/model.go
parentd84902555621cc10b16a9641274b088e495f3714 (diff)
tui: restore global filter stack and anchored matches
Diffstat (limited to 'internal/tui/dashboard/model.go')
-rw-r--r--internal/tui/dashboard/model.go19
1 files changed, 18 insertions, 1 deletions
diff --git a/internal/tui/dashboard/model.go b/internal/tui/dashboard/model.go
index c5effe2..22d09c3 100644
--- a/internal/tui/dashboard/model.go
+++ b/internal/tui/dashboard/model.go
@@ -65,6 +65,7 @@ type Model struct {
refreshEvery time.Duration
keys common.KeyMap
globalFilter globalfilter.Filter
+ filterStack []string
pidFilter int
syscallsOffset int
syscallsTreemapSelection int
@@ -418,6 +419,12 @@ func (m *Model) handleScrollKey(msg tea.KeyPressMsg) (bool, tea.Cmd) {
streamWidth, streamHeight := streamViewport(m.width, m.height)
m.streamModel.SetViewport(streamWidth, streamHeight)
handled := m.streamModel.HandleTeaKey(msg)
+ if m.streamModel.ConsumeGlobalFilterUndoRequest() {
+ return true, func() tea.Msg { return messages.GlobalFilterUndoRequestedMsg{} }
+ }
+ if filter, action, ok := m.streamModel.ConsumeGlobalFilterRequest(); ok {
+ return true, func() tea.Msg { return messages.GlobalFilterRequestedMsg{Filter: filter, Action: action} }
+ }
if path, ok := m.streamModel.ConsumeOpenEditorRequest(); ok {
editorCmd, err := eventstream.EditorCommandForPath(path)
if err != nil {
@@ -543,6 +550,12 @@ func (m *Model) SetGlobalFilter(filter globalfilter.Filter) {
m.streamModel.SetFilter(eventstream.Filter(filter))
}
+// SetFilterStack forwards the shared global filter stack into dashboard views.
+func (m *Model) SetFilterStack(stack []string) {
+ m.filterStack = append(m.filterStack[:0], stack...)
+ m.streamModel.SetFilterStack(stack)
+}
+
// SetLiveTrie updates the live trie source used by the flamegraph tab.
func (m *Model) SetLiveTrie(liveTrie flamegraphtui.LiveTrieSource) {
m.liveTrie = liveTrie
@@ -612,7 +625,11 @@ func (m Model) View() tea.View {
}
func (m Model) filterSummary() string {
- return "filter: " + m.globalFilter.Summary()
+ summary := "filter: " + m.globalFilter.Summary()
+ if len(m.filterStack) == 0 {
+ return summary
+ }
+ return summary + " | stack: " + strings.Join(m.filterStack, " | ")
}
func (m Model) renderActiveContent(width, activeHeight int, streamModel *eventstream.Model) string {