summaryrefslogtreecommitdiff
path: root/internal/tui/dashboard/model.go
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2026-03-01 23:45:37 +0200
committerPaul Buetow <paul@buetow.org>2026-03-01 23:45:37 +0200
commit5775246cb9c2ccfb3469addf6f5fe9a8fc198171 (patch)
tree96290d1bede538c9fd352bc3954bac1ce8ab6873 /internal/tui/dashboard/model.go
parent3b4be9171b7ca13d4ff3e51d14c4e569b1a308f7 (diff)
Thread runtime config instead of global flags reads
Diffstat (limited to 'internal/tui/dashboard/model.go')
-rw-r--r--internal/tui/dashboard/model.go12
1 files changed, 10 insertions, 2 deletions
diff --git a/internal/tui/dashboard/model.go b/internal/tui/dashboard/model.go
index c9c96c3..fc9caf6 100644
--- a/internal/tui/dashboard/model.go
+++ b/internal/tui/dashboard/model.go
@@ -39,6 +39,7 @@ type Model struct {
refreshEvery time.Duration
keys common.KeyMap
+ pidFilter int
syscallsOffset int
filesOffset int
filesDirGrouped bool
@@ -63,6 +64,7 @@ func NewModelWithConfig(engine SnapshotSource, streamSource *eventstream.RingBuf
engine: engine,
refreshEvery: time.Duration(refreshMs) * time.Millisecond,
keys: keys,
+ pidFilter: -1,
streamModel: eventstream.NewModel(streamSource),
}
}
@@ -280,6 +282,11 @@ func (m *Model) SetStreamSource(source *eventstream.RingBuffer) {
m.streamModel.SetSource(source)
}
+// SetPidFilter updates the active PID filter used by tab render hints.
+func (m *Model) SetPidFilter(pid int) {
+ m.pidFilter = pid
+}
+
// View renders the tab bar, active tab scaffold, and help bar.
func (m Model) View() string {
width, height := common.EffectiveViewport(m.width, m.height)
@@ -299,6 +306,7 @@ func (m Model) View() string {
&streamModel,
width,
activeHeight,
+ m.pidFilter,
m.syscallsOffset,
m.filesOffset,
m.filesDirGrouped,
@@ -318,7 +326,7 @@ func tickCmd(d time.Duration) tea.Cmd {
return tea.Tick(d, func(time.Time) tea.Msg { return refreshTickMsg{} })
}
-func renderActiveTab(tab Tab, snap *statsengine.Snapshot, streamModel *eventstream.Model, width, height, syscallsOffset, filesOffset int, filesDirGrouped bool, filesDirOffset, processesOffset int) string {
+func renderActiveTab(tab Tab, snap *statsengine.Snapshot, streamModel *eventstream.Model, width, height, pidFilter, syscallsOffset, filesOffset int, filesDirGrouped bool, filesDirOffset, processesOffset int) string {
if tab == TabStream {
if streamModel == nil {
return common.PanelStyle.Render("Stream: waiting for source...")
@@ -341,7 +349,7 @@ func renderActiveTab(tab Tab, snap *statsengine.Snapshot, streamModel *eventstre
}
return renderFilesWithOffset(snap, width, height, filesOffset)
case TabProcesses:
- return renderProcessesWithOffset(snap, width, height, processesOffset)
+ return renderProcessesWithOffset(snap, width, height, processesOffset, pidFilter)
case TabLatency:
return renderLatencyGapsTab(snap, width, height)
default: