Files
oott/frontend/lib/model/passive_scanner_status.dart
T
rzuasti 48d73fb207 Consolidate frontend scanner, pagination, and tick-timer duplication
Collapse the five scanner status models into two shared shapes,
ActiveScannerStatus and PassiveScannerStatus, mirroring the backend's
active/passive vocabulary. Replace the five near-identical per-scanner
detail card files with a single scanner_status_cards.dart (two shared
resolvers plus a config list), and rebuild the combined home card to
iterate a list of scanners with two shape resolvers instead of five
copy-pasted resolve methods.

Extract two reusable mixins:
- PeriodicRebuild: the shared once-a-second "rebuild to refresh elapsed
  text" timer used by the scanner cards and the stale indicator.
- PaginatedListState: the shared pagination state, page-size/page-count
  getters, cancel-token-aware fetch orchestration, and disposal used by
  the device and notification lists.

No behaviour change; ~900 lines removed. Tests and analyzer pass.
2026-06-05 21:57:58 -04:00

26 lines
896 B
Dart

/// Status of a passive scanner (one that listens continuously, e.g. mDNS, SSDP,
/// DHCP). Mirrors the backend's `PassiveSnapshot` / `PassiveScannerStatusResponse`.
class PassiveScannerStatus {
final bool isListening;
final double? listeningForSeconds;
final int devicesSeen;
final double? lastDeviceSeenSecondsAgo;
const PassiveScannerStatus({
required this.isListening,
this.listeningForSeconds,
required this.devicesSeen,
this.lastDeviceSeenSecondsAgo,
});
factory PassiveScannerStatus.fromJson(Map<String, dynamic> json) {
return PassiveScannerStatus(
isListening: json['is_listening'] as bool,
listeningForSeconds: (json['listening_for_seconds'] as num?)?.toDouble(),
devicesSeen: (json['devices_seen'] as num).toInt(),
lastDeviceSeenSecondsAgo: (json['last_device_seen_seconds_ago'] as num?)
?.toDouble(),
);
}
}