Private
Public Access
1
0

fix: resolve 6 reporting issues - SQL schema mismatches, duplicate type, UI dropdown, chart scale, CSV error handling
All checks were successful
CI Pipeline / Rust Format Check (push) Successful in 4s
CI Pipeline / Clippy Lints (push) Successful in 57s
CI Pipeline / Rust Unit Tests (push) Successful in 1m17s
CI Pipeline / Security Audit (push) Successful in 5s
CI Pipeline / Frontend Lint & Type Check (push) Successful in 15s
CI Pipeline / Build .deb & Release (push) Has been skipped

1. Compliance CSV/PDF: Replace non-existent pd.total_packages with
   jsonb_array_length(pd.installed_packages) and pd.pending_patches
   with pd.patch_count. Fix GROUP BY to match new columns.

2. Vulnerability CSV/PDF: Replace non-existent pd.cve_data with
   jsonb_array_elements on pd.available_patches JSONB, extracting
   cve_ids via nested lateral join. Replace pd.updated_at with
   pd.polled_at (actual column name).

3. TypeScript: Remove duplicate PollingConfig interface declaration
   in frontend/src/types/index.ts.

4. ReportsPage: Replace Group ID text field with Select dropdown
   populated from GET /api/v1/groups, showing group names instead
   of requiring UUID input.

5. PDF charts: Increase embed_image scale from 0.18 to 0.28 for
   better visibility on A4 landscape pages.

6. Vulnerability CSV: Remove invalid (no data) comment row on
   query failure; return header-only CSV instead to maintain valid
   CSV format.
This commit is contained in:
2026-05-12 19:59:03 +00:00
parent 4c300087f2
commit 2bbc03b937
5 changed files with 77 additions and 71 deletions

View File

@ -1,4 +1,4 @@
import { useState } from 'react'
import { useEffect, useState } from 'react'
import {
Alert,
Box,
@ -22,8 +22,8 @@ import {
import DescriptionIcon from '@mui/icons-material/Description'
import PictureAsPdfIcon from '@mui/icons-material/PictureAsPdf'
import VerifiedUserIcon from '@mui/icons-material/VerifiedUser'
import { reportsApi, settingsApi } from '../api/client'
import type { ReportType, ReportFormat, AuditIntegrityResult } from '../types'
import { reportsApi, settingsApi, apiClient } from '../api/client'
import type { ReportType, ReportFormat, AuditIntegrityResult, Group } from '../types'
// ── Report metadata ───────────────────────────────────────────────────────────
@ -97,11 +97,20 @@ export default function ReportsPage() {
const [fromDate, setFromDate] = useState<string>(defaultFromDate())
const [toDate, setToDate] = useState<string>(defaultToDate())
const [groupId, setGroupId] = useState<string>('')
const [groups, setGroups] = useState<Group[]>([])
const [downloading, setDownloading] = useState(false)
const [error, setError] = useState<string | null>(null)
const [verifyingIntegrity, setVerifyingIntegrity] = useState(false)
const [integrityResult, setIntegrityResult] = useState<AuditIntegrityResult | null>(null)
useEffect(() => {
apiClient.get<Group[]>('/groups').then((res) => {
setGroups(res.data)
}).catch(() => {
// Groups fetch is optional; silently ignore errors
})
}, [])
const info = REPORT_INFO[reportType]
const handleDownload = async (format: ReportFormat) => {
@ -111,7 +120,7 @@ export default function ReportsPage() {
const params: Record<string, string> = {}
if (fromDate) params.from = new Date(fromDate).toISOString()
if (toDate) params.to = new Date(toDate + 'T23:59:59Z').toISOString()
if (reportType === 'compliance' && groupId.trim()) params.group_id = groupId.trim()
if (reportType === 'compliance' && groupId) params.group_id = groupId
const res = await reportsApi.download(reportType, format, params)
@ -203,13 +212,21 @@ export default function ReportsPage() {
{/* Group Filter — compliance only */}
{reportType === 'compliance' && (
<FormControl fullWidth sx={{ mb: 2 }}>
<TextField
label="Group ID (optional)"
<InputLabel id="group-filter-label">Group (optional)</InputLabel>
<Select
labelId="group-filter-label"
value={groupId}
label="Group (optional)"
onChange={(e) => setGroupId(e.target.value)}
placeholder="e.g. 550e8400-e29b-41d4-a716-446655440000"
/>
<FormHelperText>Filter compliance report by a specific group UUID</FormHelperText>
>
<MenuItem value="">All Groups</MenuItem>
{groups.map((g) => (
<MenuItem key={g.id} value={g.id}>
{g.name}
</MenuItem>
))}
</Select>
<FormHelperText>Filter compliance report by a specific group</FormHelperText>
</FormControl>
)}

View File

@ -261,10 +261,6 @@ export interface SmtpConfig {
tls_mode: string
}
export interface PollingConfig {
health_poll_interval_secs: number
patch_poll_interval_secs: number
}
export interface PollingConfig {
health_poll_interval_secs: number
patch_poll_interval_secs: number