fix: show hostname for agent events on dashboard (0.4.8)

Prefix heartbeat and other agent.* lines in recent events with hostname.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
PTah
2026-06-11 10:06:54 +10:00
parent 7e3cb3bcb2
commit 722538f5d9
2 changed files with 16 additions and 3 deletions
@@ -79,7 +79,11 @@ fun DashboardScreen(repo: SacRepository) {
StatCard("Хосты", "${d.hostsTotal} (stale: ${d.hostsStale})")
Text("Последние события", style = MaterialTheme.typography.titleMedium)
d.recentEvents.take(8).forEach { e ->
Text("${e.severity} · ${e.title}", style = MaterialTheme.typography.bodySmall)
Text(
dashboardRecentEventLine(e),
style = MaterialTheme.typography.bodySmall,
color = MaterialTheme.colorScheme.onSurface,
)
}
}
if (data == null && loading) {
@@ -89,6 +93,15 @@ fun DashboardScreen(repo: SacRepository) {
}
}
private fun dashboardRecentEventLine(event: EventSummary): String {
val body = if (event.type.startsWith("agent.")) {
"${event.hostname}: ${event.title}"
} else {
event.title
}
return "${event.severity}: $body"
}
@Composable
private fun StatCard(label: String, value: String) {
Card(Modifier.fillMaxWidth()) {