Write BU history records from drift checker for anomaly banner detail view

The drift checker now inserts into ivanti_finding_bu_history when it
classifies archived findings as bu_reassignment. Previously only the
inline per-finding BU comparison (for findings still in sync) wrote
history records — archived findings that moved BU were counted in the
anomaly summary but had no detail records for the banner to display.

Also captures title and hostName from the Ivanti API response in the
drift checker for richer detail display, and adjusts the banner's
time window to 10 minutes before sync_timestamp to catch records
written during the drift check phase.
This commit is contained in:
Jordan Ramos
2026-06-15 09:29:46 -06:00
parent e45e40d617
commit a2234ccc1a
2 changed files with 33 additions and 5 deletions

View File

@@ -247,11 +247,18 @@ export default function AnomalyBanner() {
setBuLoading(true);
setBuExpanded(true);
try {
// Scope to changes detected since this anomaly's sync
// Scope to changes detected around this anomaly's sync.
// The drift checker writes BU history records slightly before the anomaly
// summary is recorded, so use a 10-minute window before sync_timestamp.
const since = anomaly?.sync_timestamp || '';
const url = since
? `${API_BASE}/ivanti/findings/bu-changes?since=${encodeURIComponent(since)}`
: `${API_BASE}/ivanti/findings/bu-changes?limit=50`;
let url;
if (since) {
const sinceDate = new Date(since);
sinceDate.setMinutes(sinceDate.getMinutes() - 10);
url = `${API_BASE}/ivanti/findings/bu-changes?since=${encodeURIComponent(sinceDate.toISOString())}`;
} else {
url = `${API_BASE}/ivanti/findings/bu-changes?limit=50`;
}
const res = await fetch(url, { credentials: 'include' });
if (res.ok) {
const data = await res.json();