feat: WebUI settings page with sidebar + ConfigRegistry integration

- /api/v1/settings endpoint: GET (list by prefix) + PUT (set key/value)
- Config tab redesigned: left sidebar (core + per-plugin) + right editor
- Sidebar groups: core.* and plugin.<name>.* from plugin registry
- Each setting rendered as editable input with save button
- WebUI now receives cfgReg and pluginReg from main
- handler_test.go updated with new NewHandler signature
This commit is contained in:
root
2026-07-03 08:39:30 +08:00
parent 9c33b3b149
commit 672b098c4e
4 changed files with 83 additions and 11 deletions

View File

@ -25,7 +25,7 @@ func newTestHandler(t *testing.T) (*Handler, *supervisor.Daemon) {
sup := supervisor.New(cfg)
sup.Start()
return NewHandler(sup, nil, nil, nil, cfg, nil, nil, nil, nil), sup
return NewHandler(sup, nil, nil, nil, cfg, nil, nil, nil, nil, nil, nil), sup
}
func TestHandleStatus(t *testing.T) {
@ -129,7 +129,7 @@ func TestHandleKnowledgeSearch(t *testing.T) {
sup.Start()
defer sup.Shutdown()
h := NewHandler(sup, nil, nil, nil, cfg, nil, nil, ks, nil)
h := NewHandler(sup, nil, nil, nil, cfg, nil, nil, ks, nil, nil, nil)
req := httptest.NewRequest(http.MethodGet, "/api/v1/knowledge?q=test", nil)
w := httptest.NewRecorder()
@ -161,7 +161,7 @@ func TestHandleKnowledgeCreate(t *testing.T) {
sup.Start()
defer sup.Shutdown()
h := NewHandler(sup, nil, nil, nil, cfg, nil, nil, ks, nil)
h := NewHandler(sup, nil, nil, nil, cfg, nil, nil, ks, nil, nil, nil)
body := `{"name":"new_doc","content":"fresh content"}`
req := httptest.NewRequest(http.MethodPost, "/api/v1/knowledge", strings.NewReader(body))
@ -226,7 +226,7 @@ func TestHandleTrackerStats(t *testing.T) {
sup.Start()
defer sup.Shutdown()
h := NewHandler(sup, nil, nil, nil, cfg, nil, nil, nil, tr)
h := NewHandler(sup, nil, nil, nil, cfg, nil, nil, nil, tr, nil, nil)
req := httptest.NewRequest(http.MethodGet, "/api/v1/tracker", nil)
w := httptest.NewRecorder()