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
This commit is contained in:
matt wilkie
2025-11-21 14:17:35 -07:00
parent 44170fd503
commit 185ed2e93c
3 changed files with 64 additions and 21 deletions

View File

@@ -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)