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
+2 -2
View File
@@ -13,8 +13,8 @@ android {
applicationId = "ru.kalinamall.seaca" applicationId = "ru.kalinamall.seaca"
minSdk = 26 minSdk = 26
targetSdk = 35 targetSdk = 35
versionCode = 11 versionCode = 12
versionName = "0.4.7" versionName = "0.4.8"
} }
buildTypes { buildTypes {
@@ -79,7 +79,11 @@ fun DashboardScreen(repo: SacRepository) {
StatCard("Хосты", "${d.hostsTotal} (stale: ${d.hostsStale})") StatCard("Хосты", "${d.hostsTotal} (stale: ${d.hostsStale})")
Text("Последние события", style = MaterialTheme.typography.titleMedium) Text("Последние события", style = MaterialTheme.typography.titleMedium)
d.recentEvents.take(8).forEach { e -> 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) { 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 @Composable
private fun StatCard(label: String, value: String) { private fun StatCard(label: String, value: String) {
Card(Modifier.fillMaxWidth()) { Card(Modifier.fillMaxWidth()) {