This commit is contained in:
redlineo committed 2026-07-22 17:13:35 +03:00
1 parent e39ad275b5
commit 3d7e3a88f2
14 files changed
+710 -234

No files matched your search

+33 -13
View File
@@ -38,6 +38,7 @@ const (
scrGroupHostsPick
scrExportSelect
scrExportResult
scrConfigUpdateSelect
scrConfigUpdateResult
scrAudit
scrQuitConfirm
@@ -83,6 +84,15 @@ func newList(items []list.Item, title string, w, h int) list.Model {
l.Title = title
l.Styles.Title = listTitleStyle
l.SetShowStatusBar(false)
// bubbles/list binds "q" (and ForceQuit) to return tea.Quit directly,
// bypassing whatever screen it's on. Every screen except the main menu
// falls through unhandled keys straight into the list's own Update, so
// without this, pressing "q" on the Users/Groups/Catalog screens would
// quit the whole program immediately — skipping attemptQuit's warnings
// about unexported or stale-config users entirely. The menu handles "q"
// itself before reaching the list, so disabling it here is harmless
// there and load-bearing everywhere else.
l.DisableQuitKeybindings()
return l
}
@@ -118,15 +128,17 @@ type Model struct {
serviceFormFocus int
serviceFormEditTarget string // "" = creating a new service
// groups: named policies that reference a subset of catalog hosts
groupsList list.Model
groupForm [2]textinput.Model // name, description
groupFormFocus int
groupFormEditTarget string // "" = creating a new group
selectedGroup string
groupHostsPickSel map[string]bool
groupHostsPickOrder []string
groupHostsPickCursor int
// groups: named policies that reference individual catalog services,
// picked via a host -> services tree (see groups.go)
groupsList list.Model
groupForm [2]textinput.Model // name, description
groupFormFocus int
groupFormEditTarget string // "" = creating a new group
selectedGroup string
groupPickRows []pickRow
groupPickServices map[string][]string // host -> its service names, snapshot at screen-entry
groupPickSel map[string]bool // key "host/service" -> selected
groupPickCursor int
exportSel map[string]bool
exportOrder []string
@@ -136,11 +148,19 @@ type Model struct {
exportPass string
exportErr string
configUpdateSel map[string]bool
configUpdateOrder []string
configUpdateCursor int
configUpdateRes []keymgr.ConfigOnlyResult
configUpdatePass string
configUpdateErr string
onlineSessions []audit.OnlineSession
recentEvents []audit.Event
quitReturnTo screen // screen to go back to if quit is cancelled
quitPending []string // usernames with no key issued yet, shown on scrQuitConfirm
quitStale []string // usernames whose config is out of date, shown on scrQuitConfirm
// generic confirmation for destructive actions (lock/delete user,
// delete host/service/group, export key rotation) — see confirm.go.
@@ -155,10 +175,6 @@ type Model struct {
confirmInput textinput.Model
confirmError string
configUpdateUser string
configUpdateArchive string
configUpdatePass string
width, height int
}
@@ -257,6 +273,8 @@ func (m Model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
return m.updateExportSelect(msg)
case scrExportResult:
return m.updateExportResult(msg)
case scrConfigUpdateSelect:
return m.updateConfigUpdateSelect(msg)
case scrConfigUpdateResult:
return m.updateConfigUpdateResult(msg)
case scrAudit:
@@ -298,6 +316,8 @@ func (m Model) View() string {
body = m.viewExportSelect()
case scrExportResult:
body = m.viewExportResult()
case scrConfigUpdateSelect:
body = m.viewConfigUpdateSelect()
case scrConfigUpdateResult:
body = m.viewConfigUpdateResult()
case scrAudit: