Files
oott/frontend/lib/model/active_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

28 lines
994 B
Dart

/// Status of an active scanner (one that runs on an interval, e.g. ARP, SNMP).
/// Mirrors the backend's `ActiveSnapshot` / `ActiveScannerStatusResponse`.
class ActiveScannerStatus {
final bool isRunning;
final double? runningForSeconds;
final double? nextRunInSeconds;
final int? lastScanDevicesSeen;
final double? lastScanSecondsAgo;
const ActiveScannerStatus({
required this.isRunning,
this.runningForSeconds,
this.nextRunInSeconds,
this.lastScanDevicesSeen,
this.lastScanSecondsAgo,
});
factory ActiveScannerStatus.fromJson(Map<String, dynamic> json) {
return ActiveScannerStatus(
isRunning: json['is_running'] as bool,
runningForSeconds: (json['running_for_seconds'] as num?)?.toDouble(),
nextRunInSeconds: (json['next_run_in_seconds'] as num?)?.toDouble(),
lastScanDevicesSeen: (json['last_scan_devices_seen'] as num?)?.toInt(),
lastScanSecondsAgo: (json['last_scan_seconds_ago'] as num?)?.toDouble(),
);
}
}