Add Register and Forget actions to devices list

Adds a context menu to each device card with contextual actions:
- Unregistered devices show a Register option (dialog with owner field
  and device type dropdown)
- Registered devices show a Forget option (confirmation dialog)

Also fixes CORS to allow PUT and DELETE methods, adds device type
tooltips on the icon, and renames the "New" filter/badge to
"Not registered".

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
rzuasti
2026-05-27 15:33:24 -04:00
co-authored by Claude Sonnet 4.6
parent d0b9855bad
commit 3094753587
5 changed files with 242 additions and 32 deletions
+6
View File
@@ -80,6 +80,12 @@ pub async fn serve() -> Result<(), Box<dyn Error>> {
// Allow all origins and headers for API
let cors_layer = CorsLayer::new()
.allow_origin(Any)
.allow_methods([
http::Method::GET,
http::Method::POST,
http::Method::PUT,
http::Method::DELETE,
])
.allow_headers([http::header::AUTHORIZATION, http::header::CONTENT_TYPE]);
let router = Router::new()
-1
View File
@@ -164,7 +164,6 @@ pub async fn unregister(Path(mac_address): Path<String>) -> impl IntoResponse {
device.is_registered = false;
device.owner = "".to_string();
device.device_type = "".to_string();
match db::devices::update(device) {
Ok(_) => (axum::http::StatusCode::OK, "Device un-registered"),