Private
Public Access
1
0

feat: add patches missing filter and count indicator to deploy page
Some checks failed
CI Pipeline / Rust Format Check (push) Failing after 36s
CI Pipeline / Clippy Lints (push) Successful in 5m53s
CI Pipeline / Rust Unit Tests (push) Successful in 6m23s
CI Pipeline / Security Audit (push) Successful in 1m30s
CI Pipeline / Frontend Lint & Type Check (push) Successful in 4m29s
CI Pipeline / Build .deb & Release (push) Has been skipped

This commit is contained in:
2026-05-04 18:56:52 +00:00
parent f2b5c0fad5
commit 1ba325d529
4 changed files with 41 additions and 7 deletions

View File

@ -112,6 +112,7 @@ pub struct HostSummary {
pub os_name: Option<String>,
pub health_status: HostHealthStatus,
pub agent_version: Option<String>,
pub patches_missing: i64,
pub registered_at: DateTime<Utc>,
}

View File

@ -109,10 +109,13 @@ async fn list_hosts(
let hosts: Vec<HostSummary> = if auth.role.is_admin() {
sqlx::query_as(
r#"
SELECT id, fqdn, host(ip_address)::text AS ip_address, display_name,
os_family, os_name, health_status, agent_version, registered_at
FROM hosts
ORDER BY fqdn
SELECT h.id, h.fqdn, host(h.ip_address)::text AS ip_address, h.display_name,
h.os_family, h.os_name, h.health_status, h.agent_version,
COALESCE(hpd.patch_count, 0) AS patches_missing,
h.registered_at
FROM hosts h
LEFT JOIN host_patch_data hpd ON hpd.host_id = h.id
ORDER BY h.fqdn
LIMIT $1 OFFSET $2
"#,
)
@ -125,8 +128,11 @@ async fn list_hosts(
r#"
SELECT DISTINCT h.id, h.fqdn, host(h.ip_address)::text AS ip_address,
h.display_name, h.os_family, h.os_name,
h.health_status, h.agent_version, h.registered_at
h.health_status, h.agent_version,
COALESCE(hpd.patch_count, 0) AS patches_missing,
h.registered_at
FROM hosts h
LEFT JOIN host_patch_data hpd ON hpd.host_id = h.id
WHERE
-- Hosts in operator's groups
EXISTS (