diff options
| author | Paul Buetow <paul@buetow.org> | 2026-02-25 21:45:28 +0200 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2026-02-25 21:45:28 +0200 |
| commit | 329543c14c07776a9a1de1284ab1f825cd4fa496 (patch) | |
| tree | 2ffd16ae290f2a24e1210bb912dbebc9f506fbc2 /internal | |
| parent | f6acb83f5b666659e34d092811fb9ff628a85494 (diff) | |
Add probes key binding to dashboard keymap
Diffstat (limited to 'internal')
| -rw-r--r-- | internal/tui/common/keys.go | 6 | ||||
| -rw-r--r-- | internal/tui/common/keys_test.go | 33 |
2 files changed, 37 insertions, 2 deletions
diff --git a/internal/tui/common/keys.go b/internal/tui/common/keys.go index 92d946c..4945b3b 100644 --- a/internal/tui/common/keys.go +++ b/internal/tui/common/keys.go @@ -14,6 +14,7 @@ type KeyMap struct { Six key.Binding Seven key.Binding DirGroup key.Binding + Probes key.Binding Export key.Binding Quit key.Binding Help key.Binding @@ -38,6 +39,7 @@ func DefaultKeyMap() KeyMap { Six: key.NewBinding(key.WithKeys("6"), key.WithHelp("6", "stream")), Seven: key.NewBinding(key.WithKeys("7"), key.WithHelp("7", "stream")), DirGroup: key.NewBinding(key.WithKeys("d"), key.WithHelp("d", "dir group")), + Probes: key.NewBinding(key.WithKeys("p"), key.WithHelp("p", "probes")), Export: key.NewBinding(key.WithKeys("e"), key.WithHelp("e", "export")), Quit: key.NewBinding(key.WithKeys("q", "ctrl+c"), key.WithHelp("q", "quit")), Help: key.NewBinding(key.WithKeys("?"), key.WithHelp("?", "help")), @@ -53,7 +55,7 @@ func (k KeyMap) DashboardShortHelp() []key.Binding { if help := k.Export.Help(); help.Key != "" || help.Desc != "" { bindings = append(bindings, k.Export) } - bindings = append(bindings, k.Help, k.Quit) + bindings = append(bindings, k.Probes, k.Help, k.Quit) return bindings } @@ -63,7 +65,7 @@ func (k KeyMap) DashboardFullHelp() [][]key.Binding { if help := k.Export.Help(); help.Key != "" || help.Desc != "" { controls = append(controls, k.Export) } - controls = append(controls, k.DirGroup, k.Refresh, k.Help, k.Quit) + controls = append(controls, k.DirGroup, k.Probes, k.Refresh, k.Help, k.Quit) return [][]key.Binding{ {k.One, k.Two, k.Three, k.Four, k.Five, k.Six}, diff --git a/internal/tui/common/keys_test.go b/internal/tui/common/keys_test.go index e8762c9..000dc9c 100644 --- a/internal/tui/common/keys_test.go +++ b/internal/tui/common/keys_test.go @@ -8,6 +8,11 @@ func TestDefaultKeyMapIncludesDirGroupBinding(t *testing.T) { if help.Key != "d" || help.Desc != "dir group" { t.Fatalf("unexpected dir group binding help: key=%q desc=%q", help.Key, help.Desc) } + + probesHelp := keys.Probes.Help() + if probesHelp.Key != "p" || probesHelp.Desc != "probes" { + t.Fatalf("unexpected probes binding help: key=%q desc=%q", probesHelp.Key, probesHelp.Desc) + } } func TestDashboardFullHelpIncludesDirGroupBinding(t *testing.T) { @@ -28,4 +33,32 @@ func TestDashboardFullHelpIncludesDirGroupBinding(t *testing.T) { if !found { t.Fatalf("expected dir group binding in dashboard full help controls") } + + found = false + for _, binding := range groups[1] { + help := binding.Help() + if help.Key == "p" && help.Desc == "probes" { + found = true + break + } + } + if !found { + t.Fatalf("expected probes binding in dashboard full help controls") + } +} + +func TestDashboardShortHelpIncludesProbesBinding(t *testing.T) { + keys := DefaultKeyMap() + short := keys.DashboardShortHelp() + found := false + for _, binding := range short { + help := binding.Help() + if help.Key == "p" && help.Desc == "probes" { + found = true + break + } + } + if !found { + t.Fatalf("expected probes binding in dashboard short help") + } } |
