mirror of
https://github.com/rzuasti/oott.git
synced 2026-07-08 19:21:54 +02:00
Add "go to last page" and page count to notifications and devices lists
The list endpoints now return a total count alongside the page so the
front-end can show how many pages exist and offer a last-page jump.
Backend: add count(is_new) and count_devices(...) (sharing a WHERE-builder
with list_devices so page and count can't drift), wrap both list responses
in {items, total_count} structs, and register them with utoipa.
Front-end: parse the wrapper shape (dropping the fetch-one-extra trick),
add a Last-page button and a responsive "Page X of Y" / "X / Y" label to
the shared PaginationBar, and track the total in both lists. Notifications
re-sync the count on every fetch and decrement it locally on mark-read/
unread removals so the count stays accurate without a re-fetch.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.8
parent
3cb104e364
commit
844d7d189c
@@ -74,6 +74,14 @@ Map<String, dynamic> notificationJson({
|
||||
'mac_address': macAddress,
|
||||
};
|
||||
|
||||
/// Wraps a page of items in the paged-list response shape the list endpoints
|
||||
/// return: `{items: [...], total_count: N}`. [totalCount] defaults to the page
|
||||
/// length, so single-page stubs stay terse; pass it to simulate more pages.
|
||||
Map<String, dynamic> pagedListJson(
|
||||
List<Map<String, dynamic>> items, {
|
||||
int? totalCount,
|
||||
}) => {'items': items, 'total_count': totalCount ?? items.length};
|
||||
|
||||
/// Shape shared by the ARP and SNMP scanners (run-on-interval scanners).
|
||||
Map<String, dynamic> intervalScannerJson({
|
||||
bool isRunning = false,
|
||||
|
||||
Reference in New Issue
Block a user