Add permanent device deletion and refine frontend UI/snackbars

Backend:
- Add db::devices::delete to erase a device and its events atomically
- Expose DELETE /api/devices/{mac}/permanently, wired to OpenAPI
- Cover the new db method and endpoint with tests

Frontend:
- Delete action for not-registered devices (detail screen + list row)
  and an opt-in "permanently delete" checkbox in the Forget dialog
- Navigate to the devices list after deleting from the detail screen
- Refine button emphasis to M3: single filled primary, error-colored
  text buttons for destructive actions, Test demoted to filled-tonal
- Flash the backend-config Test button red on a failed connection test
- Render snackbars through a top-level ScaffoldMessenger host so they
  show above dialogs; keep the built-in SnackBar (with an Overlay host)

Docs:
- CLAUDE.md: rustfmt edition 2024, don't revert formatter-only changes,
  prefer built-in Flutter components, follow existing patterns + M3

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
rzuasti
2026-06-12 09:49:11 -04:00
co-authored by Claude Opus 4.8
parent 2541d0989c
commit 587e097291
20 changed files with 1021 additions and 177 deletions
@@ -464,6 +464,8 @@ class _DeviceActionsMenu extends StatelessWidget {
await confirmForgetDevice(context, device, onRefresh);
} else if (value == 'register') {
await showRegisterDeviceDialog(context, device, onRefresh);
} else if (value == 'delete') {
await confirmDeleteDevice(context, device, onRefresh);
}
},
itemBuilder: (context) => [
@@ -474,6 +476,8 @@ class _DeviceActionsMenu extends StatelessWidget {
const PopupMenuItem(value: 'forget', child: Text('Forget')),
if (!device.isRegistered)
const PopupMenuItem(value: 'register', child: Text('Register')),
if (!device.isRegistered)
const PopupMenuItem(value: 'delete', child: Text('Delete')),
],
);
}