From db8fd367f68b1d4120fac2d5e0380f76e5cd0e94 Mon Sep 17 00:00:00 2001 From: Riz Ashraf Date: Sat, 12 Sep 2026 11:39:47 +0100 Subject: [PATCH] feat(dashboard): huge feature upgrade - native dark mode, interactive graph inspector panel, type filtering and legend, actionable kanban completion via new POST endpoint, and fuzzy search highlighting --- fix_main.py | 43 ++++ fix_route.py | 49 ++++ server/src/dashboard.html | 520 ++++++++++++++++++++++++++++++-------- server/src/main.rs | 16 ++ 4 files changed, 519 insertions(+), 109 deletions(-) create mode 100644 fix_main.py create mode 100644 fix_route.py diff --git a/fix_main.py b/fix_main.py new file mode 100644 index 0000000..19f15c1 --- /dev/null +++ b/fix_main.py @@ -0,0 +1,43 @@ +import re +import sys + +main_rs_path = r"C:\Users\reazul.ashraf\workspace\rust\mcp-memory\server\src\main.rs" + +with open(main_rs_path, "r", encoding="utf-8") as f: + content = f.read() + +# Add the route +route_code = """ + .route("/api/tasks/:id/complete", post({ + let state_clone = app_state.handler.state.clone(); + move |axum::extract::Path(id): axum::extract::Path| async move { + if let Ok(mut tasks) = state_clone.tasks.write() { + let mut found = false; + for t in tasks.iter_mut() { + if t.id == id { + t.status = "completed".to_string(); + found = true; + break; + } + } + if found { + let _ = state_clone.flush_store(); + return axum::Json(serde_json::json!({"status": "success"})); + } + } + axum::Json(serde_json::json!({"status": "not_found"})) + } + })) +""" + +# Find where to insert it (after /api/tasks) +if ".route(\"/api/tasks/:id/complete\"" not in content: + content = content.replace( + '.route("/api/tasks", get({', + route_code + '\n .route("/api/tasks", get({' + ) + +with open(main_rs_path, "w", encoding="utf-8") as f: + f.write(content) + +print("Injected /api/tasks/:id/complete route successfully.") diff --git a/fix_route.py b/fix_route.py new file mode 100644 index 0000000..3b496be --- /dev/null +++ b/fix_route.py @@ -0,0 +1,49 @@ +import re + +main_rs_path = r"C:\Users\reazul.ashraf\workspace\rust\mcp-memory\server\src\main.rs" + +with open(main_rs_path, "r", encoding="utf-8") as f: + content = f.read() + +# Replace the broken route +old_route = r""" .route("/api/tasks/:id/complete", post({ + let state_clone = app_state.handler.state.clone(); + move |axum::extract::Path(id): axum::extract::Path| async move { + if let Ok(mut tasks) = state_clone.tasks.write() { + let mut found = false; + for t in tasks.iter_mut() { + if t.id == id { + t.status = "completed".to_string(); + found = true; + break; + } + } + if found { + let _ = state_clone.flush_store(); + return axum::Json(serde_json::json!({"status": "success"})); + } + } + axum::Json(serde_json::json!({"status": "not_found"})) + } + }))""" + +new_route = """ .route("/api/tasks/:id/complete", post({ + let state_clone = app_state.handler.state.clone(); + move |axum::extract::Path(id): axum::extract::Path| async move { + state_clone.tasks.modify(|tasks| { + for t in tasks.iter_mut() { + if t.id == id { + t.status = "completed".to_string(); + break; + } + } + }); + axum::Json(serde_json::json!({"status": "success"})) + } + }))""" + +content = content.replace(old_route, new_route) + +with open(main_rs_path, "w", encoding="utf-8") as f: + f.write(content) +print("Replaced route.") diff --git a/server/src/dashboard.html b/server/src/dashboard.html index 47cc120..fb4bdf4 100644 --- a/server/src/dashboard.html +++ b/server/src/dashboard.html @@ -5,35 +5,84 @@ Antigravity Memory Hub