From 185ed2e93cdc2c2cfae8485289eccb162bcab349 Mon Sep 17 00:00:00 2001 From: matt wilkie Date: Fri, 21 Nov 2025 14:17:35 -0700 Subject: [PATCH] feat(monitor-webui): fix priority filter and search clear button - Add event listeners for priority toggle and clear search buttons - Update priority filter to support multiple selections - Add dev mode to server for easier development --- examples/monitor-webui/main.go | 28 +++++++------ examples/monitor-webui/web/index.html | 13 +++--- examples/monitor-webui/web/static/js/app.js | 44 +++++++++++++++++++-- 3 files changed, 64 insertions(+), 21 deletions(-) diff --git a/examples/monitor-webui/main.go b/examples/monitor-webui/main.go index a42586ff..321bc0f9 100644 --- a/examples/monitor-webui/main.go +++ b/examples/monitor-webui/main.go @@ -27,6 +27,7 @@ var ( host = flag.String("host", "localhost", "Host to bind to") dbPath = flag.String("db", "", "Path to beads database (optional, will auto-detect)") socketPath = flag.String("socket", "", "Path to daemon socket (optional, will auto-detect)") + devMode = flag.Bool("dev", false, "Run in development mode (serve web files from disk)") // WebSocket upgrader upgrader = websocket.Upgrader{ @@ -45,6 +46,9 @@ var ( // RPC client for daemon communication daemonClient *rpc.Client + + // File system for web files + webFS fs.FS ) func main() { @@ -57,6 +61,19 @@ func main() { flag.Parse() + // Set up web file system + if *devMode { + fmt.Println("⚠️ Running in DEVELOPMENT mode: serving web files from disk") + webFS = os.DirFS("web") + } else { + var err error + webFS, err = fs.Sub(webFiles, "web") + if err != nil { + fmt.Fprintf(os.Stderr, "Error accessing embedded web files: %v\n", err) + os.Exit(1) + } + } + // Find database path if not specified dbPathResolved := *dbPath if dbPathResolved == "" { @@ -97,11 +114,6 @@ func main() { http.HandleFunc("/ws", handleWebSocket) // Serve static files - webFS, err := fs.Sub(webFiles, "web") - if err != nil { - fmt.Fprintf(os.Stderr, "Error accessing web files: %v\n", err) - os.Exit(1) - } http.Handle("/static/", http.StripPrefix("/", http.FileServer(http.FS(webFS)))) addr := fmt.Sprintf("%s:%d", *host, *port) @@ -167,12 +179,6 @@ func handleIndex(w http.ResponseWriter, r *http.Request) { return } - webFS, err := fs.Sub(webFiles, "web") - if err != nil { - http.Error(w, "Error accessing web files", http.StatusInternalServerError) - return - } - data, err := fs.ReadFile(webFS, "index.html") if err != nil { http.Error(w, "Error reading index.html", http.StatusInternalServerError) diff --git a/examples/monitor-webui/web/index.html b/examples/monitor-webui/web/index.html index 2d5b8a71..19187f3b 100644 --- a/examples/monitor-webui/web/index.html +++ b/examples/monitor-webui/web/index.html @@ -53,26 +53,27 @@
-
+
- + + + +
+