17 lines
805 B
Dart
17 lines
805 B
Dart
import '../theme/status_colors.dart';
|
|
|
|
/// Maps the API's untyped status strings to a [Severity] for [StatusPill]
|
|
/// rendering. Centralized here (not per-screen) since `Service.status` is
|
|
/// rendered on both the Services table and Fleet's aggregated card grid.
|
|
Severity severityForServiceStatus(String status) => switch (status) {
|
|
'up' => Severity.good,
|
|
'down' => Severity.critical,
|
|
_ => Severity.warning, // "unknown" or anything this client doesn't recognize yet
|
|
};
|
|
|
|
/// Maps a backup/update execution's `success` flag to a [Severity].
|
|
Severity severityForSuccess(bool success) => success ? Severity.good : Severity.critical;
|
|
|
|
/// Maps a [RemoteNode.status]/reachability signal to a [Severity].
|
|
Severity severityForNodeReachable(bool reachable) => reachable ? Severity.good : Severity.critical;
|