Build out the admin panel
- Overview: users, organizations, workspaces, spaces, pages, files and storage (org admins see their organization), plus pages open right now, the search index size, and version, uptime and database health. - Users: invite people by email (with resend, revoke and a copyable link when mail fails) and send a password-reset email. - Authentication: sign-up on or off, the email-domain allow-list, and sign-in links by email. - Branding: instance name, accent colour and logo. The web app shows them on the sign-in pages and applies the accent colour everywhere. - Email and Storage: SMTP and S3 settings with test buttons. - Maintenance: create, download and delete database backups, and a view of the background jobs with their last run, duration and errors. On the server, a small jobs registry records each search-indexing pass, and "search.rebuild" replaces the separate reindex endpoint. A new instance package serves the dashboard numbers, health and backups. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
92cd81fd96
commit
ffc6cc4fbc
31 files changed
+2326
-134
No files matched your search
@@ -16,12 +16,6 @@ type SearchService interface {
|
||||
Search(ctx context.Context, c access.Caller, wsID, text string, limit int) (directory.SearchResult, error)
|
||||
}
|
||||
|
||||
// SearchIndex is the index maintenance the admin panel can trigger.
|
||||
type SearchIndex interface {
|
||||
Rebuild(ctx context.Context) error
|
||||
Count() (uint64, error)
|
||||
}
|
||||
|
||||
func (a *api) searchRoutes(mux *routeMux) {
|
||||
mux.HandleFunc("GET /api/v1/workspaces/{id}/search", a.requireUser(func(w http.ResponseWriter, r *http.Request) {
|
||||
q := r.URL.Query()
|
||||
@@ -29,21 +23,4 @@ func (a *api) searchRoutes(mux *routeMux) {
|
||||
res, err := a.dir.Search(r.Context(), caller(r), r.PathValue("id"), q.Get("q"), min(max(limit, 0), 50))
|
||||
a.respond(w, res, err)
|
||||
}))
|
||||
mux.HandleFunc("POST /api/v1/admin/search/reindex", a.requireManager(func(w http.ResponseWriter, r *http.Request) {
|
||||
if err := access.ManageInstance(caller(r)); err != nil {
|
||||
a.writeError(w, err)
|
||||
return
|
||||
}
|
||||
if a.index == nil {
|
||||
writeJSON(w, http.StatusServiceUnavailable, map[string]string{"error": "unavailable"})
|
||||
return
|
||||
}
|
||||
// Rebuilding can take a while; it runs on after the response.
|
||||
go func() {
|
||||
if err := a.index.Rebuild(context.WithoutCancel(r.Context())); err != nil {
|
||||
a.log.Error("search: rebuild failed", "err", err)
|
||||
}
|
||||
}()
|
||||
w.WriteHeader(http.StatusAccepted)
|
||||
}))
|
||||
}
|
||||
Reference in new issue
Block a user