Two things the dashboard was missing: it could not act, and it was a column of numbers. Account administration moves to /admin/users — approving into a project, suspending, reinstating. That is the work an operator does constantly and it should not need a terminal. Three things stay on the CLI, and the line is not arbitrary: promoting someone to admin, resetting a password, and issuing a key on another person's behalf each turn a stolen admin session into more than it was — permanent access, or somebody else's account. Approving and suspending do not. Suspending signs the account out everywhere, or suspension is advisory until the session happens to expire, and an admin cannot suspend themselves, which is not a thing an interface should let you do by misclicking. The charts are inline SVG generated in Go. A charting library would mean a JavaScript toolchain in CI and a megabyte of bundle for what is a list of rectangles, and the single-binary goal rules that out. Hourly over a day: fine enough to show a working day, coarse enough that one slow minute is not an incident. Empty hours are filled in, because a chart with hours missing where nothing happened reads as a chart with hours missing from the data. The SVG is marked as trusted HTML, so everything that reaches it is either a number this package computed or escaped explicitly, and a bar's colour can only be one of four names — a colour that could be anything is a way to write CSS into every page the chart appears on. There are tests for both. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
e519dc587c
commit
859f08da9b
13 files changed
+687
-5
No files matched your search
@@ -235,3 +235,24 @@ func (s *SQLite) SetPassword(ctx context.Context, userID, hash string) error {
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// AllProjects lists every project with the path that identifies it.
|
||||
//
|
||||
// For the approval form, which has to offer somewhere to put a new account's
|
||||
// keys. Walking the tree in the page would mean three round trips per render.
|
||||
func (s *SQLite) AllProjects(ctx context.Context) ([]ProjectPath, error) {
|
||||
return queryAll(ctx, s.db, `
|
||||
SELECT p.id, o.name || ' / ' || t.name || ' / ' || p.name
|
||||
FROM projects p
|
||||
JOIN teams t ON t.id = p.team_id
|
||||
JOIN organizations o ON o.id = t.org_id
|
||||
ORDER BY 2`, nil, func(rows *sql.Rows) (ProjectPath, error) {
|
||||
var p ProjectPath
|
||||
return p, rows.Scan(&p.ID, &p.Path)
|
||||
})
|
||||
}
|
||||
|
||||
// ProjectPath is a project and where it sits in the tenancy tree.
|
||||
type ProjectPath struct {
|
||||
ID, Path string
|
||||
}
|
||||
Reference in new issue
Block a user