fix: load hidden host events via include_hidden API

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
PTah
2026-06-29 15:16:10 +10:00
parent d794d7dc48
commit 3bb81e40af
2 changed files with 11 additions and 4 deletions
@@ -29,6 +29,8 @@ interface SacApi {
@Query("page_size") pageSize: Int = 30, @Query("page_size") pageSize: Int = 30,
@Query("severity") severity: String? = null, @Query("severity") severity: String? = null,
@Query("type") type: String? = null, @Query("type") type: String? = null,
@Query("host_id") hostId: Long? = null,
@Query("include_hidden") includeHidden: Boolean? = null,
@Query("hostname") hostname: String? = null, @Query("hostname") hostname: String? = null,
@Query("q") q: String? = null, @Query("q") q: String? = null,
): EventListResponse ): EventListResponse
@@ -389,7 +389,7 @@ fun HostDetailScreen(
HostDetailTab.Info -> HostInfoContent(host, repo, dateMode) HostDetailTab.Info -> HostInfoContent(host, repo, dateMode)
HostDetailTab.Events -> HostEventsContent( HostDetailTab.Events -> HostEventsContent(
repo = repo, repo = repo,
hostname = host.hostname, hostId = host.id,
onOpenEvent = onOpenEvent, onOpenEvent = onOpenEvent,
) )
} }
@@ -428,7 +428,7 @@ private fun HostInfoContent(host: HostDetail, repo: SacRepository, dateMode: Dat
@Composable @Composable
private fun HostEventsContent( private fun HostEventsContent(
repo: SacRepository, repo: SacRepository,
hostname: String, hostId: Long,
onOpenEvent: (Long) -> Unit, onOpenEvent: (Long) -> Unit,
) { ) {
var page by remember { mutableIntStateOf(1) } var page by remember { mutableIntStateOf(1) }
@@ -448,7 +448,12 @@ private fun HostEventsContent(
error = null error = null
try { try {
val res = repo.withAuth { val res = repo.withAuth {
it.listEvents(page = page, pageSize = 30, hostname = hostname) it.listEvents(
page = page,
pageSize = 30,
hostId = hostId,
includeHidden = true,
)
} }
items = res.items items = res.items
total = res.total total = res.total
@@ -461,7 +466,7 @@ private fun HostEventsContent(
} }
} }
LaunchedEffect(page, hostname) { load() } LaunchedEffect(page, hostId) { load() }
Column( Column(
Modifier Modifier