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
+18
View File
@@ -98,6 +98,24 @@ class BackendAPI {
.toList();
}
Future<void> registerDevice(
String macAddress,
String owner,
String deviceType,
) async {
debugPrint('About to call PUT /devices');
await _dio.put('/devices', data: {
'mac_address': macAddress,
'owner': owner,
'device_type': deviceType,
});
}
Future<void> forgetDevice(String macAddress) async {
debugPrint('About to call DELETE /devices/$macAddress');
await _dio.delete('/devices/$macAddress');
}
Future<List<Notification>> listNotifications(bool? isNew, int offset) async {
debugPrint('About to call /notifications');