Console: rotate a key, cap key lifetimes, test the webhooks; README, onboarding and console docs caught up
The README's status stopped at v0.9 and listed gaps since closed; onboarding still said there was no SSO and no roles. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
1b71c38f89
commit
4979e08d64
7 files changed
+111
-22
No files matched your search
@@ -648,6 +648,12 @@ func TestGuardrailsSayWhereTheyApplyFrom(t *testing.T) {
|
||||
if items := m.orgMenu(m.people.orgs[0]).items; !slices.ContainsFunc(items, func(i menuItem) bool { return i.label == "Guardrails…" }) {
|
||||
t.Error("no Guardrails… in the menu")
|
||||
}
|
||||
if items := m.orgMenu(m.people.orgs[0]).items; !slices.ContainsFunc(items, func(i menuItem) bool { return i.label == "Longest key lifetime…" }) {
|
||||
t.Error("no Longest key lifetime… in the menu")
|
||||
}
|
||||
if items := m.keyMenu(store.KeyRow{}).items; !slices.ContainsFunc(items, func(i menuItem) bool { return i.label == "Rotate…" }) {
|
||||
t.Error("no Rotate… on a key")
|
||||
}
|
||||
}
|
||||
|
||||
func TestTheAuditViewListsChangesAndOpensOne(t *testing.T) {
|
||||
|
||||
@@ -536,6 +536,10 @@ func (m consoleModel) key(k tea.KeyMsg) (tea.Model, tea.Cmd) {
|
||||
case cOrgs:
|
||||
m.createOrgForm()
|
||||
}
|
||||
case "n":
|
||||
if m.menu == cMonitor {
|
||||
return m, m.runCLI("Test the webhooks", "ctl", "--server="+m.client.base, "notify", "test")
|
||||
}
|
||||
case "e":
|
||||
if m.menu == cUsage {
|
||||
m.usageExportForm()
|
||||
|
||||
@@ -258,7 +258,7 @@ func side(w int, a, b string) string {
|
||||
}
|
||||
|
||||
func (m consoleModel) monitorPanel(pw int) (string, string, string) {
|
||||
keys := "→ or Enter open · ↑↓ choose · Q leave"
|
||||
keys := "→ or Enter open · ↑↓ choose · N test the webhooks · Q leave"
|
||||
if m.inPanel {
|
||||
keys = "1–4 or R range · PgUp/PgDn scroll · ← back · Q leave"
|
||||
}
|
||||
|
||||
@@ -311,6 +311,18 @@ func (m consoleModel) keyMenu(k store.KeyRow) *menuDialog {
|
||||
name := k.Name + " (" + k.Prefix + ")"
|
||||
return &menuDialog{title: name, items: []menuItem{
|
||||
{"Its limits…", func(m *consoleModel) tea.Cmd { m.limitsForm(store.ScopeKey, k.ID, name); return nil }},
|
||||
{"Rotate…", func(m *consoleModel) tea.Cmd {
|
||||
m.openForm(&formDialog{title: "Rotate " + name,
|
||||
note: "A new key with the same project, owner and limits is shown once; this one keeps working for the overlap, then stops.",
|
||||
fields: []formField{textF("overlap", "24h", "how long both work, like 48h; 0 stops this one now")},
|
||||
submit: func(m *consoleModel, v []string) (tea.Cmd, error) {
|
||||
if _, err := time.ParseDuration(v[0]); err != nil {
|
||||
return nil, fmt.Errorf("overlap is a duration, like 24h")
|
||||
}
|
||||
return m.runCLI("Rotate "+name, "keys", "rotate", k.ID, "--overlap="+v[0]), nil
|
||||
}})
|
||||
return nil
|
||||
}},
|
||||
{"Revoke…", func(m *consoleModel) tea.Cmd {
|
||||
m.confirmD = &confirmDialog{title: "Revoke " + name,
|
||||
text: "It stops working at once. It is kept, revoked, for the usage that refers to it.",
|
||||
@@ -441,6 +453,20 @@ func (m consoleModel) orgMenu(r orgRow) *menuDialog {
|
||||
return nil
|
||||
}},
|
||||
menuItem{"Guardrails…", func(m *consoleModel) tea.Cmd { m.menuD = m.guardMenu(r); return nil }},
|
||||
menuItem{"Longest key lifetime…", func(m *consoleModel) tea.Cmd {
|
||||
m.openForm(&formDialog{title: "Longest key lifetime · " + r.path,
|
||||
note: "Keys made here get at most this, and this when none is asked for. Existing keys are not changed.",
|
||||
fields: []formField{textF("longest", "", "like 720h; off removes the limit here")},
|
||||
submit: func(m *consoleModel, v []string) (tea.Cmd, error) {
|
||||
if v[0] != "off" {
|
||||
if d, err := time.ParseDuration(v[0]); err != nil || d <= 0 {
|
||||
return nil, fmt.Errorf("a duration like 720h, or off")
|
||||
}
|
||||
}
|
||||
return m.runCLI("Key lifetime "+r.path, "keys", "ttl", r.level+":"+r.id, v[0]), nil
|
||||
}})
|
||||
return nil
|
||||
}},
|
||||
menuItem{"Capacity quota…", func(m *consoleModel) tea.Cmd {
|
||||
q := adminapi.QuotaView{Scope: r.level + ":" + r.id}
|
||||
for _, x := range m.quotas {
|
||||
|
||||
Reference in new issue
Block a user