feat: / filters the account pane
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
3913989cd1
commit
0a80073aad
7 files changed
+61
-62
No files matched your search
@@ -361,6 +361,7 @@ func New(providers []provider.Provider, opts Options) Model {
|
||||
nvimOpen: nvimOpen,
|
||||
cache: newCache(),
|
||||
groups: map[string]groupsState{},
|
||||
srcDetail: panes.NewSourceDetail(),
|
||||
}
|
||||
if m.clip == nil {
|
||||
m.clip = clipboard.New()
|
||||
@@ -927,6 +928,10 @@ func (m *Model) focusedFilter() filterable {
|
||||
return &m.containers
|
||||
case paneSecrets:
|
||||
return &m.secrets
|
||||
case paneDetail:
|
||||
if m.srcDetail.Shown() {
|
||||
return &m.srcDetail
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -1115,7 +1115,7 @@ func TestAccountPane(t *testing.T) {
|
||||
t.Fatalf("focus %v, want the fourth pane", d.m.focus)
|
||||
}
|
||||
scr := d.screen()
|
||||
for _, want := range []string{"Account", "Alice Example", "groups 2", "Platform team", "Vault readers"} {
|
||||
for _, want := range []string{"Alice Example", "groups 2", "Platform team", "Vault readers"} {
|
||||
if !strings.Contains(scr, want) {
|
||||
t.Errorf("missing %q:\n%s", want, scr)
|
||||
}
|
||||
@@ -1132,6 +1132,23 @@ func TestAccountPane(t *testing.T) {
|
||||
if got := d.clip().content; got != "Vault readers" {
|
||||
t.Errorf("y on a group copied %q", got)
|
||||
}
|
||||
|
||||
// / filters it, labels too.
|
||||
d.keys("/")
|
||||
d.typeText("vault")
|
||||
d.keys("enter")
|
||||
if scr := d.screen(); !strings.Contains(scr, "Vault readers") || strings.Contains(scr, "Platform team") {
|
||||
t.Errorf("filtered:\n%s", scr)
|
||||
}
|
||||
d.keys("y")
|
||||
if got := d.clip().content; got != "Vault readers" {
|
||||
t.Errorf("y in the filtered pane copied %q", got)
|
||||
}
|
||||
d.keys("esc")
|
||||
if !strings.Contains(d.screen(), "Platform team") {
|
||||
t.Errorf("filter not cleared:\n%s", d.screen())
|
||||
}
|
||||
|
||||
d.keys("shift+tab")
|
||||
if d.m.focus != paneSources {
|
||||
t.Errorf("back to %v, want Sources", d.m.focus)
|
||||
|
||||
@@ -47,7 +47,7 @@ func (c contextHelp) ShortHelp() []key.Binding {
|
||||
}
|
||||
if c.focus == paneDetail && c.account {
|
||||
copyField := key.NewBinding(key.WithKeys(k.Copy.Keys()...), key.WithHelp(k.Copy.Help().Key, "copy"))
|
||||
return append(b, k.Up, k.Down, copyField, k.Help, k.Quit)
|
||||
return append(b, k.Up, k.Down, copyField, k.Filter, k.Help, k.Quit)
|
||||
}
|
||||
switch c.focus {
|
||||
case paneSources:
|
||||
|
||||
@@ -182,7 +182,7 @@ func (m Model) panesView() string {
|
||||
func() string { return m.secrets.View(m.st, m.active(paneSecrets), spin) },
|
||||
func() string {
|
||||
if m.srcDetail.Shown() {
|
||||
return m.srcDetail.View(m.st, m.active(paneDetail))
|
||||
return m.srcDetail.View(m.st, m.active(paneDetail), spin)
|
||||
}
|
||||
return m.detail.View(m.st, m.active(paneDetail), spin)
|
||||
},
|
||||
|
||||
@@ -57,7 +57,7 @@ func (m *Model) syncSourceDetail() tea.Cmd {
|
||||
}
|
||||
fields = append(fields, groupFields(st)...)
|
||||
}
|
||||
m.srcDetail.Set("Account", fields)
|
||||
m.srcDetail.Set(m.byID[r.provider].Label(), fields)
|
||||
return cmd
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user