diff options
| author | Paul Buetow <paul@buetow.org> | 2026-03-06 18:08:19 +0200 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2026-03-06 18:08:19 +0200 |
| commit | 99a6cf4787fd92a25a53acbc9c0bae8bca87cc96 (patch) | |
| tree | 0c6f6506e944a0eed0fcefa7b9394681c5f178da /internal/tui/common | |
| parent | 1561987330cb898f5ff64383a9c78e7e6559f118 (diff) | |
feat(tui): add dashboard bubble viz and expand help shortcuts
Diffstat (limited to 'internal/tui/common')
| -rw-r--r-- | internal/tui/common/keys.go | 11 | ||||
| -rw-r--r-- | internal/tui/common/keys_test.go | 34 |
2 files changed, 44 insertions, 1 deletions
diff --git a/internal/tui/common/keys.go b/internal/tui/common/keys.go index ab9865d..02fee2b 100644 --- a/internal/tui/common/keys.go +++ b/internal/tui/common/keys.go @@ -19,6 +19,8 @@ type KeyMap struct { Five key.Binding Six key.Binding Seven key.Binding + Visualize key.Binding + Metric key.Binding DirGroup key.Binding SelectPID key.Binding SelectTID key.Binding @@ -45,6 +47,8 @@ func DefaultKeyMap() KeyMap { Five: key.NewBinding(key.WithKeys("5"), key.WithHelp("5", "processes")), Six: key.NewBinding(key.WithKeys("6"), key.WithHelp("6", "lat+gaps")), Seven: key.NewBinding(key.WithKeys("7"), key.WithHelp("7", "stream")), + Visualize: key.NewBinding(key.WithKeys("v"), key.WithHelp("v", "viz")), + Metric: key.NewBinding(key.WithKeys("b"), key.WithHelp("b", "metric")), DirGroup: key.NewBinding(key.WithKeys("d"), key.WithHelp("d", "dir group")), SelectPID: key.NewBinding(key.WithKeys("p"), key.WithHelp("p", "select pid")), SelectTID: key.NewBinding(key.WithKeys("t"), key.WithHelp("t", "select tid")), @@ -53,7 +57,7 @@ func DefaultKeyMap() KeyMap { Quit: key.NewBinding(key.WithKeys("q", "ctrl+c"), key.WithHelp("q", "quit")), Enter: key.NewBinding(key.WithKeys("enter"), key.WithHelp("enter", "select")), Esc: key.NewBinding(key.WithKeys("esc"), key.WithHelp("esc", "back")), - Refresh: key.NewBinding(key.WithKeys("r"), key.WithHelp("r", "refresh")), + Refresh: key.NewBinding(key.WithKeys("r"), key.WithHelp("r", "reset baseline")), } } @@ -84,6 +88,8 @@ func (k KeyMap) DashboardStatusHelpSections() []HelpSection { k.Five, k.Six, k.Seven, + k.Visualize, + k.Metric, k.SelectPID, k.SelectTID, k.Probes, @@ -95,6 +101,8 @@ func (k KeyMap) DashboardStatusHelpSections() []HelpSection { } dashboard := []key.Binding{ k.DirGroup, + k.Visualize, + k.Metric, helpTextBinding("space", "stream pause"), helpTextBinding("f", "stream filter"), helpTextBinding("g/G", "stream top/tail"), @@ -125,6 +133,7 @@ func (k KeyMap) DashboardFullHelp() [][]key.Binding { controls = append(controls, k.Export) } controls = append(controls, k.DirGroup, k.SelectPID, k.SelectTID, k.Probes, k.Refresh, k.Quit) + controls = append(controls, k.Visualize, k.Metric) return [][]key.Binding{ {k.One, k.Two, k.Three, k.Four, k.Five, k.Six, k.Seven}, diff --git a/internal/tui/common/keys_test.go b/internal/tui/common/keys_test.go index 4284faf..a2b5940 100644 --- a/internal/tui/common/keys_test.go +++ b/internal/tui/common/keys_test.go @@ -28,6 +28,16 @@ func TestDefaultKeyMapIncludesDirGroupBinding(t *testing.T) { if flameHelp.Key != "1" || flameHelp.Desc != "flame" { t.Fatalf("unexpected flame binding help: key=%q desc=%q", flameHelp.Key, flameHelp.Desc) } + + visualizeHelp := keys.Visualize.Help() + if visualizeHelp.Key != "v" || visualizeHelp.Desc != "viz" { + t.Fatalf("unexpected visualize binding help: key=%q desc=%q", visualizeHelp.Key, visualizeHelp.Desc) + } + + metricHelp := keys.Metric.Help() + if metricHelp.Key != "b" || metricHelp.Desc != "metric" { + t.Fatalf("unexpected metric binding help: key=%q desc=%q", metricHelp.Key, metricHelp.Desc) + } } func TestDashboardFullHelpIncludesDirGroupBinding(t *testing.T) { @@ -96,6 +106,30 @@ func TestDashboardFullHelpIncludesDirGroupBinding(t *testing.T) { if !found { t.Fatalf("expected select tid binding in dashboard full help controls") } + + found = false + for _, binding := range groups[1] { + help := binding.Help() + if help.Key == "v" && help.Desc == "viz" { + found = true + break + } + } + if !found { + t.Fatalf("expected viz binding in dashboard full help controls") + } + + found = false + for _, binding := range groups[1] { + help := binding.Help() + if help.Key == "b" && help.Desc == "metric" { + found = true + break + } + } + if !found { + t.Fatalf("expected metric binding in dashboard full help controls") + } } func TestDashboardStatusHelpIncludesProbesBinding(t *testing.T) { |
